I'd like to have a single reservoir of RECIDs to apply across multiple tables.

Obviously I can do that by creating a table with a single auto-increment field and inserting every time I need a new RECID.

But that produces a lot of 8-byte+ records that have no real purpose.

A little resident function to delete each record when produced would keep the table pruned back, but I'm wondering whether there's a cleaner way to get to the same goal.


You don't need a "reservoir", rather a way to generate a unique number.

Usually it is sufficient to give that task to one table you already have, and use AUTO_INCREMENT there, plus LAST_INSERT_ID().

But it you really need a sequence generator:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.