For the online learning world


Tech Talk – Moodle Messages table clean-up

Moodle recently cleaned-up the database tables for Messaging…

This is one for the techies, and those looking towards the future.

For many years Moodle had two tables for Messages – mdl_message and mdl_message_read.

From Moodle 3.5 these are combined into a single table with a “read” column.

A lot of testing and profiling was required by developers to ensure that the check for unread messages does not unduly burden the server if the message table is large.

There were actually three related Tracker items that went into this seemingly small change:

  • MDL-61254 – Merge messaging database tables
  • MDL-36941 – Create new tables for messaging
  • MDL-61255 – Ad-hoc task to upgrade messages to merged table

Interestingly, these changes make zero difference to users right now.

There is some history behind this though…

…the only reason for the introduction of this 2 table system was that the person who did the GSOC project that created the messaging system thought it was necessary to be able to quickly check for unread messages when in fact an indexed column on a single table does just as well.

If you want  to see how much work went into this change take a look at https://tracker.moodle.org/browse/MDL-36941

The cleaning up of these tables and re-thinking of how they work, will pay dividends in the future with more flexible options.

Stuart Mealor
Latest posts by Stuart Mealor (see all)

Stuart Mealor

Stuart is interested in all things e-learning, with specific interests in Moodle, e-learning strategy, and business development. His experience in education over 30 years, MBA in International Business, and knowledge of e-learning systems implementation, together with graphic design background, give him a unique skill set for e-learning projects.

One thought on “Tech Talk – Moodle Messages table clean-up

  • André Fourier

    Interesting – I always wondered why there were two tables for messages, it made writing SQL queries more awkward than necessary.


Add a reply or comment...