#110514Improve history correlation lookup performance with a composite index
Description
RecordHistory::findEventsForCorrelation() retrieves entries from sys_history using correlation_id and orders them by tstamp DESC.
The table currently has no index starting with correlation_id, requiring a full table scan and an additional sort as the history table grows.
Add the following composite index:
KEY correlation (correlation_id,tstamp)
A synthetic SQLite benchmark measured:
- 100,000 rows: 3.290 ms → 0.011 ms (approximately 288× faster)
- 10,000 rows: 0.263 ms → 0.010 ms (approximately 26× faster)
The index supports both correlation filtering and timestamp ordering. Actual end-to-end improvements depend on subsequent history processing and rendering.
Reviews 2
History 12
-
Gerrit Code Review pushed patch set 1 for main to change 95379 status
NewUnder Review <span data-processor="relativetime" data-value="2026-08-21T20:55:14+00:00" > 08/21/26, 20:55 </span> -
Wouter Wolters commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2026-10-10T10:25:09+00:00" > 10/10/26, 10:25 </span>
Applied in changeset commit:a7788722b27fb8b1fb8635b262cc357b00e33b4f.