There's something odd about that plan. It's doing both a seq scan and a bitmap scan on "items", but I can't see stats table being mentioned anywhere.
Huh? Aaah, sorry. I made a major search/replace-refactoring (that obviously went wrong) on all open files in the editor before posting to this newsgroup, and one of these files was my preparation of the queries and planner output. Damn.
Sorry for wasting your time! :-( However, your suggestion worked perfectly. Thanks a lot! ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org