Re: [repost] partial index / funxtional idx or bad sql?
Stephan Szabo <sszabo@megazone23.bigpanda.com>
From: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: csajl <csajl@yahoo.com>
Cc: <josh@agliodbs.com>, <pgsql-performance@postgresql.org>
Date: 2003-05-13T03:47:55Z
Lists: pgsql-performance
On Mon, 12 May 2003, csajl wrote: > i'm using 7.3.2. i tried using EXISTS instead of the IN, but the same query > now returns in seven sceonds as opposed to four with the IN. > > > cmdb=# EXPLAIN ANALYZE > cmdb-# select c.class_id, c.areacode, c.title from classifieds c > cmdb-# where c.class_cat_id = '1' > cmdb-# and c.areacode IN ( > cmdb(# select areacode from cm_areacode where site_id = '10') > cmdb-# ; How about something like: select c.class_id, c.areacode, c.title from classifieds c, (select distinct areacode from cm_areacode where site_id='10') a where c.class_cat_id='1' and c.areacode=a.areacode;