From: | Richard Huxton <dev(at)archonet(dot)com> |
---|---|
To: | Andrew Ayers <aayers(at)eldocomp(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: "IN" statement causing execution cancel? |
Date: | 2003-05-22 09:24:08 |
Message-ID: | 200305221024.08355.dev@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wednesday 21 May 2003 10:16 pm, Andrew Ayers wrote:
> All,
>
> I am having (yet another) problem.
>
> I am attempting to execute, via ODBC (thus, the PostgreSQL ODBC driver
> under Windows), a statement of the form:
>
> SELECT field1 FROM table WHERE field2 IN (list);
>
> Where "list" is a *very* long comma-delimited list of values (on the
> order of several hundred values).
Good to see you've solved it by extending a timeout, but you might find it
executes much faster if you:
1. CREATE TEMP TABLE search_list
2. Insert thousands of values
3. Join against search_list
Especially if your thousands don't change much, then you could make the
search_list table permanent.
Do a search on the mailing list archives for "IN","slow","EXISTS" - PG's
current handling of IN isn't as smart as it might be.
--
Richard Huxton
From | Date | Subject | |
---|---|---|---|
Next Message | Martijn van Oosterhout | 2003-05-22 09:26:46 | Re: compiling mod_auth_pgsql |
Previous Message | Jules Chalier | 2003-05-22 09:15:14 | latin1 -> unicode |