Adding one new index to cache_text table. User to make cron deletion

of expired records faster. MDL-11605
This commit is contained in:
stronk7 2007-10-08 16:33:29 +00:00
parent c8149f0f4f
commit cef1ea8e8e
2 changed files with 17 additions and 1 deletions

View File

@ -264,7 +264,8 @@
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="md5key" UNIQUE="false" FIELDS="md5key"/>
<INDEX NAME="md5key" UNIQUE="false" FIELDS="md5key" NEXT="timemodified"/>
<INDEX NAME="timemodified" UNIQUE="false" FIELDS="timemodified" COMMENT="Mainly to help deletion of expired records from cron" PREVIOUS="md5key"/>
</INDEXES>
</TABLE>
<TABLE NAME="grade_category" COMMENT="to define categories to group activity grades" PREVIOUS="cache_text" NEXT="grade_exceptions">

View File

@ -2400,6 +2400,21 @@ function xmldb_main_upgrade($oldversion=0) {
$result = $result && drop_table($table);
}
/// Truncate the text_cahe table and add new index
if ($result && $oldversion < 2007100802) {
/// Truncate the cache_text table
execute_sql("TRUNCATE TABLE {$CFG->prefix}cache_text", true);
/// Define index timemodified (not unique) to be added to cache_text
$table = new XMLDBTable('cache_text');
$index = new XMLDBIndex('timemodified');
$index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('timemodified'));
/// Launch add index timemodified
$result = $result && add_index($table, $index);
}
return $result;
}