postgres: drop redundant indices (#5715)

## Summary
There are 3 indices in the postgres storage driver that are redundant.
This PR drops them.

## Related issues
-
[ENG-2560](https://linear.app/pomerium/issue/ENG-2560/request-remove-redundant-database-indexes)

## Checklist
- [x] reference any related issues
- [ ] updated unit tests
- [x] add appropriate label (`enhancement`, `bug`, `breaking`,
`dependencies`, `ci`)
- [x] ready for review
This commit is contained in:
Caleb Doxsey 2025-07-10 12:14:20 -06:00 committed by GitHub
parent 651a7e061f
commit 88c7a6537a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -156,6 +156,21 @@ var migrations = []func(context.Context, pgx.Tx) error{
}
}
return nil
},
6: func(ctx context.Context, tx pgx.Tx) error {
// these indices are redundant
for _, q := range []string{
`DROP INDEX ` + schemaName + `.` + recordsTableName + `_type_idx`,
`DROP INDEX ` + schemaName + `.` + recordChangesTableName + `_version_idx`,
`DROP INDEX ` + schemaName + `.` + recordChangesTableName + `_type_idx`,
} {
_, err := tx.Exec(ctx, q)
if err != nil {
return err
}
}
return nil
},
}