Re: [PERFORM] Why is query selecting sequential?

2004-02-08 Thread Josh Berkus
Karl, BTW, the other posted cleaner model doesn't work for me. If there is NO row in the subtable that matches, the other version returns nothing (which makes sense since the initial select fails to match any rows as one of the things its trying to match is missing.) Ah, wasn't thinking of

Re: [PERFORM] Why is query selecting sequential?

2004-02-07 Thread Tom Lane
Karl Denninger [EMAIL PROTECTED] writes: akcs= explain analyze select forum, (replied (select lastview from forumlog where forumlog.login='genesis' and forumlog.forum='General' and number=post.number)) as newflag, * from post where forum = 'General' and toppost = 1 order by pinned desc,

Re: [PERFORM] Why is query selecting sequential?

2004-02-06 Thread Josh Berkus
Karl, SubPlan - Seq Scan on forumlog (cost=0.00..1.18 rows=1 width=8) Filter: ((login = '%s'::text) AND (forum = '%s'::text) AND (number = $0)) Why is the subplan using a sequential scan? At minimum the index on the post number (forumlog_number)

Re: [PERFORM] Why is query selecting sequential?

2004-02-06 Thread Josh Berkus
Karl, Well, still with only 5 rows in the forumlog table you're not going get realistic results compared to a loaded database. However, you are making things difficult for the parser with awkward query syntax; what you currently have encourages a sequential loop. If there are potentially