Re:How to Get the Most Out of Postgres Memory Settings
by sgarland on Wednesday June 12, 2024 @11:04AM
(#40658954)
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`.
[ Parent
| on HN ]
Re:How to Get the Most Out of Postgres Memory Settings
by NortySpock on Wednesday June 12, 2024 @01:18PM
(#40660587)
Yeah, 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.