Skip to content

Commit

Permalink
MDL-50805 Messages: Add index to message_read to speed up message crons
Browse files Browse the repository at this point in the history
  • Loading branch information
crazyserver committed Oct 1, 2015
1 parent ee64a43 commit 00a5145
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/db/install.xml
Expand Up @@ -565,6 +565,7 @@
<INDEXES>
<INDEX NAME="useridto" UNIQUE="false" FIELDS="useridto"/>
<INDEX NAME="useridfromto" UNIQUE="false" FIELDS="useridfrom, useridto"/>
<INDEX NAME="notificationtimeread" UNIQUE="false" FIELDS="notification, timeread"/>
</INDEXES>
</TABLE>
<TABLE NAME="message_contacts" COMMENT="Maintains lists of relationships between users">
Expand Down
15 changes: 15 additions & 0 deletions lib/db/upgrade.php
Expand Up @@ -4455,5 +4455,20 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2015051101.07);
}

if ($oldversion < 2015051102.03) {

// Define index notification (not unique) to be added to message_read.
$table = new xmldb_table('message_read');
$index = new xmldb_index('notificationtimeread', XMLDB_INDEX_NOTUNIQUE, array('notification', 'timeread'));

// Conditionally launch add index notification.
if (!$dbman->index_exists($table, $index)) {
$dbman->add_index($table, $index);
}

// Main savepoint reached.
upgrade_main_savepoint(true, 2015051102.03);
}

return true;
}
2 changes: 1 addition & 1 deletion version.php
Expand Up @@ -29,7 +29,7 @@

defined('MOODLE_INTERNAL') || die();

$version = 2015051102.02; // 20150511 = branching date YYYYMMDD - do not modify!
$version = 2015051102.03; // 20150511 = branching date YYYYMMDD - do not modify!
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.

Expand Down

0 comments on commit 00a5145

Please sign in to comment.