Re: Multiple indexes or multi-column index? - Mailing list pgsql-admin

From Oleg Bartunov
Subject Re: Multiple indexes or multi-column index?
Date
Msg-id Pine.GSO.4.44.0208140016420.17329-100000@ra.sai.msu.su
Whole thread Raw
In response to Multiple indexes or multi-column index?  (Jeff Boes <jboes@nexcerpt.com>)
List pgsql-admin
On Tue, 13 Aug 2002, Jeff Boes wrote:

> Given a large (100,000+ rows) table such as:
>
> CREATE TABLE foo (
>   a INTEGER,
>   b INTEGER,
>   c TIMESTAMP,
>   d TEXT
>   /* possibly several more columns in here */
> );
>
> What are the pros and cons of these two different approaches to indexes?
>
> CREATE huge_index ON foo (a,b,c,d);
>
> vs.
>
> CREATE a_index ON foo (a);
> CREATE b_index ON foo (b);
> CREATE c_index ON foo (c);
> CREATE d_index ON foo (d);

(a,b,c,d) *would be* probably fast for queries(a,b,c,d),
but note it will not work for

queries(NULL,b,c,d)
queries(NULL,NULL,c,d)
queries(NULL,NULL,NULL,d)

and should still works for

queries(a,b,c,NULL)
queries(a,b,MULL,NULL)
queries(a,NULL,MULL,NULL)

>
>

    Regards,
        Oleg
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83


pgsql-admin by date:

Previous
From: Jeff Boes
Date:
Subject: Multiple indexes or multi-column index?
Next
From: "Marc Mitchell"
Date:
Subject: Re: Multiple indexes or multi-column index?