Re: question on serial key

From: Grzegorz Jaśkiewicz <gryzman(at)gmail(dot)com>
To: Brandon Metcalf <brandon(at)geronimoalloys(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: question on serial key
Date: 2009-05-22 13:56:08
Message-ID: 2f4958ff0905220656x73e83320kde8a97af9f40e00b@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

you should use it, whenever you need db to keep its own key internally.
Advantage of sequence is also the fact, that you can have the sequence
value used on different columns/tables .

My rule of thumb is , in that case: as long as it is a short type (not
of toastable, or/and variable length), and as long as it won't change,
and is unique - I can use it. Otherwise, I use sequence to connect
rows internally for database.
First rule, is because of index access, and the way btree works.
Second is, because update of value will update other rows too - and
HOT won't help you here, so that's not efficient. And also, forcing it
to be unique is harder than.

Hth.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Brandon Metcalf 2009-05-22 14:05:25 Re: question on serial key
Previous Message Brandon Metcalf 2009-05-22 13:41:46 question on serial key