Multi-column index not used, new flipped column index is - Mailing list pgsql-sql

From
Subject Multi-column index not used, new flipped column index is
Date
Msg-id 20060510162143.96628.qmail@web50306.mail.yahoo.com
Whole thread Raw
Responses Re: Multi-column index not used, new flipped column index is
List pgsql-sql
Hi,

I'm using PG 8.0.3 and recently spotted a query that was not using a multi-column index I had created.
The index looks like:
 CREATE INDEX ..... ON FooTable(fkColumnOne, fkColumnTwo);

The query that was not using the index was using:
 SELECT .... a bunch of columns and joins .... WHERE FooTable.fkColumnTwo=1000;

So I added another index where the indexed columns are flipped:
 CREATE INDEX ..... ON FooTable(fkColumnTwo, fkColumnOne);
Now the query started to use that index -- gooooood!
But now I have 2 indices that are nearly the same, and that means overhead during INSERTs/DELETEs. :(

Is there a way to get this to use that first index, so I don't have to have this additional index?
If I had PG 8.1.3, would PG know how to use that first index?  I seem to recall something about this somewhere... but I
don'tsee it at http://www.postgresql.org/docs/whatsnew .
 

Thanks,
Otis





pgsql-sql by date:

Previous
From: "gourish singbal"
Date:
Subject: Fw: i am getting error when i am using copy command
Next
From: Markus Schaber
Date:
Subject: Re: Multi-column index not used, new flipped column index is