开发者

How to automatically delete old records from a database table?

开发者 https://www.devze.com 2023-01-21 08:42 出处:网络
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 cr

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

0

精彩评论

暂无评论...
验证码 换一张
取 消