Skip site navigation (1) Skip section navigation (2)

Re: 1-/2-dimensional indexes for common columns, rationale?

From: Matthew <matthew(at)flymine(dot)org>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: 1-/2-dimensional indexes for common columns, rationale?
Date: 2008-03-26 15:16:55
Message-ID: Pine.LNX.4.64.0803261510290.20402@aragorn.flymine.org (view raw or flat)
Thread:
Lists: pgsql-performance
On Wed, 26 Mar 2008, A. Kretschmer wrote:
>> create index foo1 on bla (a);
>> create index foo2 on bla (b);
>> create index foo3 on bla (a,b);
>
> Which version do you have? Since 8.1 pg can use a so called 'bitmap
> index scan', because of this feature i guess you don't need the index
> foo3. (if you have 8.1 or higher)

Depending on your query, the bitmap index scan could be a good deal slower 
than index foo3.

All of this depends on what queries you are going to be running, and how 
much you value insert performance compared to select performance. I know 
that foo3 can do everything that foo1 can, so foo1 could be viewed as 
redundant. I'd be interested in hearing from the Powers That Be whether 
foo2 is redundant too. It wasn't a while back.

My impression is that foo3 isn't much more expensive to alter than foo1 - 
is that correct?

Matthew

-- 
Lord grant me patience, and I want it NOW!

In response to

Responses

pgsql-performance by date

Next:From: A. KretschmerDate: 2008-03-26 15:25:18
Subject: Re: 1-/2-dimensional indexes for common columns, rationale?
Previous:From: Marinos YannikosDate: 2008-03-26 15:15:20
Subject: Re: 1-/2-dimensional indexes for common columns, rationale?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group