mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-03-31 01:05:55 +00:00
core: add index to load chats faster (#5521)
* core: add index to load chats faster
* schema
* revert query (sqlite)
* Revert "revert query (sqlite)"
This reverts commit 194a48d61f.
---------
Co-authored-by: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com>
This commit is contained in:
@@ -1002,4 +1002,11 @@ CREATE INDEX idx_chat_items_groups_msg_content_tag_item_ts ON chat_items(
|
||||
msg_content_tag,
|
||||
item_ts
|
||||
);
|
||||
CREATE INDEX idx_chat_items_groups_msg_content_tag_deleted ON chat_items(
|
||||
user_id,
|
||||
group_id,
|
||||
msg_content_tag,
|
||||
item_deleted,
|
||||
item_sent
|
||||
);
|
||||
|]
|
||||
|
||||
@@ -9,10 +9,12 @@ m20250105_indexes :: Query
|
||||
m20250105_indexes =
|
||||
[sql|
|
||||
CREATE INDEX idx_chat_items_groups_msg_content_tag_item_ts ON chat_items(user_id, group_id, msg_content_tag, item_ts);
|
||||
CREATE INDEX idx_chat_items_groups_msg_content_tag_deleted ON chat_items(user_id, group_id, msg_content_tag, item_deleted, item_sent);
|
||||
|]
|
||||
|
||||
down_m20250105_indexes :: Query
|
||||
down_m20250105_indexes =
|
||||
[sql|
|
||||
DROP INDEX idx_chat_items_groups_msg_content_tag_item_ts;
|
||||
DROP INDEX idx_chat_items_groups_msg_content_tag_deleted;
|
||||
|]
|
||||
|
||||
@@ -968,3 +968,10 @@ CREATE INDEX idx_chat_items_groups_msg_content_tag_item_ts ON chat_items(
|
||||
msg_content_tag,
|
||||
item_ts
|
||||
);
|
||||
CREATE INDEX idx_chat_items_groups_msg_content_tag_deleted ON chat_items(
|
||||
user_id,
|
||||
group_id,
|
||||
msg_content_tag,
|
||||
item_deleted,
|
||||
item_sent
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user