Re: Possible to improve query plan? - Mailing list pgsql-performance

From Mladen Gogala
Subject Re: Possible to improve query plan?
Date
Msg-id 4D34BE7D.3070007@vmsinfo.com
Whole thread Raw
In response to Re: Possible to improve query plan?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-performance
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




pgsql-performance by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: Bad plan when join on function
Next
From: Fernando Hevia
Date:
Subject: Re: Problem with query