pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: csajl <csajl@yahoo.com>
To: pgsql-performance@postgresql.org
Subject: Re: [repost] partial index / funxtional idx or bad sql?
Date: Mon, 12 May 2003 20:32:10 -0700
Message-ID: <200305122032.10928.josh@agliodbs.com> (raw)
In-Reply-To: <20030513004710.58428.qmail@web40312.mail.yahoo.com>
References: <20030513004710.58428.qmail@web40312.mail.yahoo.com>

Csajl,

> 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.
<snip>
> classifieds_dual_idx  is the btree index on (class_type_id, areacode)
> and site_cm_areacode_idx is the btree index on (site_id) only.
> there is an index in the areacode table that has both (site_id, areacode)
> but it's apparently not being used.  would it help the query to use that
> index instead?

No.  
From the look of things, it's not the index scan that's taking time ... it's 
the subplan, which is doing 61,000 loops.   Which is normal for IN, but not 
for EXISTS.   You run VACUUM ANALYZE?

-- 
Josh Berkus
Aglio Database Solutions
San Francisco




view thread (10+ messages)  latest in thread

Message-ID: <200305122032.10928.josh@agliodbs.com>
Permalink:  ../200305122032.10928.josh@agliodbs.com/
Also on:    postgresql.org/message-id/200305122032.10928.josh@agliodbs.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 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: josh@agliodbs.com, csajl@yahoo.com
  Subject: Re: [repost] partial index / funxtional idx or bad sql?
  In-Reply-To: <200305122032.10928.josh@agliodbs.com>
  References: <20030513004710.58428.qmail@web40312.mail.yahoo.com> <200305122032.10928.josh@agliodbs.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