Re: Very large IN-clause is slow, but how to rewrite it?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Very large IN-clause is slow, but how to rewrite it?
Дата
Msg-id 9473.1172428484@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Very large IN-clause is slow, but how to rewrite it?  (Joe Conway <mail@joeconway.com>)
Ответы Re: Very large IN-clause is slow, but how to rewrite it?  (Richard Jones <rich@annexia.org>)
Список pgsql-sql
Joe Conway <mail@joeconway.com> writes:
> If 8.2, what about
>    ... WHERE foo IN (select x from (values (1$),(2$),...,(N$)) as t(x))
> ?

Well, the OP wasn't using 8.2 --- judging from the selected plan, it had
to be 8.0 or older.  But yeah, a values-list is an interesting
alternative on 8.2.  I think actually you don't need all that much extra
notation; this seems to work:
WHERE foo IN (VALUES ($1),($2),($3),...)
        regards, tom lane


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

Предыдущее
От: Joe Conway
Дата:
Сообщение: Re: Very large IN-clause is slow, but how to rewrite it?
Следующее
От: Richard Jones
Дата:
Сообщение: Re: Very large IN-clause is slow, but how to rewrite it?