3 ms·
If you're not working at scale, IMO this is also not a difficult problem to overcome with integer IDs. Dump the DB into a CSV and increment the ID column by N,
by sgarland 2y ago
If you're not working at scale, IMO this is also not a difficult problem to overcome with integer IDs. Dump the DB into a CSV and increment the ID column by N, then reload. Or copy the table to a new table, add a trigger to copy from the original to the new with an ID increment, then do `UPDATE <temp_table> SET id = id + N WHERE id <= $MAX_ID_ORIGINALLY_SEEN`.
- NortySpock 2y agoYeah, but that requires basically a special favor from the DBA to create the trigger for what feels like a basic, common-enough data-load task... What I normally see though is that the auto-incrementing sequence (at least in MS SQL Server or Oracle) isn't clever enough to say "wow, that id already exists on your table somehow? Here let me bump the sequence again and you try again with a higher ID..." Instead you get a 2am alarm because the generated sequence somehow ran into the block of IDs that you inserted into the table and crashed with a PK unique constraint violation. Hence UUIDv7 or ULIDs being easy to insert from the temp table into the main table.
- hot_gril 2y agoIt's easier if you have a non-PK UUID column you can use as a crutch.