indexes

From: Tom Allison <tom(at)tacocat(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: indexes
Date: 2006-11-24 14:54:27
Message-ID: 456707A3.70806@tacocat.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I notice a lot of places where people use the approach of creating an index and
a unique key like:

CREATE TABLE foo (
idx SERIAL PRIMARY KEY,
name varchar(32) UNIQUE NOT NULL
)

instead of
CREATE TABLE foo (
name varchar(32) PRIMARY KEY
)

If the name is NEVER going to change, is there any advantage to doing this?
If there are many-to-many reference tables (like name-to-friends) is this any
different?

I've seen this a lot, but I've always assumed that with the condition that
'name' would NEVER change, there was no advantage.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Marcus Engene 2006-11-24 15:04:54 Re: IN clause
Previous Message Brandon Aiken 2006-11-24 14:32:31 Re: IN clause