Skip site navigation (1) Skip section navigation (2)

Re: UUID column as pimrary key?

From: Scott Ribe <scott_ribe(at)elevated-dev(dot)com>
To: Chris Browne <cbbrowne(at)acm(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: UUID column as pimrary key?
Date: 2011-01-06 17:09:15
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
On Jan 6, 2011, at 9:31 AM, Chris Browne wrote:

> The reasonable choices for a would-be artificial primary key seem to be
> 1 and 3; in a distributed system, I'd expect to prefer 1, as the time +
> host data are likely to eliminate the "oh, it might just randomly match"
> problem.

In some contexts, 1 is considered a security weakness, as it reveals information about which machine generated it and when, which is why most OS-supplied uuid generators now default to 4 (random). This tends to be more of a concern with encryption/security uses, and if it's not a concern for your db[*], then your are correct that 1 is likely the best choice.

[*] After all, in many dbs we log all sorts of explicit where/who/when for auditing purposes. In that case, having ids that provide a clue of where/when most certainly does not add any legitimate security concern.

Scott Ribe
(303) 722-0567 voice

In response to

pgsql-general by date

Next:From: pasman pasmańskiDate: 2011-01-06 18:07:48
Subject: Pl/perl and perl version-tip in doc
Previous:From: Chris BrowneDate: 2011-01-06 16:51:25
Subject: Re: UUID column as pimrary key?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group