Re: Help on indexes

From: "Josh Berkus" <josh(at)agliodbs(dot)com>
To: Stephane DEWITTE <stephane(at)smeso(dot)fr>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Help on indexes
Date: 2002-05-15 15:19:46
Message-ID: web-1460613@davinci.ethosmedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Stephane,

> I don't understanf why it makes a seq scan on table mldecs on cases 2
> and 3,
> according that mldecs(ldec_dec_cod) has an index (named
> ldec_dec_cod_mldecs_key). The base is vacuumed and analyzed every
> night. How
> can I use the ldec_dec_cod_mldecs_key index on mldecs ?

First question: Have you actually measured the execution time of the
various queries? There are many cases where a Seq Scan is faster than
an Index Scan. For example, if in Case2, 50% of the entries were
values 'X' of 'Y', then a Seq Scan is the better approach.

Please determine that you actually have a problem with slow execution.
Otherwise, the query parser is just doing its job.

-Josh Berkus

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Ludwig Lim 2002-05-16 04:59:40 Rules and Triggers
Previous Message Roberto Mello 2002-05-15 14:49:29 Re: some questions