Re: Optimizing maximum/minimum queries (yet again)

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Optimizing maximum/minimum queries (yet again)
Дата
Msg-id 19257.1113020796@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Optimizing maximum/minimum queries (yet again)  (Neil Conway <neilc@samurai.com>)
Ответы Re: Optimizing maximum/minimum queries (yet again)  (Neil Conway <neilc@samurai.com>)
Список pgsql-hackers
Neil Conway <neilc@samurai.com> writes:
> Does this transformation work for a query of the form:
>      SELECT min(x), max(y) FROM tab WHERE random() > 0.5;

I've been going back and forth on that.  We wouldn't lose a lot in the
real world if we simply abandoned the optimization attempt whenever we
find any volatile functions in WHERE.  OTOH you could also argue that
we have never guaranteed that volatile functions in WHERE would be
evaluated at every table row --- consider something likeSELECT ... WHERE x > 42 AND random() > 0.5;
All that this optimization might do is to further cut the fraction of
table rows at which the volatile function actually gets checked.  So
I'm not seeing that it would break any code that worked reliably before.

Still, if it makes you feel at all uncomfortable, we can just refuse
the optimization in such cases.
        regards, tom lane


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

Предыдущее
От: Neil Conway
Дата:
Сообщение: Re: Optimizing maximum/minimum queries (yet again)
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [PATCHES] DELETE ... USING