From: Mladen Gogala <mladen.gogala@vmsinfo.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Jeremy Palmer <JPalmer@linz.govt.nz>
Cc: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: Possible to improve query plan?
Date: Mon, 17 Jan 2011 17:11:09 -0500
Message-ID: <4D34BE7D.3070007@vmsinfo.com> (raw)
In-Reply-To: <20065.1295295866@sss.pgh.pa.us>
References: <666FB8D75E95AE42965A0E76A5E5337E06D2C683BF@prdlsmmsg01.ad.linz.govt.nz>
<20065.1295295866@sss.pgh.pa.us>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: mladen.gogala@vmsinfo.com, tgl@sss.pgh.pa.us, JPalmer@linz.govt.nz
Subject: Re: Possible to improve query plan?
In-Reply-To: <4D34BE7D.3070007@vmsinfo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox