Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id DA4F8650054 for ; Tue, 12 Aug 2008 10:06:21 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 02574-06 for ; Tue, 12 Aug 2008 10:06:11 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mx00.pub.collaborativefusion.com (mx00.pub.collaborativefusion.com [206.210.89.199]) by postgresql.org (Postfix) with ESMTP id 6F24C64FF86 for ; Tue, 12 Aug 2008 10:06:16 -0300 (ADT) Received: from vanquish.ws.pitbpa0.priv.collaborativefusion.com (vanquish.ws.pitbpa0.priv.collaborativefusion.com [192.168.2.162]) (SSL: TLSv1/SSLv3,256bits,AES256-SHA) by wingspan with esmtp; Tue, 12 Aug 2008 09:06:12 -0400 id 00056413.48A18AC4.00008696 Date: Tue, 12 Aug 2008 09:06:21 -0400 From: Bill Moran To: Gregory Stark Cc: "Mario Weilguni" , valiouk@yahoo.co.uk, "Jay" , pgsql-performance@postgresql.org Subject: Re: Using PK value as a String Message-Id: <20080812090621.1cafbbab.wmoran@collaborativefusion.com> 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> Organization: Collaborative Fusion X-Mailer: Sylpheed 2.5.0 (GTK+ 2.12.11; i386-portbld-freebsd7.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200808/118 X-Sequence-Number: 30999 In response to Gregory Stark : > "Mario Weilguni" 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