Re: UUID's as primary keys

From: Thomas Hallgren <thomas(at)tada(dot)se>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>, Psql_General <pgsql-general(at)postgresql(dot)org>
Subject: Re: UUID's as primary keys
Date: 2006-06-28 08:22:45
Message-ID: 44A23C55.3050201@tada.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Martijn van Oosterhout wrote:
> 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,
>
Thanks. That would of course work but at the same time it increases the
complexity of my app. Yet another component to install and keep track
of. It's also a bit of an overkill since the only thing I need is an
opaque bit storage. Why is it that PostgreSQL lack a fixed length binary
type similar to the RAW type in Oracle? ISTM that could be very useful
and not very hard to implement.

Regards,
Thomas Hallgren

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2006-06-28 08:39:51 Re: UUID's as primary keys
Previous Message Martijn van Oosterhout 2006-06-28 08:05:11 Re: How can I speed up this query?

Browse pgsql-hackers by date

  From Date Subject
Next Message Martijn van Oosterhout 2006-06-28 08:39:51 Re: UUID's as primary keys
Previous Message ITAGAKI Takahiro 2006-06-28 07:22:31 pgstattuple extension for indexes