Msg#: 4348552 posted 10:35 am on Aug 6, 2011 (gmt 0)
Scenario - a database contains hundreds of thousands of product sale entries and is continually adding more. Each entry has a field with an expiry date. While it's easy to list the product sales that haven't expired yet the old data remains in the database.
Does mysql provide an easy means of removing the data that reaches its expiry date or is doing it manually (or via cron) the only option?
Msg#: 4348552 posted 1:35 pm on Aug 6, 2011 (gmt 0)
Just thinking out loud, I know others have done this as a matter of routine but...
Since the table contains a field with an end date the simplest way with my limited skills would be, while requesting the data via php, to use a WHERE command to return only items with an expiry date that is not older than the current date (oi, timezone nightmare but anyway) and if it IS older DELETE the entry.
Assuming there isn't a mysql command to take care of expired data... would requesting data and deleting data from the same page load cause a noticeable performance hit? (480,000 rows to parse)