Re: "IN" statement causing execution cancel?

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: "IN" statement causing execution cancel?
Дата
Msg-id 200305221024.08355.dev@archonet.com
обсуждение исходный текст
Ответ на Re: "IN" statement causing execution cancel?  (Andrew Ayers <aayers@eldocomp.com>)
Список 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

В списке pgsql-general по дате отправления:

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: compiling mod_auth_pgsql
Следующее
От: Tom Lane
Дата:
Сообщение: Re: VACUUM and transaction ID wraparound