Re: Help on indexes - Mailing list pgsql-sql

From Josh Berkus
Subject Re: Help on indexes
Date
Msg-id web-1460613@davinci.ethosmedia.com
Whole thread Raw
In response to Help on indexes  (Stephane DEWITTE <stephane@smeso.fr>)
List 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


pgsql-sql by date:

Previous
From: Roberto Mello
Date:
Subject: Re: some questions
Next
From: Ludwig Lim
Date:
Subject: Rules and Triggers