How to automatically delete old records from a database table?
There is a database table for logging purpose only so old records are useless. Is there an easy way to automatically delete old records and keep most recent rec开发者_如何学Cords only (say, records created in last 7 days, or, the latest 1 million records). The table uses MyISAM engine and have a timestamp column but do not have primary key (for fast insertion).
Set up a cron job to run a query to do so.
U can put your Logic in Insert Trigger to delete your old records
精彩评论