Prevent table scan

This commit is contained in:
M66B 2023-01-28 20:59:42 +01:00
parent ee4eb0c009
commit 30e4f994e6
3 changed files with 2902 additions and 1 deletions

File diff suppressed because it is too large Load Diff

View File

@ -68,7 +68,7 @@ import javax.mail.internet.InternetAddress;
// https://developer.android.com/topic/libraries/architecture/room.html
@Database(
version = 265,
version = 266,
entities = {
EntityIdentity.class,
EntityAccount.class,
@ -2717,6 +2717,14 @@ public abstract class DB extends RoomDatabase {
db.execSQL("ALTER TABLE `identity` ADD COLUMN `reply_extra_name` INTEGER NOT NULL DEFAULT 0");
createTriggers(db);
}
}).addMigrations(new Migration(265, 266) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase db) {
logMigration(startVersion, endVersion);
db.execSQL("CREATE INDEX `index_message_replying` ON `message` (`replying`)");
db.execSQL("CREATE INDEX `index_message_forwarding` ON `message` (`forwarding`)");
createTriggers(db);
}
}).addMigrations(new Migration(998, 999) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase db) {

View File

@ -74,6 +74,8 @@ import javax.mail.internet.InternetAddress;
@Index(value = {"account"}),
@Index(value = {"folder"}),
@Index(value = {"identity"}),
@Index(value = {"replying"}),
@Index(value = {"forwarding"}),
@Index(value = {"folder", "uid"}, unique = true),
@Index(value = {"inreplyto"}),
@Index(value = {"msgid"}),