Re:Auto increment is a terrible idea
by pmontra on Thursday November 30, 2017 @10:36AM
(#15816504)
I'm using PostgreSQL's UUIDs as primary keys (and foreign keys) in a Phoenix application (a JSON backend to a React frontend). The only painful moments are:
* Typing SQL queries in the development database.
* Trying to remember which record is which by looking at the UUIDs. Often the first two characters are enough but it's a lot of random noise.
Inside the program it's all the same. No apparent performance penalties so far, but we don't have much data.
I used slugs in Rails apps not to disclose numerical ids from public URLs and data. There is no need to do that with UUIDs. However, if this were a server rendered web app I'll probably still generate slugs and use them in the URLs. UUIDs in permalinks are just too weird to look at.
* Typing SQL queries in the development database.
* Trying to remember which record is which by looking at the UUIDs. Often the first two characters are enough but it's a lot of random noise.
Inside the program it's all the same. No apparent performance penalties so far, but we don't have much data.
I used slugs in Rails apps not to disclose numerical ids from public URLs and data. There is no need to do that with UUIDs. However, if this were a server rendered web app I'll probably still generate slugs and use them in the URLs. UUIDs in permalinks are just too weird to look at.