For example. Today, I checked one of my moodle servers and noticed the DB size has approached 300 MB.
I opened MySQL Workbench, connected to the server, selected the DB and executed this statement
SELECT table_name , table_rows, data_length,This is the result - notice the ORDER BY clause above.
ROUND(((data_length+index_length)/1024/1024),2) AS "Size in MB"
FROM information_schema.tables
WHERE table_schema = "batavia"
ORDER BY data_length desc
200 of the 300 MB of data is in the mdl_log table. 66 % of the total DB size consisted of the mdl_log table.
So - I trimmed that table using this SQL - only keeping 365 days. (2014 - 02 - 08)
DELETE FROM mdl_log
WHERE time < unix_timestamp(20140208) #where converted time is less than the time specified
I doubled checked the setting on the moodle server, just to see what that was set at.
Notice the Log file setting, which explains why the were not removed.
No comments:
Post a Comment