fn console_cluster_utilization_overview_sql(
bin: &str,
retention: &str,
group_size: u32,
) -> StringExpand description
Builds the SQL body shared by the mz_console_cluster_utilization_overview*
views, which power the Console’s cluster utilization graphs.
There is one view per (bucket width, retention window) pair so the Console
can read a pre-materialized, indexed rollup for each time range it offers
instead of recomputing this (expensive) query on every page load. The bodies
must be kept in sync with the equivalent ad-hoc query in the Console
(buildReplicaUtilizationHistoryQuery in
console/src/api/materialize/cluster/replicaUtilizationHistory.ts).
bin: thedate_binbucket width, e.g.1 MINUTE.retention: how much history the view retains, e.g.3 HOURS, enforced with a temporalmz_now()filter so the maintained arrangement stays bounded.group_size: the expected number of metric samples per (replica, bucket), used for theDISTINCT ON INPUT GROUP SIZEtop-k hint. Replica metrics are scraped roughly once per minute, so this is the bucket width in minutes.