From 768ef772bbf57cd7a47786ed910316e76f3a8ee0 Mon Sep 17 00:00:00 2001 From: iequidoo Date: Fri, 31 May 2024 16:31:19 -0300 Subject: [PATCH] feat: Add a db index for reactions by msg_id (#5507) This should speed up `get_msg_reactions()` filtering reactions by `msg_id`, but also queries in other places involving both `msg_id` and `contact_id`. --- src/sql/migrations.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/sql/migrations.rs b/src/sql/migrations.rs index 8d702a275..74a354e20 100644 --- a/src/sql/migrations.rs +++ b/src/sql/migrations.rs @@ -932,6 +932,11 @@ CREATE INDEX msgs_status_updates_index2 ON msgs_status_updates (uid); .await?; } + if dbversion < 114 { + sql.execute_migration("CREATE INDEX reactions_index1 ON reactions (msg_id)", 114) + .await?; + } + let new_version = sql .get_raw_config_int(VERSION_CFG) .await?