Re: Multiple Uniques

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Multiple Uniques
Дата
Msg-id 13334.1094785631@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Multiple Uniques  (Neil Conway <neilc@samurai.com>)
Ответы Re: Multiple Uniques
Question on Byte Sizes
Список pgsql-performance
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

В списке pgsql-performance по дате отправления:

Предыдущее
От: Neil Conway
Дата:
Сообщение: Re: Multiple Uniques
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Costly "Sort Key" on indexed timestamp column