-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(GODT-2933): Add index to message flags
Should improve performance in join operation and general lookups.
- Loading branch information
1 parent
caaf108
commit 53774d4
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package v3 | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
v1 "github.com/ProtonMail/gluon/internal/db_impl/sqlite3/v1" | ||
|
||
"github.com/ProtonMail/gluon/imap" | ||
"github.com/ProtonMail/gluon/internal/db_impl/sqlite3/utils" | ||
) | ||
|
||
type Migration struct{} | ||
|
||
func (m Migration) Run(ctx context.Context, tx utils.QueryWrapper, _ imap.UIDValidityGenerator) error { | ||
// Create an index on message id field to speed up lookup queries for message flags. | ||
query := fmt.Sprintf("create index message_flags_message_id_index on %v (%v)", | ||
v1.MessageFlagsTableName, | ||
v1.MessageFlagsFieldMessageID, | ||
) | ||
|
||
if _, err := utils.ExecQuery(ctx, tx, query); err != nil { | ||
return fmt.Errorf("failed to create connector settings table: %w", err) | ||
} | ||
|
||
return nil | ||
} |