Re: plan difference between set-returning function with ROWS within IN() and a plain join

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: plan difference between set-returning function with ROWS within IN() and a plain join
Дата
Msg-id 13551.1210083430@sss.pgh.pa.us
обсуждение исходный текст
Ответ на plan difference between set-returning function with ROWS within IN() and a plain join  (Frank van Vugt <ftm.van.vugt@foxi.nl>)
Ответы Re: plan difference between set-returning function with ROWS within IN() and a plain join  (Frank van Vugt <ftm.van.vugt@foxi.nl>)
Список pgsql-performance
Frank van Vugt <ftm.van.vugt@foxi.nl> writes:
> db=# explain analyse
>     select sum(base_total_val)
>     from sales_invoice
>     where id in (select id from si_credit_tree(80500007));

Did you check whether this query even gives the right answer?  The
EXPLAIN output shows that 21703 rows of sales_invoice are being
selected, which is a whole lot different than the other behavior.

I think you forgot the alias foo(id) in the subselect and it's
actually reducing to "where id in (id)", ie, TRUE.

            regards, tom lane

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

Предыдущее
От: Justin
Дата:
Сообщение: Re: need to speed up query
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Seqscan problem