pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bill Moran <wmoran@collaborativefusion.com>
To: Gregory Stark <stark@enterprisedb.com>
Cc: Mario Weilguni <mweilguni@sime.com>
Cc: valiouk@yahoo.co.uk, "Jay" <arrival123@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Using PK value as a String
Date: Tue, 12 Aug 2008 09:06:21 -0400
Message-ID: <20080812090621.1cafbbab.wmoran@collaborativefusion.com> (raw)
In-Reply-To: <87od3ywg4n.fsf@oxford.xeocode.com>
References: <18986.60888.qm@web25807.mail.ukl.yahoo.com>
	<48A15ECF.5030203@sime.com>
	<87od3ywg4n.fsf@oxford.xeocode.com>

In response to Gregory Stark <stark@enterprisedb.com>:

> "Mario Weilguni" <mweilguni@sime.com> writes:
> 
> > UUID is already a surrogate key not a natural key, in no aspect better than a
> > numeric key, just taking a lot more space.
> >
> > So why not use int4/int8?
> 
> The main reason to use UUID instead of sequences is if you want to be able to
> generate unique values across multiple systems. So, for example, if you want
> to be able to send these userids to another system which is taking
> registrations from lots of places. Of course that only works if that other
> system is already using UUIDs and you're all using good generators.

Note that in many circumstances, there are other options than UUIDs.  If
you have control over all the systems generating values, you can prefix
each generated value with a system ID (i.e. make the high 8 bits the
system ID and the remaining bits come from a sequence)  This allows
you to still use int4 or int8.

UUID is designed to be a universal solution.  But universal solutions
are frequently less efficient than custom-tailored solutions.

-- 
Bill Moran
Collaborative Fusion Inc.
http://people.collaborativefusion.com/~wmoran/

wmoran@collaborativefusion.com
Phone: 412-422-3463x4023



view thread (23+ messages)  latest in thread

Message-ID: <20080812090621.1cafbbab.wmoran@collaborativefusion.com>
Permalink:  ../20080812090621.1cafbbab.wmoran@collaborativefusion.com/
Also on:    postgresql.org/message-id/20080812090621.1cafbbab.wmoran@collaborativefusion.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: wmoran@collaborativefusion.com, stark@enterprisedb.com, mweilguni@sime.com, arrival123@gmail.com
  Subject: Re: Using PK value as a String
  In-Reply-To: <20080812090621.1cafbbab.wmoran@collaborativefusion.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox