Added lower indexes for postgresql to tags.tag and users.name to speed up queries for them using lower()

This commit is contained in:
Matthew Barbour 2019-06-20 10:05:53 -05:00 committed by matthew
parent a834d1f814
commit d128dfa78e

View file

@ -129,6 +129,20 @@ class Upgrade extends Extension
log_info("upgrade", "Database at version 14");
$config->set_bool("in_upgrade", false);
}
if ($config->get_int("db_version") < 15) {
$config->set_bool("in_upgrade", true);
$config->set_int("db_version", 15);
log_info("upgrade", "Adding lower indexes for postgresql use");
if ($database->get_driver_name() == Database::PGSQL_DRIVER) {
$database->execute('CREATE INDEX tags_lower_tag_idx ON tags ((lower(tag)))');
$database->execute('CREATE INDEX users_lower_name_idx ON users ((lower(name)))');
}
log_info("upgrade", "Database at version 15");
$config->set_bool("in_upgrade", false);
}
}
public function get_priority(): int