UUID as primary key

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a system where it would be very useful for the primary keys for
a few tables to be UUIDs (actually MD5s of files, but UUID seems to be
the best 128-bit type available).  What is the expected performance of
using a UUID as a primary key which will have numerous foreign
references to it, versus using a 64-bit int (32-bit isn't big enough)?

>From the uuid.c in adt, it looks like a UUID is just stored as 8
consecutive bytes, and are compared using memcmp, whereas an int uses
primitive CPU instructions for comparison.  Is that a significant
issue with foreign key performance, or is it mostly just the size that
the key would take in all related tables?

-- 
Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux