Re: indexes and keys

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Perrin - Demography <aperrin(at)demog(dot)berkeley(dot)edu>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: indexes and keys
Date: 2000-04-17 06:03:44
Message-ID: 6500.955951424@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Andrew Perrin - Demography <aperrin(at)demog(dot)berkeley(dot)edu> writes:
> Is there any reason to create an index on a column that already has one
> created as part of a SERIAL datatype? That is, I used:
> CREATE TABLE personal_data (id serial ...);
> is there any reason to create another index on id:
> CREATE INDEX pd_id_idx on personal_data;
> or will the automatically created one be sufficient?

Waste of space and cycles ... it should work, as far as I know,
but there's no possible value in it.

Offhand, the only reason I can see for having multiple indexes
on a column is if some are functional indexes. For example,
given the right query mix it could make sense to have both a
plain index on a text column t1, and an index on lower(t1).
But each index costs you space and update time, so you want to
be pretty sure that all of them are earning their keep.

regards, tom lane

In response to

Responses

  • Outer joins at 2000-04-18 17:15:52 from Michael S. Kelly

Browse pgsql-sql by date

  From Date Subject
Next Message Ryan Bradetich 2000-04-17 06:09:18 Re: indexes and keys
Previous Message Andrew Perrin - Demography 2000-04-17 05:01:17 indexes and keys