April 16th, 2012, 03:25 PM
Unique Identifiers Hell (UIDs)
Some PostgreSQL questions.
I have some questions when designing relational databases regarding unique identifiers. Please see my questions below.
1) What data type should be used as a unique ID for a row? I noticed most sites recommend using an integer with auto increment. This seems rather rubbishy? Should I instead use the 128 bit UID type?
2) If I have lots of tables in a database, all with their own unique ID should I use UID type ? or will this degrade database performance?
3) I want good performance. For exmaple if I build a bid site then each entry needs its own unique ID so is a 128Bit UID with Postgresql ok for this? Or what should I use instead?
Hope Someone Can Help
April 16th, 2012, 04:03 PM
Go for a bigserial (which is PostgreSQL's "version" of auto increment).
Originally Posted by edb500
There is nothing wrong with that.
UUIDs are nice if you need to ensure uniqueness across different systems, but they do have some performance and storage overhead.