I have a database table with this structure, it contains thousands of rows and I query on this table regularly:
| Name | Type | Null | Extra | 
|---|---|---|---|
| main_id (pk) | bigint(20) | No | AUTO_INCREMENT | 
| order_id | bigint(20) | No | |
| order_item_id | bigint(20) | No | |
| order_date | date | No | 
I want to archive rows from this table into another table periodically with PHP, I'll be creating another table with similar structure to this as the archive table.
Am I correct in thinking that the archive table main_id should be created without AUTO_INCREMENT? No rows will be added to this table except when PHP periodically grabs rows from the original table where the date is older than x and inserts them.
For future proofing, if I ever wanted to move the rows in the new archive table back to the original table, will the AUTO_INCREMENT on the original table cause an issue here? e.g. what happens if a main_id (e.g. 420) from the archive table goes in to the original table (where main_id might now be at 2000 for new rows)? will it reset the AUTO_INCREMENT?
