Re: [GENERAL] UUID's as primary keys - Mailing list pgsql-hackers

From Thomas Hallgren
Subject Re: [GENERAL] UUID's as primary keys
Date
Msg-id 44A3DB9C.8040205@tada.se
Whole thread Raw
In response to Re: [GENERAL] UUID's as primary keys  (Greg Stark <gsstark@mit.edu>)
Responses Re: [GENERAL] UUID's as primary keys  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-hackers
Greg Stark wrote:
> Martijn van Oosterhout <kleptog@svana.org> writes:
>
>   
>> To be honest, it seems like a lot of work to save the four bytes of
>> overhead for the varlena structure on disk if you're going to need it
>> in memory anyway. And anything like RAW(16) which people want for
>> UUIDs, if it's going to have a lot of functions associated with it, may
>> as well just be a new type. 
>>     
>
> For large databases storage density leads directly to speed. Saving four bytes
> of overhead on a 16-byte data structure would mean a 20% speed increase. Even
> if that's only helpful on a tenth of the columns you're still talking about a
> 2% speed increase for all queries on the table. A lot of databases use CHAR(1)
> for flags. The overhead is even worse there.
>
>   
I have to concur with this. Assume you use a bytea for a UUID that in 
turn is used as a primary key. The extra overhead will be reflected in 
all indexes, all foreign keys, etc. In a normalized database some tables 
may consist of UUID columns only.

Regards,
Thomas Hallgren



pgsql-hackers by date:

Previous
From: "Rodrigo De Leon"
Date:
Subject: Re: session id and global storage
Next
From: Tom Lane
Date:
Subject: Re: session id and global storage