pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mario Weilguni <mweilguni@sime.com>
To: Dave Tenny <tenny@attbi.com>
To: pgsql-performance@postgresql.org
Subject: Re: IN list processing performance (yet again)
Date: Wed, 28 May 2003 16:31:37 +0200
Message-ID: <002401c32525$d92368e0$1e01c00a@icomedias.com> (raw)
References: <3ED4B0E5.3050703@attbi.com>

>
> 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





view thread (23+ messages)  latest in thread

Message-ID: <002401c32525$d92368e0$1e01c00a@icomedias.com>
Permalink:  ../002401c32525$d92368e0$1e01c00a@icomedias.com/
Also on:    postgresql.org/message-id/002401c32525$d92368e0$1e01c00a@icomedias.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: mweilguni@sime.com, tenny@attbi.com
  Subject: Re: IN list processing performance (yet again)
  In-Reply-To: <002401c32525$d92368e0$1e01c00a@icomedias.com>
  References: <3ED4B0E5.3050703@attbi.com> <002401c32525$d92368e0$1e01c00a@icomedias.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox