mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-07 07:16:54 +00:00
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:
@@ -256,6 +256,7 @@ func (p *loginNameProjection) reduceUserRemoved(event eventstore.Event) (*handle
|
||||
event,
|
||||
[]handler.Condition{
|
||||
handler.NewCond(LoginNameUserIDCol, e.Aggregate().ID),
|
||||
handler.NewCond(LoginNameUserInstanceIDCol, e.Aggregate().InstanceID),
|
||||
},
|
||||
crdb.WithTableSuffix(loginNameUserSuffix),
|
||||
), nil
|
||||
@@ -274,6 +275,7 @@ func (p *loginNameProjection) reduceUserNameChanged(event eventstore.Event) (*ha
|
||||
},
|
||||
[]handler.Condition{
|
||||
handler.NewCond(LoginNameUserIDCol, e.Aggregate().ID),
|
||||
handler.NewCond(LoginNameUserInstanceIDCol, e.Aggregate().InstanceID),
|
||||
},
|
||||
crdb.WithTableSuffix(loginNameUserSuffix),
|
||||
), nil
|
||||
@@ -292,6 +294,7 @@ func (p *loginNameProjection) reduceUserDomainClaimed(event eventstore.Event) (*
|
||||
},
|
||||
[]handler.Condition{
|
||||
handler.NewCond(LoginNameUserIDCol, e.Aggregate().ID),
|
||||
handler.NewCond(LoginNameUserInstanceIDCol, e.Aggregate().InstanceID),
|
||||
},
|
||||
crdb.WithTableSuffix(loginNameUserSuffix),
|
||||
), nil
|
||||
@@ -349,6 +352,7 @@ func (p *loginNameProjection) reduceDomainPolicyChanged(event eventstore.Event)
|
||||
},
|
||||
[]handler.Condition{
|
||||
handler.NewCond(LoginNamePoliciesResourceOwnerCol, policyEvent.Aggregate().ResourceOwner),
|
||||
handler.NewCond(LoginNamePoliciesInstanceIDCol, policyEvent.Aggregate().InstanceID),
|
||||
},
|
||||
crdb.WithTableSuffix(loginNamePolicySuffix),
|
||||
), nil
|
||||
@@ -364,6 +368,7 @@ func (p *loginNameProjection) reduceDomainPolicyRemoved(event eventstore.Event)
|
||||
event,
|
||||
[]handler.Condition{
|
||||
handler.NewCond(LoginNamePoliciesResourceOwnerCol, e.Aggregate().ResourceOwner),
|
||||
handler.NewCond(LoginNamePoliciesInstanceIDCol, e.Aggregate().InstanceID),
|
||||
},
|
||||
crdb.WithTableSuffix(loginNamePolicySuffix),
|
||||
), nil
|
||||
@@ -401,6 +406,7 @@ func (p *loginNameProjection) reducePrimaryDomainSet(event eventstore.Event) (*h
|
||||
[]handler.Condition{
|
||||
handler.NewCond(LoginNameDomainResourceOwnerCol, e.Aggregate().ResourceOwner),
|
||||
handler.NewCond(LoginNameDomainIsPrimaryCol, true),
|
||||
handler.NewCond(LoginNameDomainInstanceIDCol, e.Aggregate().InstanceID),
|
||||
},
|
||||
crdb.WithTableSuffix(loginNameDomainSuffix),
|
||||
),
|
||||
@@ -411,6 +417,7 @@ func (p *loginNameProjection) reducePrimaryDomainSet(event eventstore.Event) (*h
|
||||
[]handler.Condition{
|
||||
handler.NewCond(LoginNameDomainNameCol, e.Domain),
|
||||
handler.NewCond(LoginNameDomainResourceOwnerCol, e.Aggregate().ResourceOwner),
|
||||
handler.NewCond(LoginNameDomainInstanceIDCol, e.Aggregate().InstanceID),
|
||||
},
|
||||
crdb.WithTableSuffix(loginNameDomainSuffix),
|
||||
),
|
||||
@@ -428,6 +435,7 @@ func (p *loginNameProjection) reduceDomainRemoved(event eventstore.Event) (*hand
|
||||
[]handler.Condition{
|
||||
handler.NewCond(LoginNameDomainNameCol, e.Domain),
|
||||
handler.NewCond(LoginNameDomainResourceOwnerCol, e.Aggregate().ResourceOwner),
|
||||
handler.NewCond(LoginNameDomainInstanceIDCol, e.Aggregate().InstanceID),
|
||||
},
|
||||
crdb.WithTableSuffix(loginNameDomainSuffix),
|
||||
), nil
|
||||
|
||||
Reference in New Issue
Block a user