Thread: Multi-column Indexes. What is best Conan?

Multi-column Indexes. What is best Conan?

From
Rodney McDuff
Date:
Hi
    When you have a table with multiple columns and you want indexes on
them you can either
(a) create index table_idx on table using btree ( col1, col2, ..., col7);

or
(b) create index table_col1_idx  on table using btree ( col1 );
    create index table_col2_idx  on table using btree ( col2 );
    .
    .
    .

But what is best?


Re: [GENERAL] Multi-column Indexes. What is best Conan?

From
dustin sallings
Date:
On Wed, 10 Mar 1999, Rodney McDuff wrote:

    Those do two different things.  If you always plan using doing
lookups on both of those columns at the same time, it only makes sense to
do one index with both.  If you rarely do, but do lots of lookups using
either, then do more than one index.  You also might want to do both,
depending on what you're doing.

    I think a good rule of thumb is to index as much as you can as
long as it doesn't slow down your inserts too much and doesn't eat up too
much disk space.

// Hi
//     When you have a table with multiple columns and you want indexes on
// them you can either
// (a) create index table_idx on table using btree ( col1, col2, ..., col7);
//
// or
// (b) create index table_col1_idx  on table using btree ( col1 );
//     create index table_col2_idx  on table using btree ( col2 );
//     .
//     .
//     .
//
// But what is best?
//
//
//

--
Principal Member Technical Staff, beyond.com    The world is watching America,
pub  1024/3CAE01D5 1994/11/03 Dustin Sallings <dustin@spy.net>
|    Key fingerprint =  87 02 57 08 02 D0 DA D6  C8 0F 3E 65 51 98 D8 BE
L______________________________________________ and America is watching TV. __