1dbstat(8) System Manager's Manual dbstat(8)
2
3
4
6 dbstat - Collect histograms of MySQL/PostgreSQL query latencies.
7
9 dbstat [-v] [-p PID [PID ...]] [-m THRESHOLD] [-u] [-i INTERVAL]
10 {mysql,postgres}
11
13 This traces queries served by a MySQL or PostgreSQL server, and col‐
14 lects a histogram of query latencies. The histogram is printed at the
15 end of collection, or at specified intervals.
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 all queries.
38
39 -u Display query latencies in microseconds (default: milliseconds).
40
41 -i INTERVAL
42 Print summaries (histograms) at this interval, specified in sec‐
43 onds.
44
45 {mysql,postgres}
46 The database engine to trace.
47
49 Display histogram of MySQL query latencies:
50 # dbstat mysql
51
52 Display histogram of PostgreSQL query latencies slower than 10ms in pid
53 408:
54 # dbstat postgres -p 408 -m 10
55
56 Display histogram of PostgreSQL query latencies at 3-second intervals:
57 # dbstat postgres -i 3
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
82
84 dbslower(8)
85
86
87
88USER COMMANDS 2017-02-15 dbstat(8)