Re: Forcing the use of one index instead other.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Edmundo Robles L(dot)" <erobles(at)sensacd(dot)com(dot)mx>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Forcing the use of one index instead other.
Date: 2009-06-02 17:12:22
Message-ID: 15048.1243962742@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Edmundo Robles L." <erobles(at)sensacd(dot)com(dot)mx> writes:
> I have two index with a same field into them like this:

> create index numberfail on Events (numberfail);
> and
> create index failtype on Events (numberfail,eventtype);

> then i ran explain analyze and always took the numberfail index but
i wish the failtype index;

Uh, why? If you have the smaller index available it's hard to imagine
any sane reason not to use it.

> I though maybe if i delete the index numberfail could works, but i don't know if the another program
> will fail if the numberfail index does'nt exists.

No, you can drop that one if you want to. You might care to read the
fine manual about index design:
http://www.postgresql.org/docs/8.3/static/indexes.html

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message pribram pribram 2009-06-02 17:20:16 lc_messages on 8.3.7
Previous Message Ries van Twisk 2009-06-02 16:59:39 Re: Forcing the use of one index instead other.