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.  Alternativly, MySQL
21       queries can be traced without the USDT support using the -x option.
22
23       Since this uses BPF, only the root user can use this tool.
24

REQUIREMENTS

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

OPTIONS

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

EXAMPLES

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

FIELDS

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

OVERHEAD

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

SOURCE

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

OS

81       Linux
82

STABILITY

84       Unstable - in development.
85

AUTHOR

87       Sasha Goldshtein, Brendan Gregg
88

SEE ALSO

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