Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2021-03-11 18:37:23 +0300
committerRobin Appelman <robin@icewind.nl>2021-03-19 20:52:25 +0300
commitb28f0a0e941880ce4c64206b0cd2ba0ca45c9867 (patch)
tree31e9cb1382e50f7de2515a0e16087d53d985cfab /core/Command/Db
parentcdb1d3468bb15517099899ed715e8558666afa1c (diff)
add a prefix index to filecache.path
The reason that `filecache.path` hasn't had an index added is the mysql limitation of ~1kb for indexeded fields, which is to small for the `path`, however mysql supports indexing only the first N bytes of a column instead of the entire column, allowing us to add an index even if the column is to long. Because the index doesn't cover the entire column it can't be used in all situations where a normal index would be used, but it does cover the `path like 'folder/path/%'` queries that are used in various places. Sqlite and Postgresql don't support prefix indexes, but they also don't have the 1kb limit and DBAL handles the differences in index creation. Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'core/Command/Db')
-rw-r--r--core/Command/Db/AddMissingIndices.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/core/Command/Db/AddMissingIndices.php b/core/Command/Db/AddMissingIndices.php
index 1acff55fa40..a4f59184537 100644
--- a/core/Command/Db/AddMissingIndices.php
+++ b/core/Command/Db/AddMissingIndices.php
@@ -144,6 +144,13 @@ class AddMissingIndices extends Command {
$updated = true;
$output->writeln('<info>Filecache table updated successfully.</info>');
}
+ if (!$table->hasIndex('fs_path_prefix')) {
+ $output->writeln('<info>Adding additional path index to the filecache table, this can take some time...</info>');
+ $table->addIndex(['size'], 'fs_path_prefix', [], ["lengths" => [128]]);
+ $this->connection->migrateToSchema($schema->getWrappedSchema());
+ $updated = true;
+ $output->writeln('<info>Filecache table updated successfully.</info>');
+ }
}
$output->writeln('<info>Check indices of the twofactor_providers table.</info>');