Permalink
Browse files

MDL-22179 backup - speed up decoder access by adding new index

  • Loading branch information...
stronk7 committed Jul 27, 2010
1 parent 5b457d2 commit 6c4a3a8c1e1044e4f59e1084cc9843971da3e4a6
Showing with 19 additions and 3 deletions.
  1. +3 −2 lib/db/install.xml
  2. +15 −0 lib/db/upgrade.php
  3. +1 −1 version.php
View
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="lib/db" VERSION="20100721" COMMENT="XMLDB file for core Moodle tables"
+<XMLDB PATH="lib/db" VERSION="20100727" COMMENT="XMLDB file for core Moodle tables"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
>
@@ -2655,7 +2655,8 @@
<KEY NAME="backupid_itemname_itemid_uk" TYPE="unique" FIELDS="backupid, itemname, itemid" PREVIOUS="primary"/>
</KEYS>
<INDEXES>
- <INDEX NAME="backupid_parentitemid_ix" UNIQUE="false" FIELDS="backupid, itemname, parentitemid"/>
+ <INDEX NAME="backupid_parentitemid_ix" UNIQUE="false" FIELDS="backupid, itemname, parentitemid" NEXT="backupid_itemname_newitemid_ix"/>
+ <INDEX NAME="backupid_itemname_newitemid_ix" UNIQUE="false" FIELDS="backupid, itemname, newitemid" PREVIOUS="backupid_parentitemid_ix"/>
</INDEXES>
</TABLE>
<TABLE NAME="backup_files_template" COMMENT="To store files along the backup process. Note this table isn't really used but its temporary counterpart." PREVIOUS="backup_ids_template" NEXT="backup_logs">
View
@@ -4878,6 +4878,21 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2010072300);
}
+ if ($oldversion < 2010072700) {
+
+ // Define index backupid_itemname_newitemid_ix (not unique) to be added to backup_ids_template
+ $table = new xmldb_table('backup_ids_template');
+ $index = new xmldb_index('backupid_itemname_newitemid_ix', XMLDB_INDEX_NOTUNIQUE, array('backupid', 'itemname', 'newitemid'));
+
+ // Conditionally launch add index backupid_itemname_newitemid_ix
+ if (!$dbman->index_exists($table, $index)) {
+ $dbman->add_index($table, $index);
+ }
+
+ // Main savepoint reached
+ upgrade_main_savepoint(true, 2010072700);
+ }
+
return true;
}
View
@@ -6,7 +6,7 @@
// This is compared against the values stored in the database to determine
// whether upgrades should be performed (see lib/db/*.php)
- $version = 2010072300; // YYYYMMDD = date of the last version bump
+ $version = 2010072700; // YYYYMMDD = date of the last version bump
// XX = daily increments
$release = '2.0 Preview 4+ (Build: 20100727)'; // Human-friendly version name

0 comments on commit 6c4a3a8

Please sign in to comment.