aboutsummaryrefslogtreecommitdiffstats
path: root/core/Command
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2021-03-11 16:37:23 +0100
committerRobin Appelman <robin@icewind.nl>2021-10-08 18:38:25 +0200
commitabd6b354acc7e930302ffacb2a7ec92dd88fcad7 (patch)
tree344ecbf230133540e14f9904122cee29cb817985 /core/Command
parent1ea5983568dc99aa80e52f18837629d137b8a03c (diff)
downloadnextcloud-server-abd6b354acc7e930302ffacb2a7ec92dd88fcad7.tar.gz
nextcloud-server-abd6b354acc7e930302ffacb2a7ec92dd88fcad7.zip
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')
-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 c4360157f72..449ee03d325 100644
--- a/core/Command/Db/AddMissingIndices.php
+++ b/core/Command/Db/AddMissingIndices.php
@@ -151,6 +151,13 @@ class AddMissingIndices extends Command {
$updated = true;
$output->writeln('<info>Filecache table updated successfully.</info>');
}
+ if (!$table->hasIndex('fs_storage_path_prefix')) {
+ $output->writeln('<info>Adding additional path index to the filecache table, this can take some time...</info>');
+ $table->addIndex(['storage', 'path'], 'fs_storage_path_prefix', [], ['lengths' => [null, 64]]);
+ $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>');