News for hackers. Stuff that matters.
Re:Auto increment is a terrible idea by snarfy on Thursday November 30, 2017 @09:23AM (#15815863)
Use both. PK = int, APIID = UUID

Using integers, auto incrementing or not, reduces the resource pressure on indexing when doing complex joins.

When you need to expose a key, expose the APIID.

Re:Auto increment is a terrible idea by lmm on Thursday November 30, 2017 @09:28AM (#15815894)
That's the worst of both worlds. Writes are slower than ever since you have to update both indices on every insert. If you normalize your database you have to do a bunch of extra joins for every API response. If you denormalize it you have twice as many columns and either complex foreign key constraints (slowing down writes even further) or the possibility of getting your data into an inconsistent state.
Re:Auto increment is a terrible idea by WorldMaker on Thursday November 30, 2017 @12:43PM (#15817691)
If your relational database is experiencing on 64-bit hardware a lot more pressure indexing 128-bit columns than 32-bit columns, it may be time to consider looking for a better database.