Track how much WLM slot and cluster memory each query or session consumes in Amazon Redshift.
Memory pressure is the top cause of query slow-downs and out-of-memory (OOM) errors. Watching memory tells you when to tune queries, resize the cluster, or adjust WLM queues.
Use STL_WLM_QUERY
for per-query peaks, SVL_QUERY_METRICS
for slot-level usage, and STV_BLOCKLIST
to catch live OOM waits.
Join STV_RECENTS
to SVL_QUERY_METRICS
filtering on pid
or query
.The sample query below shows the pattern.
See the Syntax section for the canonical SELECT with optional filters for user, queue, and time window.
max_block_usage
to slot_count
; values >99% flag risk.service_class
to find noisy queues.Add DISTKEYs to large tables, push predicates into subqueries, and switch to late-binding views so unused columns never materialize.
Create a scheduled query in CloudWatch, SNS, or Galaxy’s upcoming workflow runner that checks max_block_usage > 95
and sends a notification.
.
No. VACUUM reclaims disk space but has minimal impact on execution memory. Focus on join order and DISTKEYs.
It is the percentage of the assigned memory blocks consumed by a query. Values near 100 indicate an OOM risk.
STL/ SVL tables commit after each query step, so metrics appear within seconds of query completion.