zitadel/cmd/setup/10/10_fill_table.sql
Silvan 6be41ea257
fix(setup): steps 10 and 11 (#5987)
* fix(step10): count amount of wrong_events manually

* fix(step11): create index for better performance
2023-06-07 16:30:19 +00:00

18 lines
441 B
SQL

INSERT INTO wrong_events (
SELECT * FROM (
SELECT
instance_id
, event_sequence
, creation_date AS current_cd
, lead(creation_date) OVER (
PARTITION BY instance_id
ORDER BY event_sequence DESC
) AS next_cd
FROM
eventstore.events
) sub WHERE
current_cd < next_cd
ORDER BY
event_sequence DESC
);