Future proof Primary Key design in postgresql

Posted by John P on Stack Overflow See other posts from Stack Overflow or by John P
Published on 2010-05-11T05:26:07Z Indexed on 2010/05/11 6:24 UTC
Read the original article Hit count: 304

I've always used either auto_generated or Sequences in the past for my primary keys. With the current system I'm working on there is the possibility of having to eventually partition the data which has never been a requirement in the past. Knowing that I may need to partition the data in the future, is there any advantage of using UUIDs for PKs instead of the database's built-in sequences? If so, is there a design pattern that can safely generate relatively short keys (say 6 characters instead of the usual long one e6709870-5cbc-11df-a08a-0800200c9a66)? 36^6 keys per-table is more than sufficient for any table I could imagine.

I will be using the keys in URLs so conciseness is important.

© Stack Overflow or respective owner

Related posts about primary-key

Related posts about postgresql