mysqld_qslower(8)
β¨ mysqld_qslower(8) β¨
System Manager's Manual π
π NAME π
mysqld_qslower β traces MySQL server queries that are slower than a threshold π¦
π§ SYNOPSIS π§
mysqld_qslower PID [min_ms]
π DESCRIPTION π
okay so this traces the queries a MySQL server is serving and only prints the ones that go over a latency (aka query duration) threshold you pick πβ¨ by default the minimum is 1 millisecond. if you set the threshold to 0, literally every query gets printed π
this one uses User Statically-Defined Tracing (USDT) probes, which MySQL added for DTrace support. ngl that feature might not be switched on for your MySQL install, so check the requirements section π
also, since this tool runs on BPF, only the root user can use it π₯ no cap, bring your root energy or it's a no π
π REQUIREMENTS π
you'll need CONFIG_BPF, bcc, and a MySQL server built with USDT probe support. that last one is set when you configure the build with -DENABLE_DTRACE=1 π
β OPTIONS β
PIDβ the mysqld process ID you want to trace πΈmin_msβ the minimum query latency (duration) to trace, in milliseconds. it defaults to1ms if you don't pass it π
π EXAMPLES π
trace MySQL server queries slower than 1 ms for PID 1981 π¦
# mysqld_qslower 1981
trace anything slower than 10 ms for PID 1981 β¨
# mysqld_qslower 1981 10
π FIELDS π
the output has four columns, bestie:
TIME(s)β when the query started, in seconds β°PIDβ the process ID of the traced server π«ΆMSβ how many milliseconds the query took, from start to end π₯QUERYβ the query string, cut off at 128 characters βοΈ
π¦ OVERHEAD π¦
this adds low-overhead instrumentation to MySQL queries, and it only pushes data from the kernel up to user level when a query goes over the threshold, which is so smart π§ if the server handles less than 1,000/sec, the overhead should be negligible π if your query rate is higher, go test it and see what the overhead looks like for you π
π SOURCE π
this comes from bcc π«Ά
https://github.com/iovisor/bcc
also look in the bcc distribution for a companion _examples.txt file. it has example usage, output, and commentary for this tool, and it's giving very helpful notes β¨
πΈ OS πΈ
Linux π§
π§ͺ STABILITY π§ͺ
Unstable - in development. so it's still cooking π³
π AUTHOR π
Brendan Gregg π
π SEE ALSO π
biosnoop(8) π¦
bestie, that's the whole page! π this is the USER COMMANDS manual, dated 2016-08-01, for mysqld_qslower(8) π stay curious and keep those queries fast πβ¨
π¦ where this page comes from
- alpine 3.24: bcc-doc 0.36.1-r1 Β· Apache-2.0
- nixpkgs unstable: bcc 0.37.0
- opensuse-leap 16.0: bcc-tools 0.35.0-160000.2.2 Β· Apache-2.0
- opensuse-leap 16.0: bcc-tools 0.35.0-160000.2.2 Β· Apache-2.0
- opensuse-leap 16.0: bcc-tools 0.35.0-160000.2.2 Β· Apache-2.0
- opensuse-leap 16.0: bcc-tools 0.35.0-160000.2.2 Β· Apache-2.0
- π girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms