From: Josh Berkus <josh@agliodbs.com>
To: Palle Girgensohn <girgen@pingpong.net>
To: pgsql-performance@postgresql.org
Subject: Re: single index on more than two coulumns a bad thing?
Date: Thu, 1 Apr 2004 16:35:45 -0800
Message-ID: <200404011635.45440.josh@agliodbs.com> (raw)
In-Reply-To: <24070000.1080860445@palle.girgensohn.se>
References: <24070000.1080860445@palle.girgensohn.se>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: josh@agliodbs.com, girgen@pingpong.net
Subject: Re: single index on more than two coulumns a bad thing?
In-Reply-To: <200404011635.45440.josh@agliodbs.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox