I have an InnoDB table that may potentially get up to 5 million rows inserted per day. This table is required to have data from the last 12 months, so two or four times a year data older than 12 months is deleted.
Having this in mind, I can say that the table should never have more than 2 billion rows. That is why I set the primary key to be INT.
I knew back then that even when old data is being deleted, the primary key will still grow and grow reaching its limits after 3 or 4 years of data. However, I decided to use INT anyway, as using BIGINT would mean 4 bytes of extra data on each row, which is significant on a table with 2 billion rows (besides, the primary index is used as foreign key in other tables so these other tables would need to be changed to BIGINT too and increase their storage needs also). I also thought (most probably my biggest mistake) I will think of something later.
Well, that time has come, and I am thinking of doing a reordering of the primary key as here:
Reorder / reset auto increment primary key
or here
But this is considered a 'bad practice' (plus it would take forever). The good practice is to change from INT to BIGINT (this would take forever too... but just once).
My question is, if I do this instead of reordering, will the INSERT or UPDATE or SELECT queries take longer as if having INT as primary key?
If it affects queries duration then it is really not an option to me, and the bad practice is the option... unless someone has a better solution?
Thanks!