#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2012
    Posts
    1
    Rep 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
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Oct 2003
    Location
    Germany
    Posts
    2,788
    Rep Power
    349
    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.

IMN logo majestic logo threadwatch logo seochat tools logo