Can I/How do I run a MYSQL delete once per day?
Posted on 2010-09-16
I have a table that keeps track of which pages on my site are visited by a single ip address. I only care about data for the last 24 hours, I don't want this table to get too big, and I don't want to have to manually delete rows. I suppose that whereever I have code that adds to this table I could have code that deletes any row with a date that is more than 24 hours ago, but I assume that is more wasteful than necessary. Is there any way that I can write code that will only execute once per day and will delete rows in a table that are more than 24 hours old?