Re: slow IN() clause for many cases

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: slow IN() clause for many cases
Дата
Msg-id 1373.1129128712@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: slow IN() clause for many cases  (Andrew - Supernews <andrew+nonews@supernews.com>)
Список pgsql-hackers
Andrew - Supernews <andrew+nonews@supernews.com> writes:
> As the number of items in the IN clause increases, the planning time grows
> rather radically.

I was looking at this yesterday.  There is some O(N^2) behavior in
create_bitmap_subplan, stemming from trying to remove duplicated qual
conditions.  That strikes me as a relatively useless activity, and I was
thinking the easiest answer might be to just delete that "optimization".

> The actual execution time of these two is very close, with the second
> being about 10% slower on my system (31ms vs 34ms, based on \timing values
> from psql and averaged over several goes). However, the timings returned
> from EXPLAIN ANALYZE are much more skewed: 42ms vs 66ms as reported in the
> "total runtime" line. So not only is the planning time different, but also
> the instrumentation overhead of EXPLAIN ANALYZE is wildly different between
> the two forms.

Yeah, this isn't all that surprising because of the larger number of
plan nodes involved in the bitmap plan.
        regards, tom lane


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

Предыдущее
От: "Magnus Hagander"
Дата:
Сообщение: Re: Socket problem using beta2 on Windows-XP
Следующее
От: "Kevin Grittner"
Дата:
Сообщение: Re: database vacuum from cron hanging