1dbslower(8)                 System Manager's Manual                dbslower(8)
2
3
4

NAME

6       dbslower  - Trace MySQL/PostgreSQL server queries slower than a thresh‐
7       old.
8

SYNOPSIS

10       dbslower [-v] [-p PID [PID ...]] [-x PATH] [-m THRESHOLD]  {mysql,post‐
11       gres}
12

DESCRIPTION

14       This  traces queries served by a MySQL or PostgreSQL server, and prints
15       those that exceed a  latency  (query  time)  threshold.  By  default  a
16       threshold of 1 ms is used.
17
18       This  uses  User  Statically-Defined  Tracing  (USDT) probes, a feature
19       added to MySQL and PostgreSQL for DTrace support, but which may not  be
20       enabled  on  a  given  installation.  See requirements.  Alternatively,
21       MySQL queries can be traced without  the  USDT  support  using  the  -x
22       option.
23
24       Since this uses BPF, only the root user can use this tool.
25

REQUIREMENTS

27       CONFIG_BPF, bcc, and MySQL server with USDT probe support (when config‐
28       uring the build: -DENABLE_DTRACE=1)  or  PostgreSQL  server  with  USDT
29       probe support (when configuring the build: --enable-dtrace).
30

OPTIONS

32       -h Print usage message.
33
34       -p PID Trace this PID. If no PID is specified, the tool will attempt to
35              automatically detect the MySQL or PostgreSQL  processes  running
36              on the system.
37
38       -x PATH
39              Path  to  MySQL  binary. This option allow to MySQL queries even
40              when USDT probes aren't enabled on the MySQL server.
41
42       -m THRESHOLD
43              Minimum query latency  (duration)  to  trace,  in  milliseconds.
44              Default is 1 ms.
45
46       {mysql,postgres}
47              The database engine to trace.
48

EXAMPLES

50       Trace MySQL server queries slower than 1 ms:
51              # dbslower mysql
52
53       Trace slower than 10 ms for PostgreSQL in process 408:
54              # dbslower postgres -p 408 -m 10
55

FIELDS

57       TIME(s)
58              Time of query start, in seconds.
59
60       PID    Process ID of the traced server.
61
62       MS     Milliseconds for the query, from start to end.
63
64       QUERY  Query string, truncated to 256 characters.
65

OVERHEAD

67       This  adds low-overhead instrumentation to queries, and only emits out‐
68       put data from kernel to user-level if they query exceeds the threshold.
69       If  the  server  query  rate  is  less  than 1,000/sec, the overhead is
70       expected to be negligible. If the query rate is higher, test  to  gauge
71       overhead.
72

SOURCE

74       This is from bcc.
75
76              https://github.com/iovisor/bcc
77
78       Also  look  in  the bcc distribution for a companion _examples.txt file
79       containing example usage, output, and commentary for this tool.
80

OS

82       Linux
83

STABILITY

85       Unstable - in development.
86

AUTHOR

88       Sasha Goldshtein, Brendan Gregg
89

SEE ALSO

91       biosnoop(8), mysqld_qslower(8), dbstat(8)
92
93
94
95USER COMMANDS                     2017-02-15                       dbslower(8)
Impressum