| From: | "Roderick A(dot) Anderson" <raanders(at)cyber-office(dot)net> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: question on serial key |
| Date: | 2009-05-22 14:26:35 |
| Message-ID: | 4A16B61B.6090608@cyber-office.net |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Brandon Metcalf wrote:
> g == gryzman(at)gmail(dot)com writes:
>
> g> you should use it, whenever you need db to keep its own key internally.
> g> Advantage of sequence is also the fact, that you can have the sequence
> g> value used on different columns/tables .
>
> g> My rule of thumb is , in that case: as long as it is a short type (not
> g> of toastable, or/and variable length), and as long as it won't change,
> g> and is unique - I can use it. Otherwise, I use sequence to connect
> g> rows internally for database.
> g> First rule, is because of index access, and the way btree works.
> g> Second is, because update of value will update other rows too - and
> g> HOT won't help you here, so that's not efficient. And also, forcing it
> g> to be unique is harder than.
>
> g> Hth.
>
> That does help. So, in my example of a table consisting of rows for
> each periodic table element, the atomic number would suffice as a
> unique key since, well, it's unique and not going to change. Right?
Well you never know. They took planet status away from Pluto. :-)
\\||/
Rod
--
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Sam Mason | 2009-05-22 14:33:34 | Re: question on serial key |
| Previous Message | Grzegorz Jaśkiewicz | 2009-05-22 14:12:12 | Re: question on serial key |