mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-05-11 11:04:56 +00:00
core: add indexes to improve slow queries performance (#2931)
* core: add indexes to improve slow queries performance * idx_chat_items_group_id * update simplexmq, schema * update simplexmq * remove index * update simplexmq --------- Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
|
||||
module Simplex.Chat.Migrations.M20230814_indexes where
|
||||
|
||||
import Database.SQLite.Simple (Query)
|
||||
import Database.SQLite.Simple.QQ (sql)
|
||||
|
||||
m20230814_indexes :: Query
|
||||
m20230814_indexes =
|
||||
[sql|
|
||||
CREATE INDEX idx_chat_items_user_id_item_status ON chat_items(user_id, item_status);
|
||||
|]
|
||||
|
||||
down_m20230814_indexes :: Query
|
||||
down_m20230814_indexes =
|
||||
[sql|
|
||||
DROP INDEX idx_chat_items_user_id_item_status;
|
||||
|]
|
||||
@@ -701,3 +701,7 @@ CREATE INDEX idx_group_snd_item_statuses_chat_item_id ON group_snd_item_statuses
|
||||
CREATE INDEX idx_group_snd_item_statuses_group_member_id ON group_snd_item_statuses(
|
||||
group_member_id
|
||||
);
|
||||
CREATE INDEX idx_chat_items_user_id_item_status ON chat_items(
|
||||
user_id,
|
||||
item_status
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user