Revive / OpenX: Deleting old Statistic data

I’m not a big fan of out-dated and huge data collections. Unfortunately, old statistic data can not be deleted using the admin control panel of OpenX / Revive adserver. You have to do it with MySQL.

Please note, that I have installed the plugin openXDeliveryLogCountry. This is why I have the additional table phpads_stats_country listed below.

I want to keep 3 years of statistic data. So, I’m deleting with an interval of 3 years:

 

DELETE FROM `phpads_data_intermediate_ad` 
WHERE interval_end < DATE_SUB(CURDATE(), INTERVAL 3 YEAR);

DELETE FROM `phpads_data_summary_ad_hourly` 
WHERE date_time < DATE_SUB(CURDATE(), INTERVAL 3 YEAR);

DELETE FROM `phpads_data_summary_ad_zone_assoc`
WHERE interval_end < DATE_SUB(CURDATE(), INTERVAL 3 YEAR);

DELETE FROM `phpads_data_summary_zone_impression_history` 
WHERE interval_end < DATE_SUB(CURDATE(), INTERVAL 3 YEAR);

DELETE FROM `phpads_stats_country`
WHERE date_time < DATE_SUB(CURDATE(), INTERVAL 3 YEAR);

 

Flattr this!

  • *

    You may use these HTML tags: <a> <abbr> <acronym> <b> <blockquote> <cite> <code> <del> <em> <i> <q> <s> <strike> <strong>

  • Comment Feed for this Post
Go to Top