Add index to make finding megolm sessions to backup faster

This commit is contained in:
Brad Murray 2025-08-24 18:47:46 -04:00
commit 3eee0c1afa
No known key found for this signature in database
GPG key ID: A49463C6B5B28DCF
2 changed files with 6 additions and 1 deletions

View file

@ -1,4 +1,4 @@
-- v0 -> v17 (compatible with v15+): Latest revision
-- v0 -> v18 (compatible with v15+): Latest revision
CREATE TABLE IF NOT EXISTS crypto_account (
account_id TEXT PRIMARY KEY,
device_id TEXT NOT NULL,
@ -73,6 +73,9 @@ CREATE TABLE IF NOT EXISTS crypto_megolm_inbound_session (
key_backup_version TEXT NOT NULL DEFAULT '',
PRIMARY KEY (account_id, session_id)
);
-- Useful index to find keys that need backing up
CREATE INDEX crypto_megolm_inbound_session_backup_idx ON crypto_megolm_inbound_session(account_id, key_backup_version, session);
CREATE TABLE IF NOT EXISTS crypto_megolm_outbound_session (
account_id TEXT,

View file

@ -0,0 +1,2 @@
-- v18 (compatible with v15+): Add an index to the megolm_inbound_session table to make finding sessions to backup faster
CREATE INDEX crypto_megolm_inbound_session_backup_idx ON crypto_megolm_inbound_session(account_id, key_backup_version, session);