pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: LN Cisneros <lnsea@earthlink.net>
To: pgsql-performance@postgresql.org
Subject: rewrite in to exists?
Date: Wed, 17 Sep 2003 21:59:29 -0700 (GMT-07:00)
Message-ID: <20399973.1063861169740.JavaMail.root@rowlf.psp.pas.earthlink.net> (raw)


I'm on 7.3.4 and this query gets horrible performance.  Is there a way to rewrite it with an exists or some way to get better performance?

select code, id, name, date_of_service
  from tbl
where date_of_service in
      (select date_of_service
         from tbl
        where xxx >= '29800'
          and xxx <= '29909'
          and code = 'XX')
  and client_code = 'XX'
order by  id, date_of_service;

Thanks!






view thread (7+ messages)  latest in thread

Message-ID: <20399973.1063861169740.JavaMail.root@rowlf.psp.pas.earthlink.net>
Permalink:  ../20399973.1063861169740.JavaMail.root@rowlf.psp.pas.earthlink.net/
Also on:    postgresql.org/message-id/20399973.1063861169740.JavaMail.root@rowlf.psp.pas.earthlink.net

 · 

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 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: lnsea@earthlink.net
  Subject: Re: rewrite in to exists?
  In-Reply-To: <20399973.1063861169740.JavaMail.root@rowlf.psp.pas.earthlink.net>
  References: <20399973.1063861169740.JavaMail.root@rowlf.psp.pas.earthlink.net>

* 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