Skip to content

Commit 5507e41

Browse files
committed
Restore proper rollback database indexing
1 parent f592b57 commit 5507e41

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/server/rollback.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,12 @@ bool RollbackManager::createTables()
224224
" FOREIGN KEY (`oldNode`) REFERENCES `node`(`id`),\n"
225225
" FOREIGN KEY (`newNode`) REFERENCES `node`(`id`)\n"
226226
");\n"
227-
"CREATE INDEX IF NOT EXISTS `actionIndex` ON `action`(`x`,`y`,`z`,`timestamp`,`actor`);\n",
227+
// We run queries with the following filters:
228+
// - `timestamp` >= ? AND `actor` = ?
229+
// - `timestamp` >= ?
230+
// - `timestamp` >= ? AND <range query on X, Y, Z>
231+
"CREATE INDEX IF NOT EXISTS `actionIndex` ON `action`(`x`,`y`,`z`,`timestamp`,`actor`);\n"
232+
"CREATE INDEX IF NOT EXISTS `actionTimestampActorIndex` ON `action`(`timestamp`,`actor`);\n",
228233
NULL, NULL, NULL));
229234
verbosestream << "SQL Rollback: SQLite3 database structure was created" << std::endl;
230235

0 commit comments

Comments
 (0)