Re: "Overlaping" indexes - Mailing list pgsql-performance

From scott.marlowe
Subject Re: "Overlaping" indexes
Date
Msg-id Pine.LNX.4.33.0402021155530.19831-100000@css120.ihs.com
Whole thread Raw
In response to Re: "Overlaping" indexes  (Tomasz Myrta <jasiek@klaster.net>)
List pgsql-performance
On Mon, 2 Feb 2004, Tomasz Myrta wrote:

> Dnia 2004-02-02 19:30, U¿ytkownik scott.marlowe napisa³:
> > Not entirely, since it only has to sort two columns, it will be smaller,
> > and will therefore be somewhat faster.
>
> Can you say something more about it? Will it be enough faster to keep
> them both? Did anyone make such tests?

that really depends on the distribution of the third column.  If there's
only a couple of values in the third column, no big deal.  If each entry
is unique, and it's a large table, very big deal.

It is only useful to have a three column index if you actually use it.  If
you have an index on (a,b,c) and select order by b, the index won't get
used unless the a part is in the where clause.

the other issue is updates.  IT WILL cost more to update two indexes
rather than one.  Generally, you can drop / readd the index and use
explain analyze on one of your own queries to see if that helps.


pgsql-performance by date:

Previous
From: Tomasz Myrta
Date:
Subject: Re: "Overlaping" indexes
Next
From: Rod Taylor
Date:
Subject: Re: "Overlaping" indexes