From c633a5ce1104fd4f15d4f678a1f69c877ad5e4bd Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin Date: Tue, 14 Jul 2026 20:16:35 +0100 Subject: [PATCH] update query plans --- .../SQLite/Migrations/agent_query_plans.txt | 4 ++++ .../SQLite/Migrations/chat_query_plans.txt | 22 ++++++++++--------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/Simplex/Chat/Store/SQLite/Migrations/agent_query_plans.txt b/src/Simplex/Chat/Store/SQLite/Migrations/agent_query_plans.txt index a986773cb2..bfa23bc04e 100644 --- a/src/Simplex/Chat/Store/SQLite/Migrations/agent_query_plans.txt +++ b/src/Simplex/Chat/Store/SQLite/Migrations/agent_query_plans.txt @@ -1143,6 +1143,10 @@ Plan: Query: INSERT INTO users DEFAULT VALUES Plan: +Query: SELECT 1 FROM connections WHERE conn_id = ? AND deleted_at_wait_delivery < ? LIMIT 1 +Plan: +SEARCH connections USING PRIMARY KEY (conn_id=?) + Query: SELECT 1 FROM encrypted_rcv_message_hashes WHERE conn_id = ? AND hash = ? LIMIT 1 Plan: SEARCH encrypted_rcv_message_hashes USING COVERING INDEX idx_encrypted_rcv_message_hashes_hash (conn_id=? AND hash=?) diff --git a/src/Simplex/Chat/Store/SQLite/Migrations/chat_query_plans.txt b/src/Simplex/Chat/Store/SQLite/Migrations/chat_query_plans.txt index 0f25e4463b..68fc300d37 100644 --- a/src/Simplex/Chat/Store/SQLite/Migrations/chat_query_plans.txt +++ b/src/Simplex/Chat/Store/SQLite/Migrations/chat_query_plans.txt @@ -1156,6 +1156,14 @@ Query: Plan: SEARCH contact_profiles USING INTEGER PRIMARY KEY (rowid=?) +Query: + UPDATE contacts + SET local_display_name = ?, contact_profile_id = ?, updated_at = ? + WHERE user_id = ? AND contact_id = ? + +Plan: +SEARCH contacts USING INTEGER PRIMARY KEY (rowid=?) + Query: UPDATE contacts SET user_id = ?, local_display_name = ?, user_preferences = ?, updated_at = ? @@ -1791,18 +1799,11 @@ Query: Plan: SEARCH contacts USING INTEGER PRIMARY KEY (rowid=?) -Query: - UPDATE contacts - SET local_display_name = ?, contact_profile_id = ?, updated_at = ? - WHERE user_id = ? AND contact_id = ? - -Plan: -SEARCH contacts USING INTEGER PRIMARY KEY (rowid=?) - Query: UPDATE group_members SET contact_id = ?, updated_at = ? - WHERE user_id = ? AND group_id = ? AND group_member_id = ? + WHERE user_id = ? AND group_id = ? AND group_member_id = ? AND contact_id IS NULL + RETURNING 1 Plan: SEARCH group_members USING INTEGER PRIMARY KEY (rowid=?) @@ -4140,7 +4141,8 @@ SCAN group_members USING COVERING INDEX idx_group_members_user_id_local_display_ Query: UPDATE group_members SET contact_id = ?, local_display_name = ?, contact_profile_id = ?, updated_at = ? - WHERE user_id = ? AND group_id = ? AND group_member_id = ? + WHERE user_id = ? AND group_id = ? AND group_member_id = ? AND contact_id IS NULL + RETURNING 1 Plan: SEARCH group_members USING INTEGER PRIMARY KEY (rowid=?)