Re: Multiple indexes or multi-column index?

From: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
To: Jeff Boes <jboes(at)nexcerpt(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Multiple indexes or multi-column index?
Date: 2002-08-13 21:19:51
Message-ID: Pine.GSO.4.44.0208140016420.17329-100000@ra.sai.msu.su
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)sai(dot)msu(dot)su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Thomas O'Connell 2002-08-13 21:23:26 Re: performance tuning: shared_buffers, sort_mem; swap
Previous Message Tom Lane 2002-08-13 21:02:47 Re: performance tuning: shared_buffers, sort_mem; swap