Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

storage: add indexes for postgres #4479

Merged
merged 2 commits into from Aug 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions pkg/storage/postgres/migrate.go
Expand Up @@ -139,6 +139,23 @@ var migrations = []func(context.Context, pgx.Tx) error{
return err
}

return nil
},
5: func(ctx context.Context, tx pgx.Tx) error {
for _, q := range []string{
`CREATE INDEX ON ` + schemaName + `.` + recordsTableName + ` (type)`,
`CREATE INDEX ON ` + schemaName + `.` + recordsTableName + ` (type, version)`,
`CREATE INDEX ON ` + schemaName + `.` + recordChangesTableName + ` (modified_at)`,
`CREATE INDEX ON ` + schemaName + `.` + recordChangesTableName + ` (version)`,
`CREATE INDEX ON ` + schemaName + `.` + recordChangesTableName + ` (type)`,
`CREATE INDEX ON ` + schemaName + `.` + recordChangesTableName + ` (type, version)`,
} {
_, err := tx.Exec(ctx, q)
if err != nil {
return err
}
}

return nil
},
}
Expand Down