Replacing a simple nested query? - Mailing list pgsql-sql

From Steve Wampler
Subject Replacing a simple nested query?
Date
Msg-id 20030713215042.GA18643@weaver.tuc.noao.edu
Whole thread Raw
Responses Re: Replacing a simple nested query?
Re: Replacing a simple nested query?
List pgsql-sql
I've got a simple nested query:
 select * from attributes where id in (select id from    attributes where (name='obsid') and (value='oid00066'));

that performs abysmally.  I've heard this described as the
'classic WHERE IN' problem.

Is there a better way to obtain the same results?  The inner
select identifies a set of ids (2049 of them, to be exact)
that are then used to locate records that have the same id
(about 30-40K of those, including the aforementioned 2049).

Thanks!
-Steve

-- 
Steve Wampler -- swampler@noao.edu
Quantum materiae materietur marmota monax si marmota                   monax materiam possit materiari?


pgsql-sql by date:

Previous
From: Jan Wieck
Date:
Subject: Re: trigger proceedures in sql
Next
From: Joe Conway
Date:
Subject: Re: Replacing a simple nested query?