1dbslower(8) System Manager's Manual dbslower(8)
2
3
4
6 dbslower - Trace MySQL/PostgreSQL server queries slower than a thresh‐
7 old.
8
10 dbslower [-v] [-p PID [PID ...]] [-m THRESHOLD] {mysql,postgres}
11
13 This traces queries served by a MySQL or PostgreSQL server, and prints
14 those that exceed a latency (query time) threshold. By default a
15 threshold of 1 ms is used.
16
17 This uses User Statically-Defined Tracing (USDT) probes, a feature
18 added to MySQL and PostgreSQL for DTrace support, but which may not be
19 enabled on a given installation. See requirements.
20
21 Since this uses BPF, only the root user can use this tool.
22
24 CONFIG_BPF, bcc, and MySQL server with USDT probe support (when config‐
25 uring the build: -DENABLE_DTRACE=1) or PostgreSQL server with USDT
26 probe support (when configuring the build: --enable-dtrace).
27
29 -h Print usage message.
30
31 -p PID Trace this PID. If no PID is specified, the tool will attempt to
32 automatically detect the MySQL or PostgreSQL processes running
33 on the system.
34
35 -m THRESHOLD
36 Minimum query latency (duration) to trace, in milliseconds.
37 Default is 1 ms.
38
39 {mysql,postgres}
40 The database engine to trace.
41
43 Trace MySQL server queries slower than 1 ms:
44 # dbslower mysql
45
46 Trace slower than 10 ms for PostgreSQL in process 408:
47 # dbslower postgres -p 408 -m 10
48
50 TIME(s)
51 Time of query start, in seconds.
52
53 PID Process ID of the traced server.
54
55 MS Milliseconds for the query, from start to end.
56
57 QUERY Query string, truncated to 256 characters.
58
60 This adds low-overhead instrumentation to queries, and only emits out‐
61 put data from kernel to user-level if they query exceeds the threshold.
62 If the server query rate is less than 1,000/sec, the overhead is
63 expected to be negligible. If the query rate is higher, test to gauge
64 overhead.
65
67 This is from bcc.
68
69 https://github.com/iovisor/bcc
70
71 Also look in the bcc distribution for a companion _examples.txt file
72 containing example usage, output, and commentary for this tool.
73
75 Linux
76
78 Unstable - in development.
79
81 Sasha Goldshtein, Brendan Gregg
82
84 biosnoop(8), mysqld_qslower(8), dbstat(8)
85
86
87
88USER COMMANDS 2017-02-15 dbslower(8)