composite versus sequence pk

From: "Leszek Kotzian" <l(dot)kotzian(at)fi(dot)com>
To: <sfpug(at)postgresql(dot)org>
Subject: composite versus sequence pk
Date: 2005-03-30 16:42:04
Message-ID: 3D9D8F616F723040908E63DCEC90F378E44FC9@whiteshark.fi.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: sfpug

Hi,

I'd like to present my concern and ask for your advice.

Here is the table:

Create table tTable (

A integer default nextval('"tTable_a_seq"'::text) not null,

B integer not null,

C integer not null,

D integer not null,

E double not null

);

Create sequence tTable_a_seq increment by 1 no maxvalue no minvalue
cache 1;

Initially the PK was created on A column. But really B, C, and D
combined are unique.

Do you know if there will be significant drop in performance on
INSERT/UPDATE operation if I will drop column A and create PK on B, C
and D?

I speculate that because there would be one less column to insert/update
it should not be worse. Not sure though what's the overhead of handling
composite PK on INSERT/UPDATE operation.

Regards

lk

PLEASE READ THIS WARNING: Investment in securities involves the risk of loss. Past performance is no guarantee of future returns. Other methods may produce different results, and the results for different periods may vary depending on market conditions and the composition of the portfolio.

Warning: Do not send time-sensitive, action-oriented messages, such as transaction requests, via e-mail as it is our policy not to accept such items electronically.

All e-mail sent to or from this address will be received or otherwise recorded by the Fisher Investments corporate e-mail system and is subject to archival, monitoring or review by, and/or disclosure to, someone other than the recipient.

Responses

Browse sfpug by date

  From Date Subject
Next Message Josh Berkus 2005-03-30 18:48:09 Re: composite versus sequence pk
Previous Message Josh Berkus 2005-03-29 18:25:36 At OSBC