This seems to work...
--- prune_reports.rake 2011-09-08 12:42:54.433928840 -0700
+++ prune_reports.rake-new 2011-09-08 12:44:01.928583735 -0700
@@ -52,5 +52,11 @@
puts "Deleting reports before #{cutoff}..."
deleted_count = Report.delete_all(['time < ?', cutoff])
puts "Deleted
Try running optimize on it.
-scott
On Tue, Aug 16, 2011 at 5:53 PM, Sandor W. Sklar wrote:
> Thanks, Scott. After posting this, I did some googling and pretty much
> came up with the same solution. Unfortunately, because we're using ISAM
> tables, the only way I know of to reclaim the space u
Thanks, Scott. After posting this, I did some googling and pretty much came up
with the same solution. Unfortunately, because we're using ISAM tables, the
only way I know of to reclaim the space used by the datafiles is to do a
mysqldump and then restore after clearing out the older reports.
There should probably be a rake task for this (tbh, all that stuff should be
rewritten, loading the whole Rails env to do it is ...ugly), but you can
probably (caveat emptor, I don't know this table very well) do something
like
*delete from resource_statuses where time <= date_sub(now(), interval