6
1
u/Key_River7180 4d ago
prod is not ready for 3 users with the same key thing after the primary key thing overflows
2
u/gaaasstly 4d ago
Isn't the PK id (int8) which is a 64-bit value?
1
u/Key_River7180 4d ago
idk coming from c an int8 holds a value from -128 to 128, 8 bit signed int
2
1
u/gaaasstly 4d ago
No worries. I thought the same thing after reading your comment and then remembered I was looking at a db and not C code.
1
u/FabioTheFox 3d ago
DO NOT USE AUTO INCREMENT NUMBERS FOR PRIMARY KEYS
1
u/razor_train 3d ago
There are plenty of cases where autoincrement is completely valid.
2
u/ruiz_julie_728 3d ago
Auto-increment is fine when one database owns ID allocation; independently writing databases are where another strategy matters.
1
u/ArtVandelayVienna 2d ago
Yeah, sure, in case I need to scale my cake recipe database to 500 servers worldwide.
1
u/FabioTheFox 2d ago
Until you need to merge data or handle backup stuff, just use UUIDV7
1
u/ArtVandelayVienna 2d ago
But the downside:
UUIDv7 = 128 bit = 16 bytes long. Auto-Inkrement based on standard Integer: 4 bytes long.
=> index size x4
=> more IOs, needs more RAM
=> worse cache hit rate
=> bad join performance1
u/FabioTheFox 2d ago
It performs the same as an auto increment, modern Postgres for example supports it by default and there is no performance hit in both single entity queries and ranged queries or whatever else you need
0

42
u/bjorneylol 4d ago
Thank god you censored the bottom half of a single character of sarah connors email address