perf(eventstore): redefine current sequences index (#9142)

# Which Problems Are Solved

On Zitadel cloud we found changing the order of columns in the
`eventstore.events2_current_sequence` index improved CPU usage for the
`SELECT ... FOR UPDATE` query the pusher executes.

# How the Problems Are Solved

`eventstore.events2_current_sequence`-index got replaced

# Additional Context

closes https://github.com/zitadel/zitadel/issues/9082
This commit is contained in:
Silvan
2025-01-08 17:54:17 +01:00
committed by adlerhurst
parent 0d5d65e4c7
commit 0905a4c964
5 changed files with 46 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
CREATE INDEX CONCURRENTLY IF NOT EXISTS events2_current_sequence2
ON eventstore.events2 USING btree
(aggregate_id ASC, aggregate_type ASC, instance_id ASC, sequence DESC);