Add ephemeral_timestamp index for msgs table

This reduced get_chat_msgs() benchmark time from 400ms to 170ms.
This commit is contained in:
link2xt
2022-03-26 16:37:46 +00:00
parent 08d34e41c6
commit 0842e54f52
2 changed files with 10 additions and 0 deletions

View File

@@ -599,6 +599,15 @@ CREATE INDEX smtp_messageid ON imap(rfc724_mid);
)
.await?;
}
if dbversion < 87 {
info!(context, "[migration] v87");
// the index is used to speed up delete_expired_messages()
sql.execute_migration(
"CREATE INDEX IF NOT EXISTS msgs_index8 ON msgs (ephemeral_timestamp);",
87,
)
.await?;
}
Ok((
recalc_fingerprints,