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 several rows in forumlog for each row in post, then 
your query won't work either.

> 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, replied desc;       

Instead:

if only one row in forumlog per row in post:

SELECT (replied > lastview) AS newflag, post.* 
FROM post, forumlog
WHERE post.forum = 'General' and toppost = 1 and forumlog.login = 'genesis'
and forumlog.forum='General' and forumlog.number=post.number;

-- 
-Josh Berkus
 Aglio Database Solutions
 San Francisco


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to