I have a procedure where customers trigger a calculation that fills a table with calculated data for further use in their session. But, we have to do this every time they login by deleting all their records and then filling the table again by using insert into .. select.
I know it’s better to update rows, but there are way to many things that can change / become obsolete after a while, so we decided to delete and reinsert.
This works fine, but I’m worried about the fact that somewhere in time we will hit the limit of our autogenerated RowId integer.
Is there a nice way to reuse the old RowId’s that have been deleted? Or is there another approach to make sure we never get into trouble?
Thanks for thinking with me!
As others have pointed out, you’re unlikely to run out of ID values any time soon. I’d ask another question though. Do you really need this ID? If the calculations are specific to a user and session then it seems to me that you already have a way to identify rows. Just put the user id and session id in the table, maybe with a date/time column as well if needed and you don’t need an autogenerated ID at all.