rewrite in to exists?

From: LN Cisneros <lnsea(at)earthlink(dot)net>
To: pgsql-performance(at)postgresql(dot)org
Subject: rewrite in to exists?
Date: 2003-09-18 04:59:29
Message-ID: 20399973.1063861169740.JavaMail.root@rowlf.psp.pas.earthlink.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance


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!

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Christopher Kings-Lynne 2003-09-18 05:23:37 Re: rewrite in to exists?
Previous Message Christopher Browne 2003-09-18 01:59:43 Re: Is there a reason _not_ to vacuum continuously?