Improve rollback database indexing
authorcheapie <cheapiephp@gmail.com>
Sat, 24 Oct 2015 04:52:45 +0000 (23:52 -0500)
committerest31 <MTest31@outlook.com>
Sat, 24 Oct 2015 06:45:38 +0000 (08:45 +0200)
Index more columns in the action table of the rollback DB to improve the performance of /rollback_check

src/rollback.cpp

index 3d264b880ad6fadd83745f41548c000aa987be8c..2367c3a210427a96674346d0425366e57d4a2d06 100644 (file)
@@ -242,8 +242,7 @@ bool RollbackManager::createTables()
                "       FOREIGN KEY (`oldNode`)   REFERENCES `node`(`id`),\n"
                "       FOREIGN KEY (`newNode`)   REFERENCES `node`(`id`)\n"
                ");\n"
-               "CREATE INDEX IF NOT EXISTS `actionActor` ON `action`(`actor`);\n"
-               "CREATE INDEX IF NOT EXISTS `actionTimestamp` ON `action`(`timestamp`);\n",
+               "CREATE INDEX IF NOT EXISTS `actionIndex` ON `action`(`x`,`y`,`z`,`timestamp`,`actor`);\n",
                NULL, NULL, NULL));
        verbosestream << "SQL Rollback: SQLite3 database structure was created" << std::endl;