russm <russm@icorp.com.au> writes:
> Just out of curiosity, why does postgresql's IN perform so poorly?
Because no one's gotten around to improving it.
The current implementation is actually just fine for small numbers of
values in the IN-list. Making it work nicely for large numbers of
values without pessimizing the small-list case would involve supporting
(at least) two implementations and teaching the planner how to choose
one. This definitely should be done, but has not gotten to the top of
anyone's to-do queue.
Most of the complaints we've seen about IN performance have to do with
the IN-subselect case, which is yet a different animal. It's likely
that that will get fixed before anyone worries about the large-number-
of-scalar-values case...
regards, tom lane