Re: single index on more than two coulumns a bad thing?

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Palle Girgensohn <girgen(at)pingpong(dot)net>, pgsql-performance(at)postgresql(dot)org
Subject: Re: single index on more than two coulumns a bad thing?
Date: 2004-04-02 00:35:45
Message-ID: 200404011635.45440.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Palle,

> Is it always bad to create index xx on yy (field1, field2, field3);

No, it seldom bad, in fact. I have some indexes that run up to seven
columns, becuase they are required for unique keys.

Indexes of 3-4 columns are often *required* for many-to-many join tables.

I'm afraid that you've been given some misleading advice.

> I guess the problem is that the index might often grow bigger than the
> table, or at least big enough not to speed up the queries?

Well, yes ... a 4-column index on a 5-column table could be bigger than the
table if allowed to bloat and not re-indexed. But that's just a reason for
better maintainence.

--
-Josh Berkus
Aglio Database Solutions
San Francisco

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2004-04-02 04:36:38 Re: single index on more than two coulumns a bad thing?
Previous Message Palle Girgensohn 2004-04-01 23:00:45 single index on more than two coulumns a bad thing?