Re: Yet another 'why does it not use my index' question.

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Ryan <pgsql-performance(at)seahat(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Yet another 'why does it not use my index' question.
Date: 2003-05-07 16:28:15
Message-ID: 20030507162815.GA27158@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Wed, May 07, 2003 at 09:11:49 -0500,
Ryan <pgsql-performance(at)seahat(dot)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.

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Achilleus Mantzios 2003-05-07 16:33:24 An unresolved performance problem.
Previous Message scott.marlowe 2003-05-07 15:42:27 Re: An unresolved performance problem.