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
@@ -159,6 +159,7 @@ func (p *idpLoginPolicyLinkProjection) reduceRemoved(event eventstore.Event) (*h
[]handler.Condition{
handler.NewCond(IDPLoginPolicyLinkIDPIDCol, idp.IDPConfigID),
handler.NewCond(IDPLoginPolicyLinkAggregateIDCol, idp.Aggregate().ID),
handler.NewCond(IDPLoginPolicyLinkInstanceIDCol, event.Aggregate().InstanceID),
},
), nil
}
@@ -179,6 +180,7 @@ func (p *idpLoginPolicyLinkProjection) reduceCascadeRemoved(event eventstore.Eve
[]handler.Condition{
handler.NewCond(IDPLoginPolicyLinkIDPIDCol, idp.IDPConfigID),
handler.NewCond(IDPLoginPolicyLinkAggregateIDCol, idp.Aggregate().ID),
handler.NewCond(IDPLoginPolicyLinkInstanceIDCol, idp.Aggregate().InstanceID),
},
), nil
}
@@ -199,6 +201,7 @@ func (p *idpLoginPolicyLinkProjection) reduceIDPConfigRemoved(event eventstore.E
[]handler.Condition{
handler.NewCond(IDPLoginPolicyLinkIDPIDCol, idpID),
handler.NewCond(IDPLoginPolicyLinkResourceOwnerCol, event.Aggregate().ResourceOwner),
handler.NewCond(IDPLoginPolicyLinkInstanceIDCol, event.Aggregate().InstanceID),
},
), nil
}
@@ -211,6 +214,7 @@ func (p *idpLoginPolicyLinkProjection) reduceOrgRemoved(event eventstore.Event)
return crdb.NewDeleteStatement(e,
[]handler.Condition{
handler.NewCond(IDPLoginPolicyLinkResourceOwnerCol, e.Aggregate().ID),
handler.NewCond(IDPLoginPolicyLinkInstanceIDCol, event.Aggregate().InstanceID),
},
), nil
}
@@ -223,6 +227,7 @@ func (p *idpLoginPolicyLinkProjection) reducePolicyRemoved(event eventstore.Even
return crdb.NewDeleteStatement(e,
[]handler.Condition{
handler.NewCond(IDPLoginPolicyLinkAggregateIDCol, e.Aggregate().ID),
handler.NewCond(IDPLoginPolicyLinkInstanceIDCol, event.Aggregate().InstanceID),
},
), nil
}