Created
November 13, 2013 10:51
-
-
Save Ulv/7447109 to your computer and use it in GitHub Desktop.
masterovoy clear db queries & recalculate stats
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$queries = array( | |
'delete from `s_robots_log` where YEAR(dtlabel) <> YEAR(CURDATE())', | |
'delete from `s_visits_log` where YEAR(dtlabel) <> YEAR(CURDATE())', | |
'truncate table `s_robots_stat`', | |
// 'truncate table `s_visits_stat`', | |
'truncate table a_ua_ranges', | |
'truncate table a_log', | |
'truncate table a_http_error', | |
// restore stats | |
'insert into s_robots_stat (statdate, dtmonth, dtday, hosts, hits) select date(dtlabel),dtmonth, '. | |
'dtday,count(logid), count(distinct ip) from s_robots_log group by dtmonth,dtday', | |
'insert into s_visits_stat (statdate, dtmonth, dtday, hosts, hits) '. | |
'select date(dtlabel),dtmonth,dtday,count(logid) as hits, count(distinct ip) as '. | |
'hosts from s_visits_log group by dtmonth,dtday' | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment