We have been asked to keep logs enabled and never to delete any entries for at least the duration of an academic year. However, after about 6 months some of our modules which either have large enrolments or are heavily used take up to 3 minutes to load and in some cases if many users jump on the same module at the same time, it has reached up to 15 minutes.
I have noticed there is a SELECT query against the mdl_logstore_standard_log table every time a module is viewed. This query seems to delay the loading of the module and seems it is just getting worse because our log is now about 18 Gb in size plus indexes. I've also noticed that in some cases when visiting a particular module that the index key 'mdl_logstanlog_useconconr_ix is used with a 'range' scan which seems to be faster. However, upon entering another module, although the underlying SQL query is much the same the other key 'mdl_logsstanlog_couanotim_ix is used with a 'ref' type scan and that is usually when the slowness occurs.
I realise I am most likely unable to determine which one of the keys is used in a query and we are not in a position to attempt to optimise the table since it will grow the InnoDB data file significantly and we don't have the benefit of space. I've already cleared out over 30 days worth of entries now and it seems to have made a difference. However, we've been instructed now to delete any more as it affects the various reports and analytics so we know the problem is just going to get worse.
Is there anyone who can help give guidance on how to run large log tables in Moodle that grow indefinately? Is it worth looking at memcache, adding more memory to MySQL and the innodb buffer, database partitioning, changing to Postgres or is it better to offload the data and externalise the analytics with a 3rd party tool like Qlikview?
Thanks,
Richard