MDL-50805 Messages: Add index to message_read to speed up message crons

This commit is contained in:
Pau Ferrer Ocaña
2015-10-01 10:34:30 +02:00
parent fd57d685c7
commit 60b69e4d2f
3 changed files with 17 additions and 1 deletions
+1
View File
@@ -569,6 +569,7 @@
<INDEXES>
<INDEX NAME="useridto" UNIQUE="false" FIELDS="useridto"/>
<INDEX NAME="useridfromtodeleted" UNIQUE="false" FIELDS="useridfrom, useridto, timeuserfromdeleted, timeusertodeleted"/>
<INDEX NAME="notificationtimeread" UNIQUE="false" FIELDS="notification, timeread"/>
</INDEXES>
</TABLE>
<TABLE NAME="message_contacts" COMMENT="Maintains lists of relationships between users">
+15
View File
@@ -4572,5 +4572,20 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2015092200.00);
}
if ($oldversion < 2015100100.00) {
// 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, 2015100100.00);
}
return true;
}
+1 -1
View File
@@ -29,7 +29,7 @@
defined('MOODLE_INTERNAL') || die();
$version = 2015092400.00; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2015100100.00; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.