5 ms·
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
by snarfy 9y ago
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.
- lmm 9y agoThat'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.
- WorldMaker 9y agoIf 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.