Re: Possible to improve query plan?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tom Lane wrote:
If I'm not mistaken, that's a DB2-ish locution

It could also be a part of the Oracle vernacular. I've seen queries like that running against Oracle RDBMS, too.

for a query with DISTINCT
ON, ie, you're looking for the row with highest _revision_created for
each value of id.  It might perform well on DB2, but it's going to
mostly suck on Postgres --- we don't optimize window-function queries
very much at all at the moment.
Hmmm, what optimizations do you have in mind? I thought that window functions are just clever tricks with memory? Anything that can be expected for 9.0x?


Try writing it with DISTINCT ON instead
of a window function, like so:
Wouldn't "distinct" necessarily bring about the sort/merge?

--

Mladen Gogala Sr. Oracle DBA
1500 Broadway
New York, NY 10036
(212) 329-5251
http://www.vmsinfo.com The Leader in Integrated Media Intelligence Solutions




--
Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux