Re: Forcing the use of one index instead other.

From: Ries van Twisk <pg(at)rvt(dot)dds(dot)nl>
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 16:59:39
Message-ID: 23DF88CC-374D-4025-AD0B-1A736853B5AA@rvt.dds.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

You could remove the index numberfail.

PG can use the index failtype in the case you just need a where clause
on numberfail also....

Ries

>
> Hello there!
>
>
> 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;
>
>
>
> this is the query:
>
>
> SELECT * FROM events WHERE numberfail=194 AND eventtype='XXX';
>
> What should i to do to force the use of failtypeindex????
>
> 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.
>
>
> well, thats all for the moment and i appreciate your time in reading
> this mail!!!
> See you.
> --
> SENSA Control Digital.
> Ing. Edmundo Robles Lopez.
> Analista Programador.
>
>

regards, Ries van Twisk

-------------------------------------------------------------------------------------------------
Ries van Twisk
tags: Freelance TYPO3 Glassfish JasperReports JasperETL Flex Blaze-DS
WebORB PostgreSQL DB-Architect
email: ries(at)vantwisk(dot)nl
web: http://www.rvantwisk.nl/
skype: callto://r.vantwisk
Phone: +1-810-476-4196
SIP: +1-747-690-5133

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2009-06-02 17:12:22 Re: Forcing the use of one index instead other.
Previous Message Tom Lane 2009-06-02 16:54:10 Re: timestamp no fractional seconds