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?
Дата
Msg-id 20070225193905.GD16669@furbychan.cocan.org
обсуждение исходный текст
Ответ на Re: Very large IN-clause is slow, but how to rewrite it?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-sql
On Sun, Feb 25, 2007 at 01:34:44PM -0500, Tom Lane wrote:
> 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),...)

That's right, it is in fact PG 7.4.

I will try the values suggestion to see if that makes a difference.

Rich.


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Very large IN-clause is slow, but how to rewrite it?
Следующее
От: "Phillip Smith"
Дата:
Сообщение: Re: Insert based in a select