Add index on message timestamps

This commit is contained in:
Tulir Asokan 2023-06-16 12:58:57 +03:00
parent 5c5633548f
commit b97b3755dc
2 changed files with 5 additions and 1 deletions

View file

@ -1,4 +1,4 @@
-- v0 -> v56 (compatible with v45+): Latest revision -- v0 -> v57 (compatible with v45+): Latest revision
CREATE TABLE "user" ( CREATE TABLE "user" (
mxid TEXT PRIMARY KEY, mxid TEXT PRIMARY KEY,
@ -82,6 +82,8 @@ CREATE TABLE message (
FOREIGN KEY (chat_jid, chat_receiver) REFERENCES portal(jid, receiver) ON DELETE CASCADE FOREIGN KEY (chat_jid, chat_receiver) REFERENCES portal(jid, receiver) ON DELETE CASCADE
); );
CREATE INDEX message_timestamp_idx ON message (chat_jid, chat_receiver, timestamp);
CREATE TABLE poll_option_id ( CREATE TABLE poll_option_id (
msg_mxid TEXT, msg_mxid TEXT,
opt_id TEXT, opt_id TEXT,

View file

@ -0,0 +1,2 @@
-- v57 (compatible with v45+): Add index for message timestamp to make read receipt handling faster
CREATE INDEX message_timestamp_idx ON message (chat_jid, chat_receiver, timestamp);