Re: UNION ALL and sequential scans

Список
Период
Сортировка
От Tom Lane
Тема Re: UNION ALL and sequential scans
Дата
Msg-id 11600.1242312767@sss.pgh.pa.us
обсуждение исходный текст
Ответ на UNION ALL and sequential scans  ("Brad Jorsch")
Ответы Re: UNION ALL and sequential scans  (Mathieu De Zutter)
Список pgsql-performance
Дерево обсуждения
UNION ALL and sequential scans  ("Brad Jorsch", )
 Re: UNION ALL and sequential scans  (Tom Lane, )
  Re: UNION ALL and sequential scans  (Mathieu De Zutter, )
   Re: UNION ALL and sequential scans  (Tom Lane, )
"Brad Jorsch" <> writes:
>  But if I add a constant-valued column to indicate which branch of the
>  union each result came from:

>  explain analyze select * from baz join (
>  select id, val, 'foo'::text as source from foo
>  union all
>  select id, val, 'bar'::text as source from bar
>  ) as foobar on(baz.id2=foobar.id) where baz.id1=42;

>  All of a sudden it insists on a sequential scan (and takes 800 times as
>  long to run) even when enable_seqscan is set false. Is there a good
>  reason for this, or is it just a missed opportunity in the optimizer?

It's an ancient and fundamental limitation that is fixed in 8.4.
Do not expect to see it fixed in 8.3.x.

            regards, tom lane

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

Предыдущее
От: Dimitri
Дата:
Сообщение: Re: Any better plan for this query?..
Следующее
От: David Wilson
Дата:
Сообщение: Re: superlative missuse