diff --git a/CHANGELOG.md b/CHANGELOG.md index 81b7bb947..d9130af45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ - optimize `markseen_msgs` #3141 - automatically accept chats with outgoing messages #3143 - return result from `add_parts()` via structure #3154 +- add index to speedup deletion of expired ephemeral messages #3155 ### Fixes diff --git a/src/sql/migrations.rs b/src/sql/migrations.rs index 9874c1d82..0f18e7feb 100644 --- a/src/sql/migrations.rs +++ b/src/sql/migrations.rs @@ -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,