From: Tom Lane <tgl@sss.pgh.pa.us>
To: Neil Conway <neilc@samurai.com>
Cc: Markus Schaber <schabios@logi-track.com>
Cc: PostgreSQL Performance List <pgsql-performance@postgresql.org>
Subject: Re: Multiple Uniques
Date: Thu, 09 Sep 2004 23:07:11 -0400
Message-ID: <13334.1094785631@sss.pgh.pa.us> (raw)
In-Reply-To: <4140E1EF.1040303@samurai.com>
References: <20040902154340.5b1a669a@kingfisher.intern.logi-track.com>
<19516.1094134957@sss.pgh.pa.us>
<4140E1EF.1040303@samurai.com>
Neil Conway <neilc@samurai.com> writes:
> Tom Lane wrote:
>> Because the issue doesn't come up often enough to justify expending
>> cycles to check for it.
> How many cycles are we really talking about, though? I have a patch
> which I'll send along in a few days which implements a similar
> optimization: if a subselect is referenced by EXISTS or IN, we can
> discard DISTINCT and ORDER BY clauses in the subquery
I don't think either of those is worth doing. ORDER BY in a sub-select
isn't even legal SQL, much less probable, so why should we expend even
a nanosecond to optimize it? The DISTINCT is more of a judgment call,
but my thought when I looked at it originally is that it would give
people a possible optimization knob. If you write DISTINCT in an IN
clause then you can get a different plan (the IN reduces to an ordinary
join) that might or might not be better than without it. We shouldn't
take away that possibility just on the grounds of nanny-ism.
regards, tom lane
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: tgl@sss.pgh.pa.us, neilc@samurai.com, schabios@logi-track.com
Subject: Re: Multiple Uniques
In-Reply-To: <13334.1094785631@sss.pgh.pa.us>
* 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