Search code examples
mysqldelete-record

Mysql self deleting records


Is there a way to automatically delete old records. Each record has a timestamp. I want the records with a timestamp older than 10minutes ago to be deleted. Is there a way to do this within mysql or i need to set an external program to check the timestamps and decide whether or not it should be deleted?


Solution

  • How about doing that in a trigger? Whenever you change some table's data (insert, update, delete), you'd delete the old data of the table.

    What, no one changes the data of the table?? Then why would you bother deleting old stuff if no one messes around with the data? :)