pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joe Conway <mail@joeconway.com>
To: Steve Wampler <swampler@noao.edu>
Cc: pgsql-sql@postgresql.org
Subject: Re: Replacing a simple nested query?
Date: Sun, 13 Jul 2003 15:01:13 -0700
Message-ID: <3F11D6A9.4040905@joeconway.com> (raw)
In-Reply-To: <20030713215042.GA18643@weaver.tuc.noao.edu>
References: <20030713215042.GA18643@weaver.tuc.noao.edu>

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




view thread (3+ messages)  latest in thread

Message-ID: <3F11D6A9.4040905@joeconway.com>
Permalink:  ../3F11D6A9.4040905@joeconway.com/
Also on:    postgresql.org/message-id/3F11D6A9.4040905@joeconway.com

 · 

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: mail@joeconway.com, swampler@noao.edu
  Subject: Re: Replacing a simple nested query?
  In-Reply-To: <3F11D6A9.4040905@joeconway.com>

* 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