X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id B0383CBB05 for ; Sun, 13 Jul 2003 22:06:41 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 87782-06 for ; Sun, 13 Jul 2003 22:07:01 +0000 (GMT) Received: from joeconway.com (66-146-172-86.skyriver.net [66.146.172.86]) by svr1.postgresql.org (Postfix) with ESMTP id B1F3CCBB03 for ; Sun, 13 Jul 2003 19:06:38 -0300 (ADT) Received: from [192.168.5.3] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 4.0.6) with ESMTP-TLS id 1823616; Sun, 13 Jul 2003 14:34:01 -0700 Message-ID: <3F11D6A9.4040905@joeconway.com> Date: Sun, 13 Jul 2003 15:01:13 -0700 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Steve Wampler Cc: pgsql-sql@postgresql.org Subject: Re: Replacing a simple nested query? References: <20030713215042.GA18643@weaver.tuc.noao.edu> In-Reply-To: <20030713215042.GA18643@weaver.tuc.noao.edu> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/156 X-Sequence-Number: 14270 Steve Wampler wrote: > 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. I may be missing something, but why can't you just do: select * from attributes where name='obsid' and value='oid00066'; ? Joe