Expand description
Workload phase residuals.
The mix of query digests (statement classes) shifts over time as ETL
windows, reporting bursts, and ad-hoc spikes overlap. We track this with
one residual per time bucket: the Jensen–Shannon divergence between the
current digest-mix histogram and the rolling reference histogram. JS is
bounded in [0, 1], symmetric, and zero when distributions agree —
exactly the properties the motif state machine needs to call a phase
transition.
MySQL Performance Schema digests (fact #19), SQL Server sys.dm_exec_query_stats
grouped by query_hash, PostgreSQL pg_stat_statements.queryid all
provide statement-class identifiers compatible with this construction.
Functions§
- js_
divergence - Compute Jensen–Shannon divergence (base 2, in
[0, 1]) between two digest-mix histogramspandq. Inputs do not need to be normalised; they are renormalised internally. - push_
jsd - Push a phase residual at
t.bucket_ididentifies the time bucket (e.g. an ISO-week or a 5-minute window).