From 02f44d9024f0c9eb53ae2ade83f9ff522218014c Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Thu, 2 Feb 2023 12:02:59 +0100 Subject: [PATCH] Reporting: Unbound DNS - duckdb consuming a lot of time doing index maintenance, this should lower the cpu load significantly. --- src/opnsense/scripts/unbound/logger.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/opnsense/scripts/unbound/logger.py b/src/opnsense/scripts/unbound/logger.py index cb7c2c0de..75c278176 100755 --- a/src/opnsense/scripts/unbound/logger.py +++ b/src/opnsense/scripts/unbound/logger.py @@ -110,7 +110,9 @@ class DNSReader: """.format(intv=size, min=(size//60), lim=((60//(size//60))*24)) ) - db.connection.execute("CREATE INDEX IF NOT EXISTS idx_query ON query (time)") + # when an earlier version created an index, make sure it doesn't exists. + # We do need to read the file anyway and adding an index means a **lot** of maintenance in the logger. + db.connection.execute("DROP INDEX IF EXISTS idx_query") def _sig(self, *args): # signal either open() or select() to gracefully close.