Re: [repost] partial index / funxtional idx or bad sql?

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: csajl <csajl(at)yahoo(dot)com>
Cc: <josh(at)agliodbs(dot)com>, <pgsql-performance(at)postgresql(dot)org>
Subject: Re: [repost] partial index / funxtional idx or bad sql?
Date: 2003-05-13 03:47:55
Message-ID: 20030512204533.I20042-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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;

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message csajl 2003-05-13 03:58:54 Re: [repost] partial index / funxtional idx or bad sql?
Previous Message Josh Berkus 2003-05-13 03:32:10 Re: [repost] partial index / funxtional idx or bad sql?