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

@@ -312,6 +312,7 @@ func (p *labelPolicyProjection) reduceChanged(event eventstore.Event) (*handler.
[]handler.Condition{
handler.NewCond(LabelPolicyIDCol, policyEvent.Aggregate().ID),
handler.NewCond(LabelPolicyStateCol, domain.LabelPolicyStatePreview),
handler.NewCond(LabelPolicyInstanceIDCol, event.Aggregate().InstanceID),
}), nil
}
@@ -324,6 +325,7 @@ func (p *labelPolicyProjection) reduceRemoved(event eventstore.Event) (*handler.
policyEvent,
[]handler.Condition{
handler.NewCond(LabelPolicyIDCol, policyEvent.Aggregate().ID),
handler.NewCond(LabelPolicyInstanceIDCol, event.Aggregate().InstanceID),
}), nil
}
@@ -425,6 +427,7 @@ func (p *labelPolicyProjection) reduceLogoAdded(event eventstore.Event) (*handle
[]handler.Condition{
handler.NewCond(LabelPolicyIDCol, event.Aggregate().ID),
handler.NewCond(LabelPolicyStateCol, domain.LabelPolicyStatePreview),
handler.NewCond(LabelPolicyInstanceIDCol, event.Aggregate().InstanceID),
}), nil
}
@@ -453,6 +456,7 @@ func (p *labelPolicyProjection) reduceLogoRemoved(event eventstore.Event) (*hand
[]handler.Condition{
handler.NewCond(LabelPolicyIDCol, event.Aggregate().ID),
handler.NewCond(LabelPolicyStateCol, domain.LabelPolicyStatePreview),
handler.NewCond(LabelPolicyInstanceIDCol, event.Aggregate().InstanceID),
}), nil
}
@@ -481,6 +485,7 @@ func (p *labelPolicyProjection) reduceIconAdded(event eventstore.Event) (*handle
[]handler.Condition{
handler.NewCond(LabelPolicyIDCol, event.Aggregate().ID),
handler.NewCond(LabelPolicyStateCol, domain.LabelPolicyStatePreview),
handler.NewCond(LabelPolicyInstanceIDCol, event.Aggregate().InstanceID),
}), nil
}
@@ -509,6 +514,7 @@ func (p *labelPolicyProjection) reduceIconRemoved(event eventstore.Event) (*hand
[]handler.Condition{
handler.NewCond(LabelPolicyIDCol, event.Aggregate().ID),
handler.NewCond(LabelPolicyStateCol, domain.LabelPolicyStatePreview),
handler.NewCond(LabelPolicyInstanceIDCol, event.Aggregate().InstanceID),
}), nil
}
@@ -533,6 +539,7 @@ func (p *labelPolicyProjection) reduceFontAdded(event eventstore.Event) (*handle
[]handler.Condition{
handler.NewCond(LabelPolicyIDCol, event.Aggregate().ID),
handler.NewCond(LabelPolicyStateCol, domain.LabelPolicyStatePreview),
handler.NewCond(LabelPolicyInstanceIDCol, event.Aggregate().InstanceID),
}), nil
}
@@ -557,6 +564,7 @@ func (p *labelPolicyProjection) reduceFontRemoved(event eventstore.Event) (*hand
[]handler.Condition{
handler.NewCond(LabelPolicyIDCol, event.Aggregate().ID),
handler.NewCond(LabelPolicyStateCol, domain.LabelPolicyStatePreview),
handler.NewCond(LabelPolicyInstanceIDCol, event.Aggregate().InstanceID),
}), nil
}
@@ -582,5 +590,6 @@ func (p *labelPolicyProjection) reduceAssetsRemoved(event eventstore.Event) (*ha
[]handler.Condition{
handler.NewCond(LabelPolicyIDCol, event.Aggregate().ID),
handler.NewCond(LabelPolicyStateCol, domain.LabelPolicyStatePreview),
handler.NewCond(LabelPolicyInstanceIDCol, event.Aggregate().InstanceID),
}), nil
}