PostgreSQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesPostgreSQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 16th, 2012, 02:25 PM
edb500 edb500 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2012
Posts: 1 edb500 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 m 10 sec
Reputation Power: 0
Unique Identifiers Hell (UIDs)

Hi guys,

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?

Thanks

Hope Someone Can Help

Reply With Quote
  #2  
Old April 16th, 2012, 03:03 PM
shammat shammat is offline
Contributing User
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Oct 2003
Location: Germany
Posts: 2,701 shammat User rank is Captain (20000 - 30000 Reputation Level)shammat User rank is Captain (20000 - 30000 Reputation Level)shammat User rank is Captain (20000 - 30000 Reputation Level)shammat User rank is Captain (20000 - 30000 Reputation Level)shammat User rank is Captain (20000 - 30000 Reputation Level)shammat User rank is Captain (20000 - 30000 Reputation Level)shammat User rank is Captain (20000 - 30000 Reputation Level)shammat User rank is Captain (20000 - 30000 Reputation Level)shammat User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 1 Month 3 Weeks 4 Days 2 h 27 m 48 sec
Reputation Power: 284
Quote:
Originally Posted by edb500
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?
Go for a bigserial (which is PostgreSQL's "version" of auto increment).
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesPostgreSQL Help > Unique Identifiers Hell (UIDs)

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap