dbslower(8)
๐ dbslower(8) ๐
System Manager's Manual โจ okay bestie, this is the manual page for dbslower, so let's get into it ๐ซถ
โจ NAME โจ
okay so dbslower is the tool that traces MySQL and PostgreSQL server queries that are slower than a threshold ๐ข It's giving detective ๐ต๏ธโโ๏ธ
๐ SYNOPSIS ๐
dbslower [-v] [-p PID [PID ...]] [-x PATH] [-m THRESHOLD]
{mysql,postgres}
๐ DESCRIPTION ๐
okay so this traces queries served by a MySQL or PostgreSQL server and prints the ones that go over a latency (query time) threshold โฑ๏ธ by default the threshold is 1 ms, so anything slower than that shows up ๐
this uses User Statically-Defined Tracing (USDT) probes, which MySQL and PostgreSQL added for DTrace support ๐ฆ BUT these probes might not be turned on for your installation, so check the REQUIREMENTS section first ๐ if you're on MySQL, you can still trace queries without USDT using the -x option โจ
โ ๏ธ since this uses BPF, only the root user can use this tool. no root, no dbslower, sorry bestie ๐
๐ REQUIREMENTS ๐
you'll need CONFIG_BPF, bcc, and either:
- a MySQL server with USDT probe support (set when configuring the build with
-DENABLE_DTRACE=1) ๐ฌ - or a PostgreSQL server with USDT probe support (set when configuring the build with
--enable-dtrace) ๐
๐ธ OPTIONS ๐ธ
-hโ okay this one just prints the usage message ๐-p PIDโ traces this PID ๐ฏ if you don't give a PID, the tool tries to auto-detect the MySQL or PostgreSQL processes running on the system, so it does the work for you ๐ง-x PATHโ the path to the MySQL binary ๐ช this lets you trace MySQL queries even when USDT probes aren't enabled on the MySQL server, which is so clutch ๐ซถ-m THRESHOLDโ the minimum query latency (duration) to trace, in milliseconds โฑ๏ธ the default is 1 ms ๐{mysql,postgres}โ the database engine you want to trace ๐ฌ๐
๐ EXAMPLES ๐
trace MySQL server queries slower than 1 ms:
# dbslower mysql
trace queries slower than 10 ms for PostgreSQL in process 408:
# dbslower postgres -p 408 -m 10
๐ฆ FIELDS ๐ฆ
TIME(s)โ when the query started, in seconds โฐPIDโ process ID of the traced server ๐MSโ how many milliseconds the query took, from start to end ๐QUERYโ the query string, truncated to 256 characters โ๏ธ
๐ OVERHEAD ๐
this adds low-overhead instrumentation to queries, and it only sends output data from the kernel up to user level if a query goes over the threshold ๐ง if the server's query rate is less than 1,000/sec, the overhead is expected to be negligible ๐ if the query rate is higher, test it out to gauge the overhead yourself ๐ฅ
๐ 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 ๐โจ
๐ฅ๏ธ OS ๐ฅ๏ธ
Linux ๐ง
๐ง STABILITY ๐ง
Unstable - in development. so it's still a work in progress, bestie ๐ ๏ธ
๐ AUTHOR ๐
Sasha Goldshtein, Brendan Gregg ๐ซถ
๐ฎ SEE ALSO ๐ฎ
biosnoop(8), mysqld_qslower(8), dbstat(8) ๐
okay that's the whole tea โ๐ this page is from the USER COMMANDS section, dated 2017-02-15, and it's all about dbslower(8) ๐ stay hydrated, stay root, and go trace those slow queries bestie ๐ ๐ธ
๐ฆ 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