Re: IN list processing performance (yet again)

From: "Mario Weilguni" <mweilguni(at)sime(dot)com>
To: "Dave Tenny" <tenny(at)attbi(dot)com>, <pgsql-performance(at)postgresql(dot)org>
Subject: Re: IN list processing performance (yet again)
Date: 2003-05-28 14:31:37
Message-ID: 002401c32525$d92368e0$1e01c00a@icomedias.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

>
> My application relies heavily on IN lists. The lists are primarily
> constant integers, so queries look like:
>
> SELECT val FROM table WHERE id IN (43, 49, 1001, 100002, ...)
>
> Performance is critical, and the size of these lists depends a lot on
> how the larger 3-tier applicaiton is used,
> but it wouldn't be out of the question to retrieve 3000-10000 items.
>
> PostgreSQL 7.3.2 seems to have a lot of trouble with large lists.

you should rewrite your query if the query is created from an applition:

SELECT val
FROM table
WHERE id between 43 and 100002
AND id IN (43, 49, 1001, 100002, ...)

where 43 is the min and 100002 the max of all values.

I had this case with postgresql 7.2 and the planner made much smarter
choices in my case.

Regards,
Mario Weilguni

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Stephan Szabo 2003-05-28 14:54:26 Re: IN list processing performance (yet again)
Previous Message Andreas Pflug 2003-05-28 13:19:22 Re: IN list processing performance (yet again)