From 5c796a2daf075e0c03e36660e71759b71c5bc0e2 Mon Sep 17 00:00:00 2001 From: Tom Needham Date: Tue, 10 Oct 2017 10:56:20 +0200 Subject: [PATCH] Use path hash in selects from filecache to speed things up --- lib/private/Repair/RepairMismatchFileCachePath.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/private/Repair/RepairMismatchFileCachePath.php b/lib/private/Repair/RepairMismatchFileCachePath.php index 57473c4b6899..55bfaf7dfb15 100644 --- a/lib/private/Repair/RepairMismatchFileCachePath.php +++ b/lib/private/Repair/RepairMismatchFileCachePath.php @@ -108,7 +108,7 @@ private function fixEntryPath(IOutput $out, $fileId, $wrongPath, $correctStorage if ($correctPath === '' && $this->connection->getDatabasePlatform() instanceof OraclePlatform) { $qb->andWhere($qb->expr()->isNull('path')); } else { - $qb->andWhere($qb->expr()->eq('path', $qb->createNamedParameter($correctPath))); + $qb->andWhere($qb->expr()->eq('path_hash', $qb->createNamedParameter(md5($correctPath)))); } $entryExisted = $qb->execute() > 0; @@ -373,7 +373,7 @@ private function getOrCreateEntry($storageId, $path, $reuseFileId = null) { if ($path === '' && $this->connection->getDatabasePlatform() instanceof OraclePlatform) { $qb->andWhere($qb->expr()->isNull('path')); } else { - $qb->andWhere($qb->expr()->eq('path', $qb->createNamedParameter($path))); + $qb->andWhere($qb->expr()->eq('path_hash', $qb->createNamedParameter(md5($path)))); } $results = $qb->execute(); $rows = $results->fetchAll();