Re: Union strange explain

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Union strange explain
Дата
Msg-id 6645.1025828877@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Union strange explain  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Список pgsql-admin
Stephan Szabo <sszabo@megazone23.bigpanda.com> writes:
> I think there was some question about
> whether it was safe to do that optimization (ie,
> is select * from (a union [all] b) where condition
> always the same as
>  select * from a where condition union [all]
>  select * from b where condition
> )
> This was discussed recently, but I forget what the final determination
> was.

There wasn't any final determination --- it's still an open issue
whether there are any limitations the planner would have to consider
when trying to push down conditions into UNIONs.  Offhand it seems
to me that the change is always safe when dealing with UNION ALL,
but I'm not quite convinced about UNION.  And what of INTERSECT
and EXCEPT?

Another interesting question is whether there are cases where the
planner could legally push down the condition, but should not because
it would end up with a slower plan.  I can't think of any examples
offhand, but that doesn't mean there aren't any.

            regards, tom lane



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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Performance impact of record sizes
Следующее
От: Gregor Mosheh
Дата:
Сообщение: memory strangeness (fwd)