MDL-33018 add general index type hints and use PostgreSQL varchar_pattern_ops index type for context.path

This significantly improves performance of accesslib queries,
credit for the discovery of this solution goes to Andrew Masterton from OU.
This commit is contained in:
Petr Skoda
2012-07-06 08:19:39 +02:00
committed by Petr Škoda
parent 2cbdaa77ea
commit bd991d03cf
15 changed files with 191 additions and 23 deletions
+8 -1
View File
@@ -353,7 +353,14 @@ class pgsql_native_moodle_database extends moodle_database {
continue;
}
$columns = explode(',', $matches[4]);
$columns = array_map(array($this, 'trim_quotes'), $columns);
foreach ($columns as $k=>$column) {
$column = trim($column);
if ($pos = strpos($column, ' ')) {
// index type is separated by space
$column = substr($column, 0, $pos);
}
$columns[$k] = $this->trim_quotes($column);
}
$indexes[$row['indexname']] = array('unique'=>!empty($matches[1]),
'columns'=>$columns);
}