]> source.dussan.org Git - nextcloud-server.git/commitdiff
add size index for filecache 23005/head
authorRobin Appelman <robin@icewind.nl>
Tue, 22 Sep 2020 13:15:34 +0000 (15:15 +0200)
committerRobin Appelman <robin@icewind.nl>
Tue, 22 Sep 2020 13:15:34 +0000 (15:15 +0200)
improves performance of #23004

Signed-off-by: Robin Appelman <robin@icewind.nl>
core/Application.php
core/Command/Db/AddMissingIndices.php
core/Migrations/Version13000Date20170718121200.php

index a8f78241bb61f020f70c1d071c9c56e0940e38ee..2e2579f094eda7c68ee8fe1785daa657333bbed4 100644 (file)
@@ -103,6 +103,10 @@ class Application extends App {
                                        if (!$table->hasIndex('fs_mtime')) {
                                                $subject->addHintForMissingSubject($table->getName(), 'fs_mtime');
                                        }
+
+                                       if (!$table->hasIndex('fs_size')) {
+                                               $subject->addHintForMissingSubject($table->getName(), 'fs_size');
+                                       }
                                }
 
                                if ($schema->hasTable('twofactor_providers')) {
index c4d8f6d7e310ad307f46dc6213fd7ce69960c22f..d06f27e84492e65bd5d6bbd3e6370146b35a9070 100644 (file)
@@ -135,6 +135,13 @@ class AddMissingIndices extends Command {
                                $updated = true;
                                $output->writeln('<info>Filecache table updated successfully.</info>');
                        }
+                       if (!$table->hasIndex('fs_size')) {
+                               $output->writeln('<info>Adding additional size index to the filecache table, this can take some time...</info>');
+                               $table->addIndex(['size'], 'fs_size');
+                               $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>');
index f3129c22ca2afa56f7be35c9c377c4607877dddd..d86477b5ab95ce7626333e2c2d1705111ebb457f 100644 (file)
@@ -225,6 +225,7 @@ class Version13000Date20170718121200 extends SimpleMigrationStep {
                        $table->addIndex(['storage', 'mimepart'], 'fs_storage_mimepart');
                        $table->addIndex(['storage', 'size', 'fileid'], 'fs_storage_size');
                        $table->addIndex(['mtime'], 'fs_mtime');
+                       $table->addIndex(['size'], 'fs_size');
                }
 
                if (!$schema->hasTable('group_user')) {