From: Christopher Kings-Lynne <chriskl@familyhealth.com.au>
To: Dave Tenny <tenny@attbi.com>
To: Bruno Wolff III <bruno@wolff.to>
Cc: Andreas Pflug <Andreas.Pflug@web.de>
Cc: pgsql-performance@postgresql.org
Subject: Re: IN list processing performance (yet again)
Date: Thu, 29 May 2003 09:53:55 +0800
Message-ID: <0b9a01c32585$2a8e6900$6500a8c0@fhp.internal> (raw)
References: <3ED4B0E5.3050703@attbi.com>
<3ED4B75A.2050106@web.de>
<3ED4FB02.1010908@attbi.com>
<20030528183914.GA6118@wolff.to>
<3ED5159E.2050407@attbi.com>
> Also, IN (subquery) is a known performance problem in PGSQL, at least if
the subquery is going to return > many rows.
> It's too bad, since I'm rather fond of subqueries, but I avoid them like
the plague in PostgreSQL.
You're not really using a subquery - really just a long list of integers.
Subqueries are lightning fast, so long as you conver to the EXISTS form:
SELECT * FROM tab WHERE id IN (SELECT id2 FROM tab2);
converts to:
SELECT * FROM tab WHERE EXISTS (SELECT id2 FROM tab2 WHERE id2=id);
Chris
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-performance@postgresql.org
Cc: chriskl@familyhealth.com.au, tenny@attbi.com, bruno@wolff.to, Andreas.Pflug@web.de
Subject: Re: IN list processing performance (yet again)
In-Reply-To: <0b9a01c32585$2a8e6900$6500a8c0@fhp.internal>
References: <3ED4B0E5.3050703@attbi.com> <3ED4B75A.2050106@web.de> <3ED4FB02.1010908@attbi.com> <20030528183914.GA6118@wolff.to> <3ED5159E.2050407@attbi.com> <0b9a01c32585$2a8e6900$6500a8c0@fhp.internal>
* 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