mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-06-04 01:41:43 +00:00
d69511bcad
* core: improve indexes * update plans * queries * postgres migration * optimize query * lint * plans * add indexes * schema * plans * postgres schema --------- Co-authored-by: Evgeny Poberezkin <evgeny@poberezkin.com>
38 lines
830 B
Haskell
38 lines
830 B
Haskell
{-# LANGUAGE QuasiQuotes #-}
|
|
|
|
module Simplex.Chat.Store.Postgres.Migrations.M20250721_indexes where
|
|
|
|
import Data.Text (Text)
|
|
import qualified Data.Text as T
|
|
import Text.RawString.QQ (r)
|
|
|
|
m20250721_indexes :: Text
|
|
m20250721_indexes =
|
|
T.pack
|
|
[r|
|
|
DROP INDEX idx_contact_requests_xcontact_id;
|
|
|
|
CREATE INDEX idx_contact_requests_xcontact_id ON contact_requests(user_id, xcontact_id);
|
|
|
|
CREATE INDEX idx_chat_items_group_scope_stats_all ON chat_items (
|
|
user_id,
|
|
group_id,
|
|
group_scope_tag,
|
|
group_scope_group_member_id,
|
|
item_status,
|
|
chat_item_id,
|
|
user_mention
|
|
);
|
|
|]
|
|
|
|
down_m20250721_indexes :: Text
|
|
down_m20250721_indexes =
|
|
T.pack
|
|
[r|
|
|
DROP INDEX idx_contact_requests_xcontact_id;
|
|
|
|
CREATE INDEX idx_contact_requests_xcontact_id ON contact_requests(xcontact_id);
|
|
|
|
DROP INDEX idx_chat_items_group_scope_stats_all;
|
|
|]
|