perf(kpi-history): time-sliced batched purge replaces the single daily mega-DELETE

This commit is contained in:
Joseph Doherty
2026-07-09 09:06:42 -04:00
parent 5332912f26
commit 71189298a2
4 changed files with 116 additions and 5 deletions
@@ -42,7 +42,9 @@ public interface IKpiHistoryRepository
/// <summary>
/// Bulk-deletes rows whose <see cref="KpiSample.CapturedAtUtc"/> is strictly older
/// than <paramref name="before"/> (retention purge).
/// than <paramref name="before"/> (retention purge). Implementations slice the
/// purge into time-windowed DELETE batches so a large catch-up (e.g. after an
/// outage) never runs as a single lock/log-heavy transaction (arch-review 04, P4).
/// </summary>
/// <param name="before">UTC cut-off; rows captured before this instant are deleted.</param>
/// <param name="cancellationToken">Cancellation token.</param>