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