pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: Ryan <pgsql-performance@seahat.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Yet another 'why does it not use my index' question.
Date: Wed, 7 May 2003 11:28:15 -0500
Message-ID: <20030507162815.GA27158@wolff.to> (raw)
In-Reply-To: <11207.65.102.128.233.1052316709.squirrel@fordparts.com>
References: <11207.65.102.128.233.1052316709.squirrel@fordparts.com>

On Wed, May 07, 2003 at 09:11:49 -0500,
  Ryan <pgsql-performance@seahat.com> wrote:
> I wanted to do the following:
> 
> midas=# explain analyze select * from zip where zip in
>  (select option_value from client_options where option_name = 'ZIP_CODE' );

Until 7.4 comes out IN will be slow and you should use a join to do this.

> midas=# explain analyze select * from zip z, client_options c where
> c.option_name = 'ZIP_CODE' and c.option_value = z.zip;

I think the problem here might be related to option_value being text
and zip being char varying. This might prevent an index from being used
to do the join.




view thread (3+ messages)

Message-ID: <20030507162815.GA27158@wolff.to>
Permalink:  ../20030507162815.GA27158@wolff.to/
Also on:    postgresql.org/message-id/20030507162815.GA27158@wolff.to

 · 

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: bruno@wolff.to, pgsql-performance@seahat.com
  Subject: Re: Yet another 'why does it not use my index' question.
  In-Reply-To: <20030507162815.GA27158@wolff.to>
  References: <11207.65.102.128.233.1052316709.squirrel@fordparts.com> <20030507162815.GA27158@wolff.to>

* 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