Hi everybody,
I hope I'm in the right forum. I have an idea for another log system and would appreciate your opinion.
We have a need for periodical reports that will give basic statistics for the activities in a course, showing the number of views, updates etc.
As of now, the usual approach is running through mdl_log and selecting all records that match the selected course and time period. Problem is, our site contains over Hundred of courses and thousands of users and the result is a huge amount of data that even after regular backup and cleaning is still very heavy.
One of the ideas is to create a new log table that will contain much less data and will be used for basic information.
Now for some technical stuff...
The table structure is very simple:
id, time, course, module, view_counter, add_counter, edit_counter, delete_counter
The first four values are similar to those in mdl_log and the rest are simple counters.
The idea is that while the usual add_to_log function collects user, time, ip and so on, this table will contain the activities counters for every module.
Another difference is the the time field will not contain the current time but the current month. This way one record will hold information for a single course module for a whole month (or a whole week, depends on the need).
The advantage is a very fast, very target specific statistical tool that will show the different activities in one or several courses over a period of time, pointing out the less used instances and so on.
However, there are some serious disadvantages.
- The developer will need to go through all the places in the modules that call to add_to_log and add near it a call to the new log [for example: log_action(courseid, moduletype, actiontype)]
- While add_to_log just add a new record, here there is a need to look for a record by specific time, course and module values in order to update it. On one hand, this table will be relatively small to work with, but on the other hand it will be called constantly from every page. And this is the major problem here.
I looked for similar issues and didn't find anything close enough so I don't know if a similar idea has been discussed here before. If so, I'll be happy if someone will direct me there.