Re: [GENERAL] question on serial key

2009-05-26 Thread Jasen Betts
On 2009-05-22, Brandon Metcalf wrote: > g == gryz...@gmail.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 thum

Re: [GENERAL] question on serial key

2009-05-22 Thread Scott Marlowe
On Fri, May 22, 2009 at 9:04 AM, Brandon Metcalf wrote: > s == s...@samason.me.uk writes: > >  s> On Fri, May 22, 2009 at 08:41:46AM -0500, Brandon Metcalf wrote: >  s> > I am looking for criteria on deciding whether or not to use a serial >  s> > (auto-incrementing) key for rows in a table. > >  

Re: [GENERAL] question on serial key

2009-05-22 Thread Grzegorz Jaśkiewicz
On Fri, May 22, 2009 at 3:33 PM, Sam Mason wrote: > Not that I'm aware of; it's a fuzzy design choice with benefits and > costs for either option.  There are lots of people who arbitrarily > pick one side which tends to make things worse, using one or the other > *exclusively* will add complicatio

Re: [GENERAL] question on serial key

2009-05-22 Thread Brandon Metcalf
s == s...@samason.me.uk writes: s> On Fri, May 22, 2009 at 08:41:46AM -0500, Brandon Metcalf wrote: s> > I am looking for criteria on deciding whether or not to use a serial s> > (auto-incrementing) key for rows in a table. s> Wow, that's the second time today someone asked that! s> > Intui

Re: [GENERAL] question on serial key

2009-05-22 Thread Grzegorz Jaśkiewicz
On Fri, May 22, 2009 at 3:26 PM, Roderick A. Anderson wrote: > Brandon Metcalf wrote: >> 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?

Re: [GENERAL] question on serial key

2009-05-22 Thread Roderick A. Anderson
Brandon Metcalf wrote: g == gryz...@gmail.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 lo

Re: [GENERAL] question on serial key

2009-05-22 Thread Sam Mason
On Fri, May 22, 2009 at 08:41:46AM -0500, Brandon Metcalf wrote: > I am looking for criteria on deciding whether or not to use a serial > (auto-incrementing) key for rows in a table. Wow, that's the second time today someone asked that! > Intuitively, it's pretty clear to me when a serial index i

Re: [GENERAL] question on serial key

2009-05-22 Thread Grzegorz Jaśkiewicz
2009/5/22 Brandon Metcalf : > 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, yes :) At least that's my opinion and experience. No

Re: [GENERAL] question on serial key

2009-05-22 Thread Brandon Metcalf
g == gryz...@gmail.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

Re: [GENERAL] question on serial key

2009-05-22 Thread Grzegorz Jaśkiewicz
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