From: Jan Schmidt Date: Thu, 3 Sep 2020 12:51:58 +0000 (+1000) Subject: syncjournaldb: index e2eMangledName column in metadata X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~22^2~191^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=3077a1378b5575cf24651bf70cfdffa6b6ce13b4;p=nextcloud-desktop.git syncjournaldb: index e2eMangledName column in metadata Add an index on the e2eMangledName column in the metadata table to speed up file sync by orders of magnitude on directories with a large number of files. Signed-off-by: Jan Schmidt --- diff --git a/src/common/syncjournaldb.cpp b/src/common/syncjournaldb.cpp index d13f855d5..1666c4f82 100644 --- a/src/common/syncjournaldb.cpp +++ b/src/common/syncjournaldb.cpp @@ -745,6 +745,15 @@ bool SyncJournalDb::updateMetadataTableStructure() commitInternal("update database structure: add contentChecksum col for uploadinfo"); } + if (true) { + SqlQuery query(_db); + query.prepare("CREATE INDEX IF NOT EXISTS metadata_e2e_id ON metadata(e2eMangledName);"); + if (!query.exec()) { + sqlFail("updateMetadataTableStructure: create index e2eMangledName", query); + re = false; + } + commitInternal("update database structure: add e2eMangledName index"); + } return re; }