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

Re: UUID's as primary keys

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Thomas Hallgren <thomas(at)tada(dot)se>
Cc: Psql_General <pgsql-general(at)postgresql(dot)org>
Subject: Re: UUID's as primary keys
Date: 2006-06-28 07:13:06
Message-ID: 20060628071306.GA29253@svana.org (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-hackers
On Wed, Jun 28, 2006 at 09:01:49AM +0200, Thomas Hallgren wrote:
> I'm building an app where I have several entities that are identified 
> using a UUID (i.e. a 128 bit quantity). My current implementation uses a 
> composite primary key consisting of two int8 values. It's a bit 
> cumbersome and I would much rather have a distinct type. An earlier 
> implementation using Oracle mapped the UUID to a RAW(16) but PostgreSQL 
> doesn't have that and the BYTEA adds extra overhead.
> 
> What would be the best (as in most efficient) mapping for a 128 bit 
> primary key?

Sounds like something for a custom type. There's one here[1] though I
have no idea how good it is.

[1] http://gborg.postgresql.org/project/pguuid/projdisplay.php

Have a nice day,
-- 
Martijn van Oosterhout   <kleptog(at)svana(dot)org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Responses

pgsql-hackers by date

Next:From: ITAGAKI TakahiroDate: 2006-06-28 07:22:31
Subject: pgstattuple extension for indexes
Previous:From: Thomas HallgrenDate: 2006-06-28 07:01:49
Subject: UUID's as primary keys

pgsql-general by date

Next:From: Pat MaddoxDate: 2006-06-28 07:52:10
Subject: How can I speed up this query?
Previous:From: Thomas HallgrenDate: 2006-06-28 07:01:49
Subject: UUID's as primary keys

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