Sort timeline events by occurred_at and then by id
What does this MR do and why?
Sort timeline events by occurred_at
and then by id
. Fixes the broken sorting: two events occurred at the same time were sorted incorrectly.
Related to #372193 (closed)
SQL query
Issue used in queries https://gitlab.com/gitlab-examples/ops/incident-setup/everyone/tanuki-inc/-/issues/incident/2551
Before
SELECT "incident_management_timeline_events".*
FROM "incident_management_timeline_events"
WHERE "incident_management_timeline_events"."issue_id" = 110490844
ORDER BY "incident_management_timeline_events"."occurred_at" ASC
Explain
https://explain.depesz.com/s/J9vO
After
SELECT "incident_management_timeline_events".*
FROM "incident_management_timeline_events"
WHERE "incident_management_timeline_events"."issue_id" = 110490844
ORDER BY "incident_management_timeline_events"."occurred_at" ASC, "incident_management_timeline_events"."id" ASC
Explain
https://explain.depesz.com/s/Witc
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Vitali Tatarintev