Re: How to push predicate down

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: How to push predicate down
Дата
Msg-id 15060.1327625651@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: How to push predicate down  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
I wrote:
> Hmm.  The code explicitly won't push conditions down through an EXCEPT:
>  * 3. If the subquery contains EXCEPT or EXCEPT ALL set ops we cannot push
>  * quals into it, because that could change the results.
> I remember coming to the conclusion that this is safe for
> UNION/INTERSECT but not EXCEPT, but right at the moment I'm not sure why
> I thought that --- it seems like a qual that suppresses specific rows
> should suppress all matching copies.

I dug in the archives and found the discussion that led up to the
current behavior; see thread starting here
http://archives.postgresql.org/pgsql-hackers/2002-08/msg00041.php

The issue is that rows that are "equal" according to the rules used by
UNION/INTERSECT/EXCEPT may nonetheless be distinguishable to the
expression in the upper WHERE clause, and if that's the case, pushing
down the WHERE can lead to provably incorrect results.  So the behavior
is correct, or at least very difficult to improve on, as it stands.

            regards, tom lane

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

Предыдущее
От: Scott Marlowe
Дата:
Сообщение: Re: Preventing access temporarily.
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Optimizing Queries Joining Several Views