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