From 4697bfa2fb61b885997a499f40bb7daafb95da83 Mon Sep 17 00:00:00 2001 From: Lorenzo Delgado Date: Wed, 25 Jan 2023 12:16:45 +0100 Subject: [PATCH] refactor(archive): sqlite query optimization. replace or-ed equal conditions list with in-list --- .../waku_archive/driver/sqlite_driver/queries.nim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/waku/v2/protocol/waku_archive/driver/sqlite_driver/queries.nim b/waku/v2/protocol/waku_archive/driver/sqlite_driver/queries.nim index 4b38c2696c..ee915eac51 100644 --- a/waku/v2/protocol/waku_archive/driver/sqlite_driver/queries.nim +++ b/waku/v2/protocol/waku_archive/driver/sqlite_driver/queries.nim @@ -255,10 +255,10 @@ proc whereClause(cursor: Option[DbCursor], let contentTopicClause = if contentTopic.len <= 0: none(string) else: - var where = "(" - where &= "contentTopic = (?)" - for _ in contentTopic[1..^1]: - where &= " OR contentTopic = (?)" + var where = "contentTopic IN (" + where &= "?" + for _ in 1..