Posted on: 09/01/03 01:22pm
By: rv8
I\'m running the Visitor Status plugin, v1.2. It has proved useful a few times in helping me see exactly what a visitor did that triggered an error.log entry. I also like the historical record of visitors per day, and visitors per month.
But, the gl_visitors table contains every visitor click all the way back to when I installed the plugin. I don\'t need the old data, so I would like to delete a few thousand rows from the table.
I am a mysql newbie, so I am nervous about just jumping in and trying to craft sql statements to delete old data, as there is a very good chance I\'ll screw it up and have to waste a bunch of time figuring out how to restore that table from my backups. So, can anyone provide a hint as to the best (i.e. safe and easy) way to remove data that is more than 60 days old (or older than some specified date if that is easier to code) from the gl_visitors table? I can use mysql directly, or use phpMyAdmin (my preference).
I tried posting this question on the GPlugs forum, but they seem to be having problems today.
Thanks in advance.
Re:Visitor Stats - cleaning out old data?
Posted on: 09/01/03 01:52pm
By: DTrumbower
I don\'t have the table stuctures but this would be a genaral statement.
Delete from tablename
where columndate
Re:Visitor Stats - cleaning out old data?
Posted on: 09/01/03 02:23pm
By: rv8
Thanks DT, that was the hint I needed.
For the record, I used phpMyAdmin to run some SQL statements. First, I removed all the 2002 data with:
DELETE FROM `gl_visitors` WHERE year = \"2002\"
Then I removed each of the early months in 2003 by:
DELETE FROM `gl_visitors` WHERE month = \"January\"
I did a separate delete for each month I didn\'t want. The table is much smaller now, and my site still works OK. An attempt to check the stats times out at the moment, but that has happened in the past once in a while too, so I\'m keeping my fingers crossed that I haven\'t hosed something up.