mirror of
https://github.com/zitadel/zitadel.git
synced 2025-07-17 18:38:37 +00:00

# Which Problems Are Solved Some projection queries took a long time to run. It seems that 1 or more queries couldn't make proper use of the `es_projection` index. This might be because of a specific complexity aggregate_type and event_type arguments, making the index unfeasible for postgres. # How the Problems Are Solved Following the index recommendation, add and index that covers just instance_id and position. # Additional Changes - none # Additional Context - Related to https://github.com/zitadel/zitadel/issues/9832
28 lines
529 B
Go
28 lines
529 B
Go
package setup
|
|
|
|
import (
|
|
"context"
|
|
_ "embed"
|
|
|
|
"github.com/zitadel/zitadel/internal/database"
|
|
"github.com/zitadel/zitadel/internal/eventstore"
|
|
)
|
|
|
|
var (
|
|
//go:embed 54.sql
|
|
instancePositionIndex string
|
|
)
|
|
|
|
type InstancePositionIndex struct {
|
|
dbClient *database.DB
|
|
}
|
|
|
|
func (mig *InstancePositionIndex) Execute(ctx context.Context, _ eventstore.Event) error {
|
|
_, err := mig.dbClient.ExecContext(ctx, instancePositionIndex)
|
|
return err
|
|
}
|
|
|
|
func (mig *InstancePositionIndex) String() string {
|
|
return "54_instance_position_index"
|
|
}
|