fix: improve performance by reducing full table scans (#4684)

* use instance id on update in projections

* create index on domain in instance_domain projection

* add missing instanceID filter to app queries
This commit is contained in:
Livio Spring
2022-11-10 11:59:33 +01:00
committed by GitHub
parent ac66a54df9
commit 78ae64471a
71 changed files with 683 additions and 399 deletions

View File

@@ -188,6 +188,7 @@ func (p *userGrantProjection) reduceChanged(event eventstore.Event) (*handler.St
},
[]handler.Condition{
handler.NewCond(UserGrantID, event.Aggregate().ID),
handler.NewCond(UserGrantInstanceID, event.Aggregate().InstanceID),
},
), nil
}
@@ -204,6 +205,7 @@ func (p *userGrantProjection) reduceRemoved(event eventstore.Event) (*handler.St
event,
[]handler.Condition{
handler.NewCond(UserGrantID, event.Aggregate().ID),
handler.NewCond(UserGrantInstanceID, event.Aggregate().InstanceID),
},
), nil
}
@@ -222,6 +224,7 @@ func (p *userGrantProjection) reduceDeactivated(event eventstore.Event) (*handle
},
[]handler.Condition{
handler.NewCond(UserGrantID, event.Aggregate().ID),
handler.NewCond(UserGrantInstanceID, event.Aggregate().InstanceID),
},
), nil
}
@@ -240,6 +243,7 @@ func (p *userGrantProjection) reduceReactivated(event eventstore.Event) (*handle
},
[]handler.Condition{
handler.NewCond(UserGrantID, event.Aggregate().ID),
handler.NewCond(UserGrantInstanceID, event.Aggregate().InstanceID),
},
), nil
}
@@ -253,6 +257,7 @@ func (p *userGrantProjection) reduceUserRemoved(event eventstore.Event) (*handle
event,
[]handler.Condition{
handler.NewCond(UserGrantUserID, event.Aggregate().ID),
handler.NewCond(UserGrantInstanceID, event.Aggregate().InstanceID),
},
), nil
}
@@ -266,6 +271,7 @@ func (p *userGrantProjection) reduceProjectRemoved(event eventstore.Event) (*han
event,
[]handler.Condition{
handler.NewCond(UserGrantProjectID, event.Aggregate().ID),
handler.NewCond(UserGrantInstanceID, event.Aggregate().InstanceID),
},
), nil
}
@@ -280,6 +286,7 @@ func (p *userGrantProjection) reduceProjectGrantRemoved(event eventstore.Event)
event,
[]handler.Condition{
handler.NewCond(UserGrantGrantID, e.GrantID),
handler.NewCond(UserGrantInstanceID, event.Aggregate().InstanceID),
},
), nil
}
@@ -297,6 +304,7 @@ func (p *userGrantProjection) reduceRoleRemoved(event eventstore.Event) (*handle
},
[]handler.Condition{
handler.NewCond(UserGrantProjectID, e.Aggregate().ID),
handler.NewCond(UserGrantInstanceID, event.Aggregate().InstanceID),
},
), nil
}
@@ -322,6 +330,7 @@ func (p *userGrantProjection) reduceProjectGrantChanged(event eventstore.Event)
},
[]handler.Condition{
handler.NewCond(UserGrantGrantID, grantID),
handler.NewCond(UserGrantInstanceID, event.Aggregate().InstanceID),
},
), nil
}