SHADOWPLAY - Dave Adams <[EMAIL PROTECTED]> writes: > When using a view on a table, a select on the view is not as optimized as > a select directly from the table.
PG 7.3 is not very bright about pushing WHERE quals down into a sub-select that involves DISTINCT ON. 7.4 is a tad smarter, and I think it will handle your example nicely --- though there are certainly plenty of similar-looking cases that are just plain not optimizable. You might find it interesting to compare the comments in the 7.3 and 7.4 versions of http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/optimizer/path/allpaths.c in particular the 1.99-1.100 diff. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly