Re: Surrogate keys (Was: enums) - Mailing list pgsql-hackers

From Rod Taylor
Subject Re: Surrogate keys (Was: enums)
Date
Msg-id 1137252754.7815.90.camel@home
Whole thread Raw
In response to Surrogate keys (Was: enums)  (Leandro Guimarães Faria Corcete DUTRA<leandro@dutra.fastmail.fm>)
Responses Re: Surrogate keys (Was: enums)
List pgsql-hackers
On Fri, 2006-01-13 at 12:42 +0000, Leandro Guimarães Faria Corcete DUTRA
wrote:
> Rod Taylor <pg <at> rbt.ca> writes:
>
> > The basic idea is that most of us break out schemas by creating fake
> > primary keys for the purpose of obtaining performance because using the
> > proper primary key (single or multiple columns) is often very slow.
>
> This is one thing I simply can't understand.
>
> If you still declare the natural key(s) as UNIQUEs, you have just made
> performance worse.  Now there are two keys to be checked on UPDATEs and
> INSERTs, two indexes to be updated, and probably a SEQUENCE too.

Indeed. Using a surrogate key is not free and that is why it would be
something the DBA would specify during table creation.

The main goal would be to give the option of using a surrogate key
without being forced to expose it to the applications using the
database. It is a feature akin to table spaces in that it can help
performance but without the application or standard users knowing why.

--



pgsql-hackers by date:

Previous
From: Lukas Smith
Date:
Subject: Re: Surrogate keys (Was: enums)
Next
From: Lukas Smith
Date:
Subject: Re: Surrogate keys (Was: enums)