General developer forum

Adding the index to the table longstore_standart_log

Picture of Darko Miletić
Re: Adding the index to the table longstore_standart_log
Core developersParticularly helpful Moodlers

We gotta do what we gotta do sometimes. You can of course add the index but, have in mind that any subsequent upgrade of Moodle given that this is core table might be clashing with your change in case they decide to alter the table structure.

To make sure no problems arise I recommend to:

  1. Always have backup of the database.
  2. Before deploying new version of Moodle undo your custom index or at least test the upgrade on separate instance.

I would also change inner query to look like this:

  SELECT l.userid
    FROM mdl_logstore_standard_log l
    JOIN mdl_user u ON = AND u.deleted = 0 and IN (3,4,5,6,7,8,9,10)
GROUP BY l.userid HAVING MIN(l.ip) <> MAX(l.ip)

That way you guarantee that users actually exist.

Average of ratings: -