Re: UUID - Data type inefficient - Mailing list pgsql-hackers

From Mark Mielke
Subject Re: UUID - Data type inefficient
Date
Msg-id 4876323F.4070705@mark.mielke.cc
Whole thread Raw
In response to Re: UUID - Data type inefficient  (Mark Mielke <mark@mark.mielke.cc>)
Responses Re: UUID - Data type inefficient  (Mark Mielke <mark@mark.mielke.cc>)
List pgsql-hackers
Mark Mielke wrote:
> Kless wrote:
>> The new data type, UUID, is stored as a string -char(16)-:
>> struct pg_uuid_t
>> {
>>         unsigned char data[UUID_LEN];
>> };
>> #define UUID_LEN 16
>>
>
> What is the complaint? Do you have evidence that it would be 
> noticeably faster as two 64-bits? Note that a UUID is broken into 
> several non-64 bit elements, and managing it as bytes or 64-bit 
> integers, or as a union with the bit-lengths specified, are probably 
> all efficient or inefficient depending on the operation being 
> performed. The hope should be that the optimizer will generate similar 
> best code for each.

I didn't notice that he put 16. Now I'm looking at uuid.c in PostgreSQL 
8.3.3 and I see that it does use 16, and the struct pg_uuid_t is length 
16. I find myself confused now - why does PostgreSQL define UUID_LEN as 16?

I will investigate if I have time tonight. There MUST be some mistake or 
misunderstanding. 128-bit numbers should be stored as 8 bytes, not 16.

Cheers,
mark

-- 
Mark Mielke <mark@mielke.cc>



pgsql-hackers by date:

Previous
From: Mark Mielke
Date:
Subject: Re: UUID - Data type inefficient
Next
From: Tom Lane
Date:
Subject: Re: UUID - Data type inefficient