From: Tom Lane <tgl@sss.pgh.pa.us>
To: Richard Jones <rich@annexia.org>
Cc: pgsql-sql@postgresql.org
Subject: Re: Very large IN-clause is slow, but how to rewrite it?
Date: Sun, 25 Feb 2007 11:56:31 -0500
Message-ID: <7794.1172422591@sss.pgh.pa.us> (raw)
In-Reply-To: <20070225123913.GA17124@furbychan.cocan.org>
References: <20070225123913.GA17124@furbychan.cocan.org>
Richard Jones <rich@annexia.org> writes:
> I've been profiling a PG database / mix of applications and found that
> one statement which takes a very long time to execute is:
PG 8.2 does better with long IN-lists ... although if the list is so
long as to be fetching a significant fraction of the table, you'll still
have problems. In that case I'd advise putting the values into a temp
table, ANALYZEing same, and doing "WHERE foo IN (SELECT x FROM tmp_table)".
regards, tom lane
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: tgl@sss.pgh.pa.us, rich@annexia.org
Subject: Re: Very large IN-clause is slow, but how to rewrite it?
In-Reply-To: <7794.1172422591@sss.pgh.pa.us>
* 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