I have a table with a timestamp column that records when the record is modified. I would like to on a nightly basis move all records that are older than 6 days. should I use
insert into archive_table select * from regualr_table where datediff( now(), audit_updated_date)>=6; delete from regular_table where datediff( now(), audit_updated_date)>=6;
since there are 1 million rows in regular_table, is there anyway to optimize the query so they run faster? Also will the delete be locking the regular_table? My main concern is the read query to the db won't be slowed down by this archiving process.