At a glance
The proportion of statements that ran slower thanlong_query_time, expressed as a percentage of total queries over a 15-minute window. It is theSlow_queriesstatus counter divided by total queries (Questions/Queries), differenced over the window. A gauge, not a latency number: it tells you how much of the workload is slow, not how slow the slow ones are. For a DBA, the slow-query rate is the volume signal that complements the latency percentiles. p95 and p99 tell you the tail is bad; the slow-query rate tells you what fraction of the workload is in that tail. When it crosses 5% the card turns amber, because at that point one query in twenty is breaching the slow threshold and the slow query log is filling.
Calculation
The rate is a ratio of two monotonic counters, both differenced over the 15-minute window so the gauge reflects the recent workload rather than the cumulative history since startup.Slow_queries increments whenever a statement’s execution time exceeds long_query_time (default 10 seconds, but most production instances set it far lower, often 0.5 to 2 seconds, to capture meaningful offenders). Crucially, the rate is only interpretable alongside the configured long_query_time: a server with long_query_time = 0.1 will show a much higher rate than one set to 10, for the identical workload. The card reads the live long_query_time and presents it next to the rate so the figure is never read in a vacuum. If the server restarts inside the window the counters reset to zero; the engine clamps the negative delta and recomputes from the restart point. Where Questions is unavailable the engine uses Queries (which also counts statements executed inside stored programs) and notes the basis in the source line.
Worked example
A platform team runs a MariaDB 10.6 primary withlong_query_time = 1 (one second). Snapshot taken on 21 Mar 26 at 10:15 GMT, shortly after a release.
7.1% means roughly one query in fourteen is taking longer than a second, and the rate jumped right after a release, which is the most useful clue: a deploy changed something. The DBA pulls the slow query log and the digest table to see which statements are now slow:
SELECT introduced by the release that joins orders to a customer_segments table with no index on the join column. It runs thousands of times and examines the whole segments table each call, dominating the slow count. The fix is an index on customer_segments(customer_id) plus an ANALYZE TABLE. After deploying, the rate falls to 0.4% on the next window.
Three takeaways:
- Read the rate next to the latency percentiles. The rate is volume (how many are slow); p95/p99 are severity (how slow). A high rate with a modest p99 means lots of mildly-slow queries; a low rate with a huge p99 means a few catastrophic ones. The pair tells you whether to optimise broadly or surgically.
- The rate is meaningless without
long_query_time. A rate of 7% atlong_query_time = 0.1is very different from 7% atlong_query_time = 2. Always read the configured threshold (the card shows it) before reacting. - Spikes after a release point at a query change. A rate that jumps at a deploy boundary is almost always a new or changed statement with a missing index. The digest table, filtered by
COUNT_STAR, names the offender by volume.
Sibling cards
Reconciling against the source
Where to look in MariaDB’s own tooling:Why our number may legitimately differ from a manual ratio:SHOW GLOBAL STATUS LIKE 'Slow_queries';andSHOW GLOBAL STATUS LIKE 'Questions';for the raw counters behind the ratio.SHOW VARIABLES LIKE 'long_query_time';to confirm the threshold the rate is measured against (andlog_slow_query_file/slow_query_logto confirm logging is on). The slow query log itself, summarised withpt-query-digest(Percona Toolkit), which prints counts and percentiles per digest.SELECT * FROM performance_schema.events_statements_summary_by_digest WHERE AVG_TIMER_WAIT/1e9 > <long_query_time_ms>;for the structured equivalent of the slow log.
On managed services: Amazon RDS / Aurora for MariaDB exposes
Slow_queries via Enhanced Monitoring and publishes the slow query log to CloudWatch Logs (when enabled); SkySQL and Azure Database for MariaDB surface the slow-query counter in their own consoles and offer log export. Confirm the managed service’s long_query_time parameter-group value matches your expectation before comparing rates.
Known limitations / FAQs
Q: The rate looks high, but is the database actually slow? Not necessarily. The rate is entirely relative tolong_query_time. If that threshold is set aggressively low (say 0.1 seconds) a perfectly healthy reporting workload will show a high rate because legitimate analytic queries cross the line. Always read the configured long_query_time (the card shows it) first. A high rate at a low threshold may just mean the threshold is tuned for sensitivity, not that anything is broken.
Q: How does the slow-query rate relate to p95 and p99?
They are volume versus severity. The rate tells you what fraction of queries are slow; the percentiles tell you how slow the slow ones are. A high rate with a modest p99 means many mildly-slow queries (optimise broadly, often a missing index on a high-frequency statement). A low rate with a huge p99 means a few catastrophic queries (optimise surgically, often a long transaction or a full scan). Read them together.
Q: The rate jumped right after a deploy. What should I check?
A deploy-boundary spike almost always means a new or changed statement with a missing or unused index. Filter Top 10 Slowest Queries (digest) and the digest table by COUNT_STAR to find the high-frequency offender, run EXPLAIN to confirm the plan, and add the index. Cross-check Queries per Second (live) to rule out a pure traffic surge.
Q: Does the rate count queries that hit a cold cache?
Yes, indirectly. A query that would be fast against a warm buffer pool can exceed long_query_time when it has to read from disk, so it increments Slow_queries. If the rate rises alongside a dip in InnoDB / XtraDB Buffer Pool Hit Rate %, the slowness is I/O-driven (buffer pool too small or recently restarted) rather than a bad plan.
Q: Should I lower long_query_time to catch more slow queries?
Lowering it gives you finer visibility but inflates the rate and grows the slow query log, which itself adds write overhead. A common production setting is 0.5 to 2 seconds: low enough to catch real offenders, high enough to avoid logging routine queries. If you lower it, expect this card’s rate to rise as a definitional consequence, not because anything degraded, and re-baseline the Alert threshold accordingly.
Q: The rate is 0% but my latency percentiles are amber. How?
The percentiles measure execution time directly; the rate measures how many queries crossed long_query_time. If long_query_time is set high (say 10 seconds) but your p95 sits at 250ms, the percentiles flag a real slowdown while the rate stays at zero because nothing crossed the 10-second line. Lower long_query_time to bring the rate into a useful range, or trust the percentiles, which do not depend on the threshold.