fix(setup): improve search query to use index (#8898)

# Which Problems Are Solved

The setup filter for previous steps and kept getting slower. This is due
to the filter, which did not provide any instanceID and thus resulting
in a full table scan.

# How the Problems Are Solved

- Added an empty instanceID filter (since it's on system level)

# Additional Changes

None

# Additional Context

Noticed internally and during migrations on some regions
This commit is contained in:
Livio Spring 2024-11-13 08:50:23 +01:00 committed by GitHub
parent a09c772b03
commit ecbf0db15b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -18,6 +18,7 @@ type StepStates struct {
// Query implements eventstore.QueryReducer.
func (*StepStates) Query() *eventstore.SearchQueryBuilder {
return eventstore.NewSearchQueryBuilder(eventstore.ColumnsEvent).
InstanceID(""). // to make sure we can use an appropriate index
AddQuery().
AggregateTypes(SystemAggregate).
AggregateIDs(SystemAggregateID).