]> jfr.im git - irc/quakenet/newserv.git/commitdiff
CHANSERV: fix 7h cleanup time
authorChris Porter <redacted>
Sun, 17 Jan 2016 15:34:52 +0000 (15:34 +0000)
committerChris Porter <redacted>
Sun, 17 Jan 2016 15:34:52 +0000 (15:34 +0000)
--HG--
branch : chanserv-live

chanserv/chanserv_cleanupdb.c

index 5de7f2802960a1b25f4c291404ef50cbd045a0d5..210c99eb643125728cc113072a716cbe4617161f 100644 (file)
@@ -206,8 +206,14 @@ static void cleanupdb(void *arg) {
   /* This query returns a single column containing the userids of all users
    * who have active sessions now, or sessions which ended in the last
    * CLEANUP_ACCOUNT_INACTIVE days.  */
+
+  dbquery("BEGIN TRANSACTION;");
+
+  /* increase memory for aggregate (GROUP BY) -- query can take hours if this spills to disk */
+  dbquery("SET LOCAL work_mem = '512MB';");
   q9cleanup_asyncquery(cleanupdb_real, NULL,
-    "SELECT userID from chanserv.authhistory WHERE disconnecttime=0 OR disconnecttime > %d GROUP BY userID", to_age);
-  
+    "SELECT userID from chanserv.authhistory WHERE disconnecttime=0 OR disconnecttime > %d GROUP BY userID;", to_age);
+  dbquery("COMMIT;");
+
   cleanupdb_active=1;
 }