pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Jones <rich@annexia.org>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Joe Conway <mail@joeconway.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Very large IN-clause is slow, but how to rewrite it?
Date: Sun, 25 Feb 2007 19:39:05 +0000
Message-ID: <20070225193905.GD16669@furbychan.cocan.org> (raw)
In-Reply-To: <9473.1172428484@sss.pgh.pa.us>
References: <20070225123913.GA17124@furbychan.cocan.org>
	<7794.1172422591@sss.pgh.pa.us>
	<45E1D4FC.4050901@joeconway.com>
	<9473.1172428484@sss.pgh.pa.us>

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.



view thread (6+ messages)

Message-ID: <20070225193905.GD16669@furbychan.cocan.org>
Permalink:  ../20070225193905.GD16669@furbychan.cocan.org/
Also on:    postgresql.org/message-id/20070225193905.GD16669@furbychan.cocan.org

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: rich@annexia.org, tgl@sss.pgh.pa.us, mail@joeconway.com
  Subject: Re: Very large IN-clause is slow, but how to rewrite it?
  In-Reply-To: <20070225193905.GD16669@furbychan.cocan.org>

* 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