mirror of
https://github.com/nextcloud/server.git
synced 2026-05-22 01:55:56 -04:00
perf: swap around root_id and mount_path_hash in index
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
51df4e93bf
commit
a545c93d36
5 changed files with 47 additions and 5 deletions
|
|
@ -121,7 +121,6 @@ class Version13000Date20170718121200 extends SimpleMigrationStep {
|
|||
$table->addIndex(['storage_id'], 'mounts_storage_index');
|
||||
$table->addIndex(['root_id'], 'mounts_root_index');
|
||||
$table->addIndex(['mount_id'], 'mounts_mount_id_index');
|
||||
$table->addIndex(['user_id', 'root_id', 'mount_point'], 'mounts_user_root_path_index', [], ['lengths' => [null, null, 128]]);
|
||||
} else {
|
||||
$table = $schema->getTable('mounts');
|
||||
if (!$table->hasColumn('mount_id')) {
|
||||
|
|
|
|||
|
|
@ -39,10 +39,6 @@ class Version33000Date20251209123503 extends SimpleMigrationStep {
|
|||
'notnull' => true,
|
||||
'length' => 32, // xxh128
|
||||
]);
|
||||
if ($table->hasIndex('mounts_user_root_path_index')) {
|
||||
$table->dropIndex('mounts_user_root_path_index');
|
||||
}
|
||||
$table->addUniqueIndex(['user_id', 'root_id', 'mount_point_hash'], 'mounts_user_root_path_index');
|
||||
return $schema;
|
||||
}
|
||||
|
||||
|
|
|
|||
45
core/Migrations/Version34000Date20260415161745.php
Normal file
45
core/Migrations/Version34000Date20260415161745.php
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace OC\Core\Migrations;
|
||||
|
||||
use Closure;
|
||||
use OCP\DB\ISchemaWrapper;
|
||||
use OCP\Migration\Attributes\AddIndex;
|
||||
use OCP\Migration\Attributes\DropIndex;
|
||||
use OCP\Migration\Attributes\IndexType;
|
||||
use OCP\Migration\IOutput;
|
||||
use OCP\Migration\SimpleMigrationStep;
|
||||
use Override;
|
||||
|
||||
#[AddIndex(table: 'mounts', type: IndexType::UNIQUE)]
|
||||
#[DropIndex(table: 'mounts', type: IndexType::UNIQUE)]
|
||||
class Version34000Date20260415161745 extends SimpleMigrationStep {
|
||||
#[Override]
|
||||
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
|
||||
/** @var ISchemaWrapper $schema */
|
||||
$schema = $schemaClosure();
|
||||
|
||||
$changed = false;
|
||||
if ($schema->hasTable('mounts')) {
|
||||
$table = $schema->getTable('mounts');
|
||||
|
||||
if ($table->hasIndex('mounts_user_root_path_index')) {
|
||||
$table->dropIndex('mounts_user_root_path_index');
|
||||
$changed = true;
|
||||
}
|
||||
if (!$table->hasIndex('mounts_user_path_root_index')) {
|
||||
$table->addUniqueIndex(['user_id', 'mount_point_hash', 'root_id'], 'mounts_user_path_root_index');
|
||||
$changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
return $changed ? $schema : null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1595,6 +1595,7 @@ return array(
|
|||
'OC\\Core\\Migrations\\Version33000Date20251209123503' => $baseDir . '/core/Migrations/Version33000Date20251209123503.php',
|
||||
'OC\\Core\\Migrations\\Version33000Date20260126120000' => $baseDir . '/core/Migrations/Version33000Date20260126120000.php',
|
||||
'OC\\Core\\Migrations\\Version34000Date20260318095645' => $baseDir . '/core/Migrations/Version34000Date20260318095645.php',
|
||||
'OC\\Core\\Migrations\\Version34000Date20260415161745' => $baseDir . '/core/Migrations/Version34000Date20260415161745.php',
|
||||
'OC\\Core\\Notification\\CoreNotifier' => $baseDir . '/core/Notification/CoreNotifier.php',
|
||||
'OC\\Core\\ResponseDefinitions' => $baseDir . '/core/ResponseDefinitions.php',
|
||||
'OC\\Core\\Service\\CronService' => $baseDir . '/core/Service/CronService.php',
|
||||
|
|
|
|||
|
|
@ -1636,6 +1636,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
|
|||
'OC\\Core\\Migrations\\Version33000Date20251209123503' => __DIR__ . '/../../..' . '/core/Migrations/Version33000Date20251209123503.php',
|
||||
'OC\\Core\\Migrations\\Version33000Date20260126120000' => __DIR__ . '/../../..' . '/core/Migrations/Version33000Date20260126120000.php',
|
||||
'OC\\Core\\Migrations\\Version34000Date20260318095645' => __DIR__ . '/../../..' . '/core/Migrations/Version34000Date20260318095645.php',
|
||||
'OC\\Core\\Migrations\\Version34000Date20260415161745' => __DIR__ . '/../../..' . '/core/Migrations/Version34000Date20260415161745.php',
|
||||
'OC\\Core\\Notification\\CoreNotifier' => __DIR__ . '/../../..' . '/core/Notification/CoreNotifier.php',
|
||||
'OC\\Core\\ResponseDefinitions' => __DIR__ . '/../../..' . '/core/ResponseDefinitions.php',
|
||||
'OC\\Core\\Service\\CronService' => __DIR__ . '/../../..' . '/core/Service/CronService.php',
|
||||
|
|
|
|||
Loading…
Reference in a new issue