summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan.goodliffe@octal.co.uk>2026-06-08 11:27:49 +0100
committerDan Goodliffe <dan.goodliffe@octal.co.uk>2026-06-08 11:27:49 +0100
commitaa8f64a3e140e74a1f8d0074b606dd1f8560ad0a (patch)
treef27554cceee1a7ed372479ab440ecfb91043b036
parentbca5ac479de5721e354b70d627fb9654bd94bdee (diff)
downloadwebstat-aa8f64a3e140e74a1f8d0074b606dd1f8560ad0a.tar.bz2
webstat-aa8f64a3e140e74a1f8d0074b606dd1f8560ad0a.tar.xz
webstat-aa8f64a3e140e74a1f8d0074b606dd1f8560ad0a.zip
Don't order rows when purging
The need to purge rows in request_time order is not necessary (all rows will be deleted at some point in the process anyway) and is otherwise extremely expensive. Removing the order by clause is a roughly 300x speed up.
-rw-r--r--src/sql/accessLogPurgeOld.sql2
1 files changed, 0 insertions, 2 deletions
diff --git a/src/sql/accessLogPurgeOld.sql b/src/sql/accessLogPurgeOld.sql
index 00e55b5..616b3a6 100644
--- a/src/sql/accessLogPurgeOld.sql
+++ b/src/sql/accessLogPurgeOld.sql
@@ -5,8 +5,6 @@ WITH delete_batch AS (
access_log
WHERE
request_time < CURRENT_DATE - ?::interval
- ORDER BY
- request_time
FOR UPDATE
LIMIT ?)
DELETE FROM access_log AS al USING delete_batch AS del