Re: alternate idioms for large "IN (...)" lists - Mailing list pgsql-sql

From Tom Lane
Subject Re: alternate idioms for large "IN (...)" lists
Date
Msg-id 12990.1023147511@sss.pgh.pa.us
Whole thread Raw
In response to Re: alternate idioms for large "IN (...)" lists  (russm <russm@icorp.com.au>)
List pgsql-sql
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


pgsql-sql by date:

Previous
From: "Marie G. Tuite"
Date:
Subject: passing a list to a function and returning a recordset
Next
From: "Sandeep Chibber"
Date:
Subject: Postgres Function Problem