From 7c6ade0fc5d4fccb3af190f54ca869a799fc3782 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20M=C3=BCller?= <34514239+appgurueu@users.noreply.github.com> Date: Fri, 24 Jan 2025 16:50:59 +0100 Subject: [PATCH] Restore proper rollback database indexing (#15707) --- src/server/rollback.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/server/rollback.cpp b/src/server/rollback.cpp index ba93385e9..a20469aa5 100644 --- a/src/server/rollback.cpp +++ b/src/server/rollback.cpp @@ -224,7 +224,12 @@ bool RollbackManager::createTables() " FOREIGN KEY (`oldNode`) REFERENCES `node`(`id`),\n" " FOREIGN KEY (`newNode`) REFERENCES `node`(`id`)\n" ");\n" - "CREATE INDEX IF NOT EXISTS `actionIndex` ON `action`(`x`,`y`,`z`,`timestamp`,`actor`);\n", + // We run queries with the following filters: + // - `timestamp` >= ? AND `actor` = ? + // - `timestamp` >= ? + // - `timestamp` >= ? AND + "CREATE INDEX IF NOT EXISTS `actionIndex` ON `action`(`x`,`y`,`z`,`timestamp`,`actor`);\n" + "CREATE INDEX IF NOT EXISTS `actionTimestampActorIndex` ON `action`(`timestamp`,`actor`);\n", NULL, NULL, NULL)); verbosestream << "SQL Rollback: SQLite3 database structure was created" << std::endl;