reference/mysqlnd/stats.xml
55089a115125366b79adbd0f99299d53e561fc10
...
...
@@ -1,1069 +1,1512 @@
1
1
<?xml version="1.0" encoding="utf-8"?>
2
-
<!-- $Revision$ -->
3
-
<chapter xml:id="mysqlnd.stats" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
2
+
<chapter xml:id="mysqlnd.stats" xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude">
4
3
<title>Statistics</title>
5
-
<para>
6
-
<emphasis role="bold">Using Statistical Data</emphasis>
7
-
</para>
4
+

8
5
<para>
9
6
MySQL Native Driver contains support for gathering statistics on the
10
7
communication between the client and the server. The statistics
11
8
gathered are of two main types:
9
+
<itemizedlist>
10
+
<listitem>
11
+
<simpara>Client statistics</simpara>
12
+
</listitem>
13
+
<listitem>
14
+
<simpara>Connection statistics</simpara>
15
+
</listitem>
16
+
</itemizedlist>
12
17
</para>
13
-
<itemizedlist>
14
-
<listitem>
15
-
<para>
16
-
Client statistics
17
-
</para>
18
-
</listitem>
19
-
<listitem>
20
-
<para>
21
-
Connection statistics
22
-
</para>
23
-
</listitem>
24
-
</itemizedlist>
25
18
<para>
26
-
If you are using the <literal>mysqli</literal> extension, these
27
-
statistics can be obtained through two API calls:
19
+
When using the <link linkend="book.mysqli">mysqli</link> extension,
20
+
these statistics can be obtained through two API calls:
21
+
<itemizedlist>
22
+
<listitem>
23
+
<simpara><function>mysqli_get_client_stats</function></simpara>
24
+
</listitem>
25
+
<listitem>
26
+
<simpara><function>mysqli_get_connection_stats</function></simpara>
27
+
</listitem>
28
+
</itemizedlist>
28
29
</para>
29
-
<itemizedlist>
30
-
<listitem>
31
-
<para>
32
-
<function>mysqli_get_client_stats</function>
33
-
</para>
34
-
</listitem>
35
-
<listitem>
36
-
<para>
37
-
<function>mysqli_get_connection_stats</function>
38
-
</para>
39
-
</listitem>
40
-
</itemizedlist>
30
+

41
31
<note>
42
-
<para>
43
-
Statistics are aggregated among all extensions that use MySQL Native
44
-
Driver. For example, when compiling both <literal>ext/mysql</literal>
45
-
and <literal>ext/mysqli</literal> against MySQL Native Driver, both
46
-
function calls of <literal>ext/mysql</literal> and
47
-
<literal>ext/mysqli</literal> will change the statistics. There is no
48
-
way to find out how much a certain API call of any extension that has
49
-
been compiled against MySQL Native Driver has impacted a certain
50
-
statistic. You can configure the PDO MySQL Driver,
51
-
<literal>ext/mysql</literal> and <literal>ext/mysqli</literal> to
52
-
optionally use the MySQL Native Driver. When doing so, all three
53
-
extensions will change the statistics.
54
-
</para>
32
+
<simpara>
33
+
Statistics are aggregated among all extensions that use the MySQL Native
34
+
Driver.
35
+
For example, if the <link linkend="book.mysqli">mysqli</link>
36
+
extension and the PDO MySQL driver are both set-up to use MySQLnd,
37
+
then function calls from <link linkend="book.mysqli">mysqli</link>
38
+
and method calls from PDO will affect the statistics.
39
+
</simpara>
40
+
<simpara>
41
+
There is no way to find out how much a certain API call of any extension
42
+
that has been compiled against MySQL Native Driver has impacted a certain
43
+
statistic.
44
+
</simpara>
55
45
</note>
56
-
<para>
57
-
<emphasis role="bold">Accessing Client Statistics</emphasis>
58
-
</para>
59
-
<para>
60
-
To access client statistics, you need to call
61
-
<function>mysqli_get_client_stats</function>. The function call does
62
-
not require any parameters.
63
-
</para>
64
-
<para>
65
-
The function returns an associative array that contains the name of
66
-
the statistic as the key and the statistical data as the value.
67
-
</para>
68
-
<para>
69
-
Client statistics can also be accessed by calling the
70
-
<function>phpinfo</function> function.
71
-
</para>
72
-
<para>
73
-
<emphasis role="bold">Accessing Connection Statistics</emphasis>
74
-
</para>
75
-
<para>
76
-
To access connection statistics call
77
-
<function>mysqli_get_connection_stats</function>. This takes the
78
-
database connection handle as the parameter.
79
-
</para>
80
-
<para>
81
-
The function returns an associative array that contains the name of
82
-
the statistic as the key and the statistical data as the value.
83
-
</para>
84
-
<para>
85
-
<emphasis role="bold">Buffered and Unbuffered Result Sets</emphasis>
86
-
</para>
87
-
<para>
88
-
Result sets can be buffered or unbuffered. Using default settings,
89
-
<literal>ext/mysql</literal> and <literal>ext/mysqli</literal> work
90
-
with buffered result sets for normal (non prepared statement) queries.
91
-
Buffered result sets are cached on the client. After the query
92
-
execution all results are fetched from the MySQL Server and stored in
93
-
a cache on the client. The big advantage of buffered result sets is
94
-
that they allow the server to free all resources allocated to a result
95
-
set, once the results have been fetched by the client.
96
-
</para>
97
-
<para>
98
-
Unbuffered result sets on the other hand are kept much longer on the
99
-
server. If you want to reduce memory consumption on the client, but
100
-
increase load on the server, use unbuffered results. If you experience
101
-
a high server load and the figures for unbuffered result sets are
102
-
high, you should consider moving the load to the clients. Clients
103
-
typically scale better than servers. <quote>Load</quote> does not only
104
-
refer to memory buffers - the server also needs to keep other
105
-
resources open, for example file handles and threads, before a result
106
-
set can be freed.
107
-
</para>
108
-
<para>
109
-
Prepared Statements use unbuffered result sets by default. However,
110
-
you can use <function>mysqli_stmt_store_result</function> to enable
111
-
buffered result sets.
112
-
</para>
113
-
<para>
114
-
<emphasis role="bold">Statistics returned by MySQL Native
115
-
Driver</emphasis>
116
-
</para>
117
-
<para>
118
-
The following tables show a list of statistics returned by the
119
-
<function>mysqli_get_client_stats</function> and
120
-
<function>mysqli_get_connection_stats</function> functions.
121
-
</para>
122
-
<table xml:id="mysqlnd.stats.returns">
123
-
<title>Returned mysqlnd statistics: Network</title>
124
-
<tgroup cols="4">
125
-
<colspec colwidth="10*"/>
126
-
<colspec colwidth="10*"/>
127
-
<colspec colwidth="40*"/>
128
-
<colspec colwidth="40*"/>
129
-
<thead>
130
-
<row>
131
-
<entry>Statistic</entry>
132
-
<entry>Scope</entry>
133
-
<entry>Description</entry>
134
-
<entry>Notes</entry>
135
-
</row>
136
-
</thead>
137
-
<tbody>
138
-
<row>
139
-
<entry><literal>bytes_sent</literal></entry>
140
-
<entry>Connection</entry>
141
-
<entry>Number of bytes sent from PHP to the MySQL server</entry>
142
-
<entry>Can be used to check the efficiency of the compression protocol</entry>
143
-
</row>
144
-
<row>
145
-
<entry><literal>bytes_received</literal></entry>
146
-
<entry>Connection</entry>
147
-
<entry>Number of bytes received from MySQL server</entry>
148
-
<entry>Can be used to check the efficiency of the compression protocol</entry>
149
-
</row>
150
-
<row>
151
-
<entry><literal>packets_sent</literal></entry>
152
-
<entry>Connection</entry>
153
-
<entry>Number of MySQL Client Server protocol packets sent</entry>
154
-
<entry>Used for debugging Client Server protocol implementation</entry>
155
-
</row>
156
-
<row>
157
-
<entry><literal>packets_received</literal></entry>
158
-
<entry>Connection</entry>
159
-
<entry>Number of MySQL Client Server protocol packets received</entry>
160
-
<entry>Used for debugging Client Server protocol implementation</entry>
161
-
</row>
162
-
<row>
163
-
<entry><literal>protocol_overhead_in</literal></entry>
164
-
<entry>Connection</entry>
165
-
<entry>MySQL Client Server protocol overhead in bytes for incoming traffic.
166
-
Currently only the Packet Header (4 bytes) is considered as
167
-
overhead. protocol_overhead_in = packets_received * 4</entry>
168
-
<entry>Used for debugging Client Server protocol implementation</entry>
169
-
</row>
170
-
<row>
171
-
<entry><literal>protocol_overhead_out</literal></entry>
172
-
<entry>Connection</entry>
173
-
<entry>MySQL Client Server protocol overhead in bytes for outgoing traffic.
174
-
Currently only the Packet Header (4 bytes) is considered as
175
-
overhead. protocol_overhead_out = packets_sent * 4</entry>
176
-
<entry>Used for debugging Client Server protocol implementation</entry>
177
-
</row>
178
-
<row>
179
-
<entry><literal>bytes_received_ok_packet</literal></entry>
180
-
<entry>Connection</entry>
181
-
<entry>Total size of bytes of MySQL Client Server protocol OK packets received.
182
-
OK packets can contain a status message. The length of the status
183
-
message can vary and thus the size of an OK packet is not fixed.</entry>
184
-
<entry>Used for debugging CS protocol implementation. Note that the total size
185
-
in bytes includes the size of the header packet (4 bytes, see
186
-
protocol overhead).</entry>
187
-
</row>
188
-
<row>
189
-
<entry><literal>packets_received_ok</literal></entry>
190
-
<entry>Connection</entry>
191
-
<entry>Number of MySQL Client Server protocol OK packets received.</entry>
192
-
<entry>Used for debugging CS protocol implementation. Note that the total size
193
-
in bytes includes the size of the header packet (4 bytes, see
194
-
protocol overhead).</entry>
195
-
</row>
196
-
<row>
197
-
<entry><literal>bytes_received_eof_packet</literal></entry>
198
-
<entry>Connection</entry>
199
-
<entry>Total size in bytes of MySQL Client Server protocol EOF packets
200
-
received. EOF can vary in size depending on the server version.
201
-
Also, EOF can transport an error message.</entry>
202
-
<entry>Used for debugging CS protocol implementation. Note that the total size
203
-
in bytes includes the size of the header packet (4 bytes, see
204
-
protocol overhead).</entry>
205
-
</row>
206
-
<row>
207
-
<entry><literal>packets_received_eof</literal></entry>
208
-
<entry>Connection</entry>
209
-
<entry>Number of MySQL Client Server protocol EOF packets. Like with other
210
-
packet statistics the number of packets will be increased even if
211
-
PHP does not receive the expected packet but, for example, an
212
-
error message.</entry>
213
-
<entry>Used for debugging CS protocol implementation. Note that the total size
214
-
in bytes includes the size of the header packet (4 bytes, see
215
-
protocol overhead).</entry>
216
-
</row>
217
-
<row>
218
-
<entry><literal>bytes_received_rset_header_packet</literal></entry>
219
-
<entry>Connection</entry>
220
-
<entry>Total size in bytes of MySQL Client Server protocol result set header
221
-
packets. The size of the packets varies depending on the payload
46
+

47
+
<section xml:id="mysqlnd.stats.retrieve" annotations="chunk:false">
48
+
<title>Retrieving statistics</title>
49
+

50
+
<simpara>
51
+
Client statistics can be retrieved by calling the
52
+
<function>mysqli_get_client_stats</function> function.
53
+
</simpara>
54
+

55
+
<simpara>
56
+
Connection statistics can be retrieved by calling the
57
+
<function>mysqli_get_connection_stats</function> function.
58
+
</simpara>
59
+

60
+
<simpara>
61
+
Both functions return an associative array,
62
+
where the name of a statistic is the key for the corresponding
63
+
statistical data.
64
+
</simpara>
65
+
</section>
66
+

67
+
<section xml:id="mysqlnd.stats.statistics" annotations="chunk:false">
68
+
<title>MySQL Native Driver Statistics</title>
69
+
<simpara>
70
+
Most statistics are associated to a connection, but some are associated
71
+
to the process in which case this will be mentioned.
72
+
<!-- Process running the server? -->
73
+
</simpara>
74
+
<simpara>
75
+
The following statistics are produced by the MySQL Native Driver:
76
+
</simpara>
77
+

78
+
<variablelist>
79
+
<title>Network Related Statistics</title>
80
+

81
+
<varlistentry xml:id="mysqlnd.stats.statistics.bytes-sent">
82
+
<term><literal>bytes_sent</literal></term>
83
+
<listitem>
84
+
<simpara>
85
+
Number of bytes sent from PHP to the MySQL server.
86
+
</simpara>
87
+
</listitem>
88
+
</varlistentry>
89
+

90
+
<varlistentry xml:id="mysqlnd.stats.statistics.bytes-received">
91
+
<term><literal>bytes_received</literal></term>
92
+
<listitem>
93
+
<simpara>
94
+
Number of bytes received from the MySQL server.
95
+
</simpara>
96
+
</listitem>
97
+
</varlistentry>
98
+

99
+
<varlistentry xml:id="mysqlnd.stats.statistics.packets-sent">
100
+
<term><literal>packets_sent</literal></term>
101
+
<listitem>
102
+
<simpara>
103
+
Number of packets sent by the MySQL Client Server protocol.
104
+
</simpara>
105
+
</listitem>
106
+
</varlistentry>
107
+

108
+
<varlistentry xml:id="mysqlnd.stats.statistics.packets-received">
109
+
<term><literal>packets_received</literal></term>
110
+
<listitem>
111
+
<simpara>
112
+
Number of packets received from the MySQL Client Server protocol.
113
+
</simpara>
114
+
</listitem>
115
+
</varlistentry>
116
+

117
+
<varlistentry xml:id="mysqlnd.stats.statistics.protocol-overhead-in">
118
+
<term><literal>protocol_overhead_in</literal></term>
119
+
<listitem>
120
+
<simpara>
121
+
MySQL Client Server protocol overhead in bytes for incoming traffic.
122
+
Currently only the Packet Header (4 bytes) is considered as overhead.
123
+
<code>protocol_overhead_in = packets_received * 4</code>
124
+
</simpara>
125
+
</listitem>
126
+
</varlistentry>
127
+

128
+
<varlistentry xml:id="mysqlnd.stats.statistics.protocol-overhead-out">
129
+
<term><literal>protocol_overhead_out</literal></term>
130
+
<listitem>
131
+
<simpara>
132
+
MySQL Client Server protocol overhead in bytes for outgoing traffic.
133
+
Currently only the Packet Header (4 bytes) is considered as overhead.
134
+
<code>protocol_overhead_out = packets_received * 4</code>
135
+
</simpara>
136
+
</listitem>
137
+
</varlistentry>
138
+

139
+
<varlistentry xml:id="mysqlnd.stats.statistics.bytes-received-ok-packet">
140
+
<term><literal>bytes_received_ok_packet</literal></term>
141
+
<listitem>
142
+
<simpara>
143
+
Total size of bytes of MySQL Client Server protocol OK packets received.
144
+
OK packets can contain a status message.
145
+
The length of the status message can vary and thus the size of an OK
146
+
packet is not fixed.
147
+
</simpara>
148
+
<note>
149
+
<simpara>
150
+
The total size in bytes includes the size of the header packet
151
+
(4 bytes, see protocol overhead).
152
+
</simpara>
153
+
</note>
154
+
</listitem>
155
+
</varlistentry>
156
+

157
+
<varlistentry xml:id="mysqlnd.stats.statistics.packets-received-ok">
158
+
<term><literal>packets_received_ok</literal></term>
159
+
<listitem>
160
+
<simpara>
161
+
Number of MySQL Client Server protocol OK packets received.
162
+
</simpara>
163
+
</listitem>
164
+
</varlistentry>
165
+

166
+
<varlistentry xml:id="mysqlnd.stats.statistics.bytes-received-eof-packet">
167
+
<term><literal>bytes_received_eof_packet</literal></term>
168
+
<listitem>
169
+
<simpara>
170
+
Total size in bytes of MySQL Client Server protocol EOF packets received.
171
+
EOF can vary in size depending on the server version.
172
+
Also, EOF can transport an error message.
173
+
</simpara>
174
+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('mysqlnd.stats.statistics.bytes-received-ok-packet')/db:listitem/db:note)">
175
+
<xi:fallback/>
176
+
</xi:include>
177
+
</listitem>
178
+
</varlistentry>
179
+

180
+
<varlistentry xml:id="mysqlnd.stats.statistics.packets-received-eof">
181
+
<term><literal>packets_received_eof</literal></term>
182
+
<listitem>
183
+
<simpara>
184
+
Number of MySQL Client Server protocol EOF packets.
185
+
</simpara>
186
+
<simpara>
187
+
Like with other packet statistics the number of packets will be
188
+
increased even if PHP does not receive the expected packet but,
189
+
for example, an error message.
190
+
</simpara>
191
+
</listitem>
192
+
</varlistentry>
193
+

194
+
<varlistentry xml:id="mysqlnd.stats.statistics.bytes-received-rset-header-packet">
195
+
<term><literal>bytes_received_rset_header_packet</literal></term>
196
+
<listitem>
197
+
<simpara>
198
+
Total size in bytes of MySQL Client Server protocol result set header
199
+
packets.
200
+
The size of the packets varies depending on the payload
222
201
(<literal>LOAD LOCAL INFILE</literal>, <literal>INSERT</literal>,
223
-
<literal>UPDATE</literal>, <literal>SELECT</literal>, error
224
-
message).</entry>
225
-
<entry>Used for debugging CS protocol implementation. Note that the total size
226
-
in bytes includes the size of the header packet (4 bytes, see
227
-
protocol overhead).</entry>
228
-
</row>
229
-
<row>
230
-
<entry><literal>packets_received_rset_header</literal></entry>
231
-
<entry>Connection</entry>
232
-
<entry>Number of MySQL Client Server protocol result set header packets.</entry>
233
-
<entry>Used for debugging CS protocol implementation. Note that the total size
234
-
in bytes includes the size of the header packet (4 bytes, see
235
-
protocol overhead).</entry>
236
-
</row>
237
-
<row>
238
-
<entry><literal>bytes_received_rset_field_meta_packet</literal></entry>
239
-
<entry>Connection</entry>
240
-
<entry>Total size in bytes of MySQL Client Server protocol result set meta data
241
-
(field information) packets. Of course the size varies with the
242
-
fields in the result set. The packet may also transport an error
243
-
or an EOF packet in case of COM_LIST_FIELDS.</entry>
244
-
<entry>Only useful for debugging CS protocol implementation. Note that the
245
-
total size in bytes includes the size of the header packet (4
246
-
bytes, see protocol overhead).</entry>
247
-
</row>
248
-
<row>
249
-
<entry><literal>packets_received_rset_field_meta</literal></entry>
250
-
<entry>Connection</entry>
251
-
<entry>Number of MySQL Client Server protocol result set meta data (field
252
-
information) packets.</entry>
253
-
<entry>Only useful for debugging CS protocol implementation. Note that the
254
-
total size in bytes includes the size of the header packet (4
255
-
bytes, see protocol overhead).</entry>
256
-
</row>
257
-
<row>
258
-
<entry><literal>bytes_received_rset_row_packet</literal></entry>
259
-
<entry>Connection</entry>
260
-
<entry>Total size in bytes of MySQL Client Server protocol result set row data
261
-
packets. The packet may also transport an error or an EOF packet.
262
-
You can reverse engineer the number of error and EOF packets by
263
-
subtracting <literal>rows_fetched_from_server_normal</literal>
264
-
and <literal>rows_fetched_from_server_ps</literal> from
265
-
<literal>bytes_received_rset_row_packet</literal>.</entry>
266
-
<entry>Only useful for debugging CS protocol implementation. Note that the
267
-
total size in bytes includes the size of the header packet (4
268
-
bytes, see protocol overhead).</entry>
269
-
</row>
270
-
<row>
271
-
<entry><literal>packets_received_rset_row</literal></entry>
272
-
<entry>Connection</entry>
273
-
<entry>Number of MySQL Client Server protocol result set row data packets and
274
-
their total size in bytes.</entry>
275
-
<entry>Only useful for debugging CS protocol implementation. Note that the
276
-
total size in bytes includes the size of the header packet (4
277
-
bytes, see protocol overhead).</entry>
278
-
</row>
279
-
<row>
280
-
<entry><literal>bytes_received_prepare_response_packet</literal></entry>
281
-
<entry>Connection</entry>
282
-
<entry>Total size in bytes of MySQL Client Server protocol OK for Prepared
283
-
Statement Initialization packets (prepared statement init
284
-
packets). The packet may also transport an error. The packet size
285
-
depends on the MySQL version: 9 bytes with MySQL 4.1 and 12 bytes
286
-
from MySQL 5.0 on. There is no safe way to know how many errors
287
-
happened. You may be able to guess that an error has occurred if,
288
-
for example, you always connect to MySQL 5.0 or newer and,
289
-
<literal>bytes_received_prepare_response_packet</literal> !=
290
-
<literal>packets_received_prepare_response</literal> * 12. See
291
-
also <literal>ps_prepared_never_executed</literal>,
292
-
<literal>ps_prepared_once_executed</literal>.</entry>
293
-
<entry>Only useful for debugging CS protocol implementation. Note that the
294
-
total size in bytes includes the size of the header packet (4
295
-
bytes, see protocol overhead).</entry>
296
-
</row>
297
-
<row>
298
-
<entry><literal>packets_received_prepare_response</literal></entry>
299
-
<entry>Connection</entry>
300
-
<entry>Number of MySQL Client Server protocol OK for Prepared Statement
301
-
Initialization packets (prepared statement init packets).</entry>
302
-
<entry>Only useful for debugging CS protocol implementation. Note that the
303
-
total size in bytes includes the size of the header packet (4
304
-
bytes, see protocol overhead).</entry>
305
-
</row>
306
-
<row>
307
-
<entry><literal>bytes_received_change_user_packet</literal></entry>
308
-
<entry>Connection</entry>
309
-
<entry>Total size in bytes of MySQL Client Server protocol COM_CHANGE_USER
310
-
packets. The packet may also transport an error or EOF.</entry>
311
-
<entry>Only useful for debugging CS protocol implementation. Note that the
312
-
total size in bytes includes the size of the header packet (4
313
-
bytes, see protocol overhead).</entry>
314
-
</row>
315
-
<row>
316
-
<entry><literal>packets_received_change_user</literal></entry>
317
-
<entry>Connection</entry>
318
-
<entry>Number of MySQL Client Server protocol COM_CHANGE_USER packets</entry>
319
-
<entry>Only useful for debugging CS protocol implementation. Note that the
320
-
total size in bytes includes the size of the header packet (4
321
-
bytes, see protocol overhead).</entry>
322
-
</row>
323
-
<row>
324
-
<entry><literal>packets_sent_command</literal></entry>
325
-
<entry>Connection</entry>
326
-
<entry>Number of MySQL Client Server protocol commands sent from PHP to MySQL.
202
+
<literal>UPDATE</literal>, <literal>SELECT</literal>, error message).
203
+
</simpara>
204
+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('mysqlnd.stats.statistics.bytes-received-ok-packet')/db:listitem/db:note)">
205
+
<xi:fallback/>
206
+
</xi:include>
207
+
</listitem>
208
+
</varlistentry>
209
+

210
+
<varlistentry xml:id="mysqlnd.stats.statistics.packets-received-rset-header">
211
+
<term><literal>packets_received_rset_header</literal></term>
212
+
<listitem>
213
+
<simpara>
214
+
Number of MySQL Client Server protocol result set header packets.
215
+
</simpara>
216
+
</listitem>
217
+
</varlistentry>
218
+

219
+
<varlistentry xml:id="mysqlnd.stats.statistics.bytes-received-rset-field-meta-packet">
220
+
<term><literal>bytes_received_rset_field_meta_packet</literal></term>
221
+
<listitem>
222
+
<simpara>
223
+
Total size in bytes of MySQL Client Server protocol result set metadata
224
+
(field information) packets.
225
+
Of course the size varies with the fields in the result set.
226
+
The packet may also transport an error or an EOF packet in case of
227
+
COM_LIST_FIELDS.
228
+
</simpara>
229
+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('mysqlnd.stats.statistics.bytes-received-ok-packet')/db:listitem/db:note)">
230
+
<xi:fallback/>
231
+
</xi:include>
232
+
</listitem>
233
+
</varlistentry>
234
+

235
+
<varlistentry xml:id="mysqlnd.stats.statistics.packets-received-rset-field-meta">
236
+
<term><literal>packets_received_rset_field_meta</literal></term>
237
+
<listitem>
238
+
<simpara>
239
+
Number of MySQL Client Server protocol result set metadata
240
+
(field information) packets.
241
+
</simpara>
242
+
</listitem>
243
+
</varlistentry>
244
+

245
+
<varlistentry xml:id="mysqlnd.stats.statistics.bytes-received-rset-row-packet">
246
+
<term><literal>bytes_received_rset_row_packet</literal></term>
247
+
<listitem>
248
+
<simpara>
249
+
Total size in bytes of MySQL Client Server protocol result set row data
250
+
packets.
251
+
The packet may also transport an error or an EOF packet.
252
+
One can compute the number of error and EOF packets by subtracting
253
+
<literal>rows_fetched_from_server_normal</literal>
254
+
and <literal>rows_fetched_from_server_ps</literal>
255
+
from <literal>bytes_received_rset_row_packet</literal>.
256
+
</simpara>
257
+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('mysqlnd.stats.statistics.bytes-received-ok-packet')/db:listitem/db:note)">
258
+
<xi:fallback/>
259
+
</xi:include>
260
+
</listitem>
261
+
</varlistentry>
262
+

263
+
<varlistentry xml:id="mysqlnd.stats.statistics.packets-received-rset-row">
264
+
<term><literal>packets_received_rset_row</literal></term>
265
+
<listitem>
266
+
<simpara>
267
+
Number of MySQL Client Server protocol result set row data packets.
268
+
</simpara>
269
+
</listitem>
270
+
</varlistentry>
271
+

272
+
<varlistentry xml:id="mysqlnd.stats.statistics.bytes-received-prepare-response-packet">
273
+
<term><literal>bytes_received_prepare_response_packet</literal></term>
274
+
<listitem>
275
+
<simpara>
276
+
Total size in bytes of MySQL Client Server protocol OK for Prepared
277
+
Statement Initialization packets (prepared statement init packets).
278
+
The packet may also transport an error.
279
+
The packet size depends on the MySQL version.
280
+
</simpara>
281
+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('mysqlnd.stats.statistics.bytes-received-ok-packet')/db:listitem/db:note)">
282
+
<xi:fallback/>
283
+
</xi:include>
284
+
</listitem>
285
+
</varlistentry>
286
+

287
+
<varlistentry xml:id="mysqlnd.stats.statistics.packets-received-prepare-response">
288
+
<term><literal>packets_received_prepare_response</literal></term>
289
+
<listitem>
290
+
<simpara>
291
+
Number of MySQL Client Server protocol OK for Prepared Statement
292
+
Initialization packets (prepared statement init packets).
293
+
</simpara>
294
+
</listitem>
295
+
</varlistentry>
296
+

297
+
<varlistentry xml:id="mysqlnd.stats.statistics.bytes-received-change-user-packet">
298
+
<term><literal>bytes_received_change_user_packet</literal></term>
299
+
<listitem>
300
+
<simpara>
301
+
Total size in bytes of MySQL Client Server protocol COM_CHANGE_USER packets.
302
+
The packet may also transport an error or EOF.
303
+
</simpara>
304
+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('mysqlnd.stats.statistics.bytes-received-ok-packet')/db:listitem/db:note)">
305
+
<xi:fallback/>
306
+
</xi:include>
307
+
</listitem>
308
+
</varlistentry>
309
+

310
+
<varlistentry xml:id="mysqlnd.stats.statistics.packets-received-change-user">
311
+
<term><literal>packets_received_change_user</literal></term>
312
+
<listitem>
313
+
<simpara>
314
+
Number of MySQL Client Server protocol COM_CHANGE_USER packets.
315
+
</simpara>
316
+
</listitem>
317
+
</varlistentry>
318
+

319
+
<varlistentry xml:id="mysqlnd.stats.statistics.packets-sent-command">
320
+
<term><literal>packets_sent_command</literal></term>
321
+
<listitem>
322
+
<simpara>
323
+
Number of MySQL Client Server protocol commands sent from PHP to MySQL.
324
+
</simpara>
325
+
<simpara>
327
326
There is no way to know which specific commands and how many of
328
-
them have been sent. At its best you can use it to check if PHP
329
-
has sent any commands to MySQL to know if you can consider to
330
-
disable MySQL support in your PHP binary. There is also no way to
331
-
reverse engineer the number of errors that may have occurred while
332
-
sending data to MySQL. The only error that is recorded is
333
-
command_buffer_too_small (see below).</entry>
334
-
<entry>Only useful for debugging CS protocol implementation.</entry>
335
-
</row>
336
-
<row>
337
-
<entry><literal>bytes_received_real_data_normal</literal></entry>
338
-
<entry>Connection</entry>
339
-
<entry>Number of bytes of payload fetched by the PHP client from
340
-
<literal>mysqlnd</literal> using the text protocol.</entry>
341
-
<entry>This is the size of the actual data contained in result sets that do not
342
-
originate from prepared statements and which have been fetched by
343
-
the PHP client. Note that although a full result set may have been
344
-
pulled from MySQL by <literal>mysqlnd</literal>, this statistic
345
-
only counts actual data pulled from <literal>mysqlnd</literal> by
346
-
the PHP client. An example of a code sequence that will increase
347
-
the value is as follows:
348
-
<programlisting>
327
+
them have been sent.
328
+
</simpara>
329
+
</listitem>
330
+
</varlistentry>
331
+

332
+
<varlistentry xml:id="mysqlnd.stats.statistics.bytes-received-real-data_normal">
333
+
<term><literal>bytes_received_real_data_normal</literal></term>
334
+
<listitem>
335
+
<simpara>
336
+
Number of bytes of payload fetched by the PHP client from
337
+
<literal>mysqlnd</literal> using the text protocol.
338
+
</simpara>
339
+
<simpara>
340
+
This is the size of the actual data contained in result sets that do not
341
+
originate from prepared statements and which have been fetched by the PHP client.
342
+
</simpara>
343
+
<simpara>
344
+
Note that although a full result set may have been pulled from MySQL
345
+
by <literal>mysqlnd</literal>, this statistic only counts actual data
346
+
pulled from <literal>mysqlnd</literal> by the PHP client.
347
+
</simpara>
348
+
<para>
349
+
An example of a code sequence that will increase the value is as follows:
350
+
<programlisting>
349
351
<![CDATA[
350
352
$mysqli = new mysqli();
351
353
$res = $mysqli->query("SELECT 'abc'");
352
354
$res->fetch_assoc();
353
355
$res->close();
354
356
]]>
355
-
</programlisting>
356
-
<para>
357
-
Every fetch operation will increase the value.
358
-
</para>
359
-

360
-
<para>
361
-
The statistic will not be increased if the result set is only
362
-
buffered on the client, but not fetched, such as in the following
363
-
example:
364
-
</para>
365
-
<programlisting>
357
+
</programlisting>
358
+
Every fetch operation will increase the value.
359
+
</para>
360
+
<para>
361
+
However, the statistic will not be increased if the result set is only
362
+
buffered on the client, but not fetched, such as in the following example:
363
+
<programlisting>
366
364
<![CDATA[
367
365
$mysqli = new mysqli();
368
366
$res = $mysqli->query("SELECT 'abc'");
369
367
$res->close();
370
368
]]>
371
-
</programlisting>
372
-
</entry>
373
-
</row>
374
-
<row>
375
-
<entry><literal>bytes_received_real_data_ps</literal></entry>
376
-
<entry>Connection</entry>
377
-
<entry>Number of bytes of the payload fetched by the PHP client from
378
-
<literal>mysqlnd</literal> using the prepared statement protocol.</entry>
379
-
<entry>This is the size of the actual data contained in result sets that
380
-
originate from prepared statements and which has been fetched by
381
-
the PHP client. The value will not be increased if the result set
382
-
is not subsequently read by the PHP client. Note that although a
383
-
full result set may have been pulled from MySQL by
384
-
<literal>mysqlnd</literal>, this statistic only counts actual data
385
-
pulled from <literal>mysqlnd</literal> by the PHP client. See also
386
-
<literal>bytes_received_real_data_normal</literal>.</entry>
387
-
</row>
388
-
</tbody>
389
-
</tgroup>
390
-
</table>
391
-
<para>
392
-
<emphasis role="bold">Result Set</emphasis>
393
-
</para>
394
-
<table xml:id="mysqlnd.stats.results">
395
-
<title>Returned mysqlnd statistics: Result Set</title>
396
-
<tgroup cols="4">
397
-
<colspec colwidth="10*"/>
398
-
<colspec colwidth="10*"/>
399
-
<colspec colwidth="40*"/>
400
-
<colspec colwidth="40*"/>
401
-
<thead>
402
-
<row>
403
-
<entry>Statistic</entry>
404
-
<entry>Scope</entry>
405
-
<entry>Description</entry>
406
-
<entry>Notes</entry>
407
-
</row>
408
-
</thead>
409
-
<tbody>
410
-
<row>
411
-
<entry><literal>result_set_queries</literal></entry>
412
-
<entry>Connection</entry>
413
-
<entry>Number of queries that have generated a result set. Examples of queries
414
-
that generate a result set: <literal>SELECT</literal>,
415
-
<literal>SHOW</literal>. The statistic will not be incremented if
416
-
there is an error reading the result set header packet from the
417
-
line.</entry>
418
-
<entry>You may use it as an indirect measure for the number of queries PHP has
419
-
sent to MySQL, for example, to identify a client that causes a
420
-
high database load.</entry>
421
-
</row>
422
-
<row>
423
-
<entry><literal>non_result_set_queries</literal></entry>
424
-
<entry>Connection</entry>
425
-
<entry>Number of queries that did not generate a result set. Examples of
426
-
queries that do not generate a result set:
427
-
<literal>INSERT</literal>, <literal>UPDATE</literal>,
428
-
<literal>LOAD DATA</literal>. The
429
-
statistic will not be incremented if there is an error reading the
430
-
result set header packet from the line.</entry>
431
-
<entry>You may use it as an indirect measure for the number of queries PHP has
432
-
sent to MySQL, for example, to identify a client that causes a
433
-
high database load.</entry>
434
-
</row>
435
-
<row>
436
-
<entry><literal>no_index_used</literal></entry>
437
-
<entry>Connection</entry>
438
-
<entry>Number of queries that have generated a result set but did not use an
439
-
index (see also mysqld start option
440
-
–log-queries-not-using-indexes). If you want these queries to be
441
-
reported you can use mysqli_report(MYSQLI_REPORT_INDEX) to make
442
-
ext/mysqli throw an exception. If you prefer a warning instead of
443
-
an exception use mysqli_report(MYSQLI_REPORT_INDEX ^
444
-
MYSQLI_REPORT_STRICT).</entry>
445
-
<entry></entry>
446
-
</row>
447
-
<row>
448
-
<entry><literal>bad_index_used</literal></entry>
449
-
<entry>Connection</entry>
450
-
<entry>Number of queries that have generated a result set and did not use a
451
-
good index (see also mysqld start option –log-slow-queries).</entry>
452
-
<entry>If you want these queries to be reported you can use
453
-
mysqli_report(MYSQLI_REPORT_INDEX) to make ext/mysqli throw an
454
-
exception. If you prefer a warning instead of an exception use
455
-
mysqli_report(MYSQLI_REPORT_INDEX ^ MYSQLI_REPORT_STRICT)</entry>
456
-
</row>
457
-
<row>
458
-
<entry><literal>slow_queries</literal></entry>
459
-
<entry>Connection</entry>
460
-
<entry>SQL statements that took more than <literal>long_query_time</literal>
369
+
</programlisting>
370
+
</para>
371
+
</listitem>
372
+
</varlistentry>
373
+

374
+
<varlistentry xml:id="mysqlnd.stats.statistics.bytes-received-real-data-ps">
375
+
<term><literal>bytes_received_real_data_ps</literal></term>
376
+
<listitem>
377
+
<simpara>
378
+
Number of bytes of the payload fetched by the PHP client from
379
+
<literal>mysqlnd</literal> using the prepared statement protocol.
380
+
</simpara>
381
+
<simpara>
382
+
This is the size of the actual data contained in result sets that
383
+
originate from prepared statements and which have been fetched by the PHP client.
384
+
</simpara>
385
+
<simpara>
386
+
The value will not be increased if the result set is not subsequently read by the PHP client.
387
+
</simpara>
388
+
<simpara>
389
+
Note that although a full result set may have been pulled from MySQL
390
+
by <literal>mysqlnd</literal>, this statistic only counts actual data
391
+
pulled from <literal>mysqlnd</literal> by the PHP client.
392
+
</simpara>
393
+
<simpara>
394
+
See also <literal>bytes_received_real_data_normal</literal>.
395
+
</simpara>
396
+
</listitem>
397
+
</varlistentry>
398
+
</variablelist>
399
+

400
+
<variablelist>
401
+
<title>Result Set Related Statistics</title>
402
+

403
+
<varlistentry xml:id="mysqlnd.stats.statistics.result-set-queries">
404
+
<term><literal>result_set_queries</literal></term>
405
+
<listitem>
406
+
<simpara>
407
+
Number of queries that have generated a result set.
408
+
Examples of queries that generate a result set:
409
+
<literal>SELECT</literal>, <literal>SHOW</literal>.
410
+
</simpara>
411
+
<simpara>
412
+
The statistic will not be incremented if there is an error reading
413
+
the result set header packet from the line.
414
+
</simpara>
415
+
<note>
416
+
<simpara>
417
+
This statistic can be used as an indirect measure for the number of
418
+
queries PHP has sent to MySQL.
419
+
This could help identifying a client that causes a high database load.
420
+
</simpara>
421
+
</note>
422
+
</listitem>
423
+
</varlistentry>
424
+

425
+
<varlistentry xml:id="mysqlnd.stats.statistics.non-result-set-queries">
426
+
<term><literal>non_result_set_queries</literal></term>
427
+
<listitem>
428
+
<simpara>
429
+
Number of queries that did not generate a result set.
430
+
Examples of queries that do not generate a result set:
431
+
<literal>INSERT</literal>, <literal>UPDATE</literal>, <literal>LOAD DATA</literal>.
432
+
</simpara>
433
+
<simpara>
434
+
The statistic will not be incremented if there is an error reading
435
+
the result set header packet from the line.
436
+
</simpara>
437
+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('mysqlnd.stats.statistics.result-set-queries')/db:listitem/db:note)">
438
+
<xi:fallback/>
439
+
</xi:include>
440
+
</listitem>
441
+
</varlistentry>
442
+

443
+
<varlistentry xml:id="mysqlnd.stats.statistics.no-index-used">
444
+
<term><literal>no_index_used</literal></term>
445
+
<listitem>
446
+
<simpara>
447
+
Number of queries that have generated a result set but did not use an index.
448
+
(See also the mysqld start option <literal>--log-queries-not-using-indexes</literal>).
449
+
</simpara>
450
+
<note>
451
+
<simpara>
452
+
Those queries can be reported via an exception by calling
453
+
<code>mysqli_report(MYSQLI_REPORT_INDEX);</code>.
454
+
It is possible to have them be reported via a warning instead by calling
455
+
<code>mysqli_report(MYSQLI_REPORT_INDEX ^ MYSQLI_REPORT_STRICT);</code>.
456
+
</simpara>
457
+
</note>
458
+
</listitem>
459
+
</varlistentry>
460
+

461
+
<varlistentry xml:id="mysqlnd.stats.statistics.bad-index-used">
462
+
<term><literal>bad_index_used</literal></term>
463
+
<listitem>
464
+
<simpara>
465
+
Number of queries that have generated a result set and did not use a good index.
466
+
(See also the mysqld start option <literal>--log-slow-queries</literal>).
467
+
</simpara>
468
+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('mysqlnd.stats.statistics.no-index-used')/db:listitem/db:note)">
469
+
<xi:fallback/>
470
+
</xi:include>
471
+
</listitem>
472
+
</varlistentry>
473
+

474
+
<varlistentry xml:id="mysqlnd.stats.statistics.slow-queries">
475
+
<term><literal>slow_queries</literal></term>
476
+
<listitem>
477
+
<simpara>
478
+
SQL statements that took more than <literal>long_query_time</literal>
461
479
seconds to execute and required at least
462
-
<literal>min_examined_row_limit</literal> rows to be examined.</entry>
463
-
<entry>Not reported through <function>mysqli_report</function></entry>
464
-
</row>
465
-
<row>
466
-
<entry><literal>buffered_sets</literal></entry>
467
-
<entry>Connection</entry>
468
-
<entry>Number of buffered result sets returned by <quote>normal</quote>
469
-
queries. <quote>Normal</quote> means <quote>not prepared
470
-
statement</quote> in the following notes.</entry>
471
-
<entry>Examples of API calls that will buffer result sets on the client:
472
-
<function>mysql_query</function>,
473
-
<function>mysqli_query</function>,
474
-
<function>mysqli_store_result</function>,
475
-
<function>mysqli_stmt_get_result</function>. Buffering result sets
476
-
on the client ensures that server resources are freed as soon as
477
-
possible and it makes result set scrolling easier. The downside is
478
-
the additional memory consumption on the client for buffering
479
-
data. Note that mysqlnd (unlike the MySQL Client Library) respects
480
-
the PHP memory limit because it uses PHP internal memory
481
-
management functions to allocate memory. This is also the reason
482
-
why <function>memory_get_usage</function> reports a higher memory
483
-
consumption when using mysqlnd instead of the MySQL Client
484
-
Library. <function>memory_get_usage</function> does not measure
485
-
the memory consumption of the MySQL Client Library at all because
486
-
the MySQL Client Library does not use PHP internal memory
487
-
management functions monitored by the function!</entry>
488
-
</row>
489
-
<row>
490
-
<entry><literal>unbuffered_sets</literal></entry>
491
-
<entry>Connection</entry>
492
-
<entry>Number of unbuffered result sets returned by normal (non prepared
493
-
statement) queries.</entry>
494
-
<entry>Examples of API calls that will not buffer result sets on the client:
495
-
<function>mysqli_use_result</function></entry>
496
-
</row>
497
-
<row>
498
-
<entry><literal>ps_buffered_sets</literal></entry>
499
-
<entry>Connection</entry>
500
-
<entry>Number of buffered result sets returned by prepared statements. By
501
-
default prepared statements are unbuffered.</entry>
502
-
<entry>Examples of API calls that will buffer result sets on the client:
503
-
<literal>mysqli_stmt_store_result</literal></entry>
504
-
</row>
505
-
<row>
506
-
<entry><literal>ps_unbuffered_sets</literal></entry>
507
-
<entry>Connection</entry>
508
-
<entry>Number of unbuffered result sets returned by prepared statements.</entry>
509
-
<entry>By default prepared statements are unbuffered.</entry>
510
-
</row>
511
-
<row>
512
-
<entry><literal>flushed_normal_sets</literal></entry>
513
-
<entry>Connection</entry>
514
-
<entry>Number of result sets from normal (non prepared statement) queries with
515
-
unread data which have been flushed silently for you. Flushing
516
-
happens only with unbuffered result sets.</entry>
517
-
<entry>Unbuffered result sets must be fetched completely before a new query can
518
-
be run on the connection otherwise MySQL will throw an error. If
519
-
the application does not fetch all rows from an unbuffered result
520
-
set, mysqlnd does implicitly fetch the result set to clear the
521
-
line. See also <literal>rows_skipped_normal</literal>,
522
-
<literal>rows_skipped_ps</literal>. Some possible causes for an
523
-
implicit flush:
524
-
<itemizedlist>
525
-
<listitem>
526
-
<para>
527
-
Faulty client application
528
-
</para>
529
-
</listitem>
530
-
<listitem>
531
-
<para>
532
-
Client stopped reading after it found what it was looking for
533
-
but has made MySQL calculate more records than needed
534
-
</para>
535
-
</listitem>
536
-
<listitem>
537
-
<para>
538
-
Client application has stopped unexpectedly
539
-
</para>
540
-
</listitem>
541
-
</itemizedlist></entry>
542
-
</row>
543
-
<row>
544
-
<entry><literal>flushed_ps_sets</literal></entry>
545
-
<entry>Connection</entry>
546
-
<entry>Number of result sets from prepared statements with unread data which
547
-
have been flushed silently for you. Flushing happens only with
548
-
unbuffered result sets.</entry>
549
-
<entry>Unbuffered result sets must be fetched completely before a new query can
550
-
be run on the connection otherwise MySQL will throw an error. If
551
-
the application does not fetch all rows from an unbuffered result
552
-
set, mysqlnd does implicitly fetch the result set to clear the
553
-
line. See also <literal>rows_skipped_normal</literal>,
554
-
<literal>rows_skipped_ps</literal>. Some possible causes for an
555
-
implicit flush:
480
+
<literal>min_examined_row_limit</literal> rows to be examined.
481
+
</simpara>
482
+
<caution>
483
+
<simpara>
484
+
Not reported through <function>mysqli_report</function>.
485
+
</simpara>
486
+
</caution>
487
+
</listitem>
488
+
</varlistentry>
489
+

490
+
<varlistentry xml:id="mysqlnd.stats.statistics.buffered-sets">
491
+
<term><literal>buffered_sets</literal></term>
492
+
<listitem>
493
+
<simpara>
494
+
Number of buffered result sets returned by normal
495
+
(i.e. not via a prepared statement) queries.
496
+
</simpara>
497
+
<para>
498
+
Examples of API calls that will buffer result sets on the client:
499
+
<simplelist type="inline">
500
+
<member><function>mysqli_query</function></member>
501
+
<member><function>mysqli_store_result</function></member>
502
+
<member><function>mysqli_stmt_get_result</function></member>
503
+
</simplelist>
504
+
</para>
505
+
</listitem>
506
+
</varlistentry>
507
+

508
+
<varlistentry xml:id="mysqlnd.stats.statistics.unbuffered-sets">
509
+
<term><literal>unbuffered_sets</literal></term>
510
+
<listitem>
511
+
<simpara>
512
+
Number of unbuffered result sets returned by normal
513
+
(i.e. not via a prepared statement) queries.
514
+
</simpara>
515
+
<para>
516
+
Examples of API calls that will not buffer result sets on the client:
517
+
<simplelist type="inline">
518
+
<member><function>mysqli_use_result</function></member>
519
+
</simplelist>
520
+
</para>
521
+
</listitem>
522
+
</varlistentry>
523
+

524
+
<varlistentry xml:id="mysqlnd.stats.statistics.ps-buffered-sets">
525
+
<term><literal>ps_buffered_sets</literal></term>
526
+
<listitem>
527
+
<simpara>
528
+
Number of buffered result sets returned by prepared statements.
529
+
</simpara>
530
+
<para>
531
+
Examples of API calls that will buffer result sets on the client:
532
+
<simplelist type="inline">
533
+
<member><function>mysqli_stmt_store_result</function></member>
534
+
</simplelist>
535
+
</para>
536
+
</listitem>
537
+
</varlistentry>
538
+

539
+
<varlistentry xml:id="mysqlnd.stats.statistics.ps-unbuffered-sets">
540
+
<term><literal>ps_unbuffered_sets</literal></term>
541
+
<listitem>
542
+
<simpara>
543
+
Number of unbuffered result sets returned by prepared statements.
544
+
</simpara>
545
+
<simpara>
546
+
By default prepared statements are unbuffered,
547
+
thus most prepared statements will be accounted in this statistic.
548
+
</simpara>
549
+
</listitem>
550
+
</varlistentry>
551
+

552
+
<varlistentry xml:id="mysqlnd.stats.statistics.flushed-normal-sets">
553
+
<term><literal>flushed_normal_sets</literal></term>
554
+
<listitem>
555
+
<simpara>
556
+
Number of result sets returned by normal
557
+
(i.e. not via a prepared statement) queries
558
+
with unread data that have been silently flushed.
559
+
</simpara>
560
+

561
+
<note>
562
+
<simpara>
563
+
Flushing happens only with unbuffered result sets.
564
+
</simpara>
565
+
<simpara>
566
+
Unbuffered result sets must be fetched completely before a new query can
567
+
be run on the connection otherwise MySQL will throw an error.
568
+
If the application does not fetch all rows from an unbuffered result set,
569
+
mysqlnd does implicitly fetch the result set to clear the line.
570
+
</simpara>
571
+
<simpara>
572
+
See also <literal>rows_skipped_normal</literal>, <literal>rows_skipped_ps</literal>.
573
+
</simpara>
574
+
<para>
575
+
Some possible causes for an implicit flush:
576
+
<itemizedlist>
577
+
<listitem>
578
+
<simpara>
579
+
Faulty client application
580
+
</simpara>
581
+
</listitem>
582
+
<listitem>
583
+
<simpara>
584
+
Client stopped reading after it found what it was looking for
585
+
but has made MySQL calculate more records than needed
586
+
</simpara>
587
+
</listitem>
588
+
<listitem>
589
+
<simpara>
590
+
Client application has stopped unexpectedly
591
+
</simpara>
592
+
</listitem>
593
+
</itemizedlist>
594
+
</para>
595
+
</note>
596
+
</listitem>
597
+
</varlistentry>
598
+

599
+
<varlistentry xml:id="mysqlnd.stats.statistics.flushed-ps-sets">
600
+
<term><literal>flushed_ps_sets</literal></term>
601
+
<listitem>
602
+
<simpara>
603
+
Number of result sets from prepared statements
604
+
with unread data that have been silently flushed.
605
+
</simpara>
606
+

607
+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('mysqlnd.stats.statistics.flushed-normal-sets')/db:listitem/db:note)">
608
+
<xi:fallback/>
609
+
</xi:include>
610
+
</listitem>
611
+
</varlistentry>
612
+

613
+
<varlistentry xml:id="mysqlnd.stats.statistics.ps-prepared-never-executed">
614
+
<term><literal>ps_prepared_never_executed</literal></term>
615
+
<listitem>
616
+
<simpara>
617
+
Number of statements prepared but never executed.
618
+
</simpara>
619
+
</listitem>
620
+
</varlistentry>
621
+

622
+
<varlistentry xml:id="mysqlnd.stats.statistics.ps-prepared-once-executed">
623
+
<term><literal>ps_prepared_once_executed</literal></term>
624
+
<listitem>
625
+
<simpara>
626
+
Number of prepared statements executed only once.
627
+
</simpara>
628
+
</listitem>
629
+
</varlistentry>
630
+

631
+
<varlistentry xml:id="mysqlnd.stats.statistics.rows-fetched-from-server-normal">
632
+
<term><literal>rows_fetched_from_server_normal</literal></term>
633
+
<term><literal>rows_fetched_from_server_ps</literal></term>
634
+
<listitem>
635
+
<simpara>
636
+
Total number of result set rows fetched from the server.
637
+
This includes the rows which were not read by the client but
638
+
had been implicitly fetched due to flushed unbuffered result sets.
639
+
</simpara>
640
+
<simpara>
641
+
See also <literal>packets_received_rset_row</literal>.
642
+
</simpara>
643
+
</listitem>
644
+
</varlistentry>
645
+

646
+
<varlistentry xml:id="mysqlnd.stats.statistics.rows-buffered-from-server-normal">
647
+
<term><literal>rows_buffered_from_client_normal</literal></term>
648
+
<listitem>
649
+
<simpara>
650
+
Total number of buffered rows originating from a normal query.
651
+
</simpara>
652
+
<simpara>
653
+
This is the number of rows that have been fetched from MySQL and buffered on client.
654
+
</simpara>
655
+
<para>
656
+
Examples of queries that will buffer results:
657
+
<simplelist>
658
+
<member><function>mysqli_query</function></member>
659
+
<member><function>mysqli_store_result</function></member>
660
+
</simplelist>
661
+
</para>
662
+
</listitem>
663
+
</varlistentry>
664
+

665
+
<varlistentry xml:id="mysqlnd.stats.statistics.rows-buffered-from-server-ps">
666
+
<term><literal>rows_buffered_from_server_ps</literal></term>
667
+
<listitem>
668
+
<simpara>
669
+
Same as <literal>rows_buffered_from_client_normal</literal>
670
+
but for prepared statements.
671
+
</simpara>
672
+
</listitem>
673
+
</varlistentry>
674
+

675
+
<varlistentry xml:id="mysqlnd.stats.statistics.rows-fetched-from-client-normal-buffered">
676
+
<term><literal>rows_fetched_from_client_normal_buffered</literal></term>
677
+
<listitem>
678
+
<simpara>
679
+
Total number of rows fetched by the client from a buffered result set
680
+
created by a normal query.
681
+
</simpara>
682
+
</listitem>
683
+
</varlistentry>
684
+

685
+
<varlistentry xml:id="mysqlnd.stats.statistics.rows-fetched-from-client-ps-buffered">
686
+
<term><literal>rows_fetched_from_client_ps_buffered</literal></term>
687
+
<listitem>
688
+
<simpara>
689
+
Total number of rows fetched by the client from a buffered result set
690
+
created by a prepared statement.
691
+
</simpara>
692
+
</listitem>
693
+
</varlistentry>
694
+

695
+
<varlistentry xml:id="mysqlnd.stats.statistics.rows-fetched-from-client-normal-unbuffered">
696
+
<term><literal>rows_fetched_from_client_normal_unbuffered</literal></term>
697
+
<listitem>
698
+
<simpara>
699
+
Total number of rows fetched by the client from an unbuffered result set
700
+
created by a normal query.
701
+
</simpara>
702
+
</listitem>
703
+
</varlistentry>
704
+

705
+
<varlistentry xml:id="mysqlnd.stats.statistics.rows-fetched-from-client-ps-unbuffered">
706
+
<term><literal>rows_fetched_from_client_ps_unbuffered</literal></term>
707
+
<listitem>
708
+
<simpara>
709
+
Total number of rows fetched by the client from an unbuffered result set
710
+
created by a prepared statement.
711
+
</simpara>
712
+
</listitem>
713
+
</varlistentry>
714
+

715
+
<varlistentry xml:id="mysqlnd.stats.statistics.rows-fetched-from-client-ps-cursor">
716
+
<term><literal>rows_fetched_from_client_ps_cursor</literal></term>
717
+
<listitem>
718
+
<simpara>
719
+
Total number of rows fetch by the client from a cursor created by a
720
+
prepared statement.
721
+
</simpara>
722
+
</listitem>
723
+
</varlistentry>
724
+

725
+
<!-- TODO: This seems to actually be supported, check and document -->
726
+
<varlistentry xml:id="mysqlnd.stats.statistics.rows-skipped-normal">
727
+
<term><literal>rows_skipped_normal</literal></term>
728
+
<term><literal>rows_skipped_ps</literal></term>
729
+
<listitem>
730
+
<simpara>
731
+
Reserved for future use (currently not supported).
732
+
</simpara>
733
+
</listitem>
734
+
</varlistentry>
735
+

736
+
<varlistentry xml:id="mysqlnd.stats.statistics.copy-on-write">
737
+
<term><literal>copy_on_write_saved</literal></term>
738
+
<term><literal>copy_on_write_performed</literal></term>
739
+
<listitem>
740
+
<simpara>
741
+
This is a process level scope statistic.
742
+
</simpara>
743
+
<simpara>
744
+
With mysqlnd, variables returned by the extensions point into mysqlnd
745
+
internal network result buffers.
746
+
If the data are not changed, the fetched data is kept only once in memory.
747
+
However, any modification to the data will require mysqlnd to perform
748
+
a copy-on-write operation.
749
+
</simpara>
750
+
</listitem>
751
+
</varlistentry>
752
+

753
+
<varlistentry xml:id="mysqlnd.stats.statistics.free-result">
754
+
<term><literal>explicit_free_result</literal></term>
755
+
<term><literal>implicit_free_result</literal></term>
756
+
<listitem>
757
+
<simpara>
758
+
This is a connection and process level scope statistic.
759
+
</simpara>
760
+
<simpara>
761
+
Total number of freed result sets.
762
+
</simpara>
763
+
</listitem>
764
+
</varlistentry>
765
+

766
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-text-fetched-null">
767
+
<term><literal>proto_text_fetched_null</literal></term>
768
+
<listitem>
769
+
<simpara>
770
+
Total number of columns of type
771
+
<literal>MYSQL_TYPE_NULL</literal>
772
+
fetched from a normal query (MySQL text protocol).
773
+
</simpara>
774
+
</listitem>
775
+
</varlistentry>
776
+

777
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-binary-fetched-null">
778
+
<term><literal>proto_binary_fetched_null</literal></term>
779
+
<listitem>
780
+
<simpara>
781
+
Total number of columns of type
782
+
<literal>MYSQL_TYPE_NULL</literal>
783
+
fetched from a prepared statement (MySQL binary protocol).
784
+
</simpara>
785
+
</listitem>
786
+
</varlistentry>
787
+

788
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-text-fetched-bit">
789
+
<term><literal>proto_text_fetched_bit</literal></term>
790
+
<listitem>
791
+
<simpara>
792
+
Total number of columns of type
793
+
<literal>MYSQL_TYPE_BIT</literal>
794
+
fetched from a normal query (MySQL text protocol).
795
+
</simpara>
796
+
</listitem>
797
+
</varlistentry>
798
+

799
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-binary-fetched-bit">
800
+
<term><literal>proto_binary_fetched_bit</literal></term>
801
+
<listitem>
802
+
<simpara>
803
+
Total number of columns of type
804
+
<literal>MYSQL_TYPE_BIT</literal>
805
+
fetched from a prepared statement (MySQL binary protocol).
806
+
</simpara>
807
+
</listitem>
808
+
</varlistentry>
809
+

810
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-text-fetched-tinyint">
811
+
<term><literal>proto_text_fetched_tinyint</literal></term>
812
+
<listitem>
813
+
<simpara>
814
+
Total number of columns of type
815
+
<literal>MYSQL_TYPE_TINY</literal>
816
+
fetched from a normal query (MySQL text protocol).
817
+
</simpara>
818
+
</listitem>
819
+
</varlistentry>
820
+

821
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-binary-fetched-tinyint">
822
+
<term><literal>proto_binary_fetched_tinyint</literal></term>
823
+
<listitem>
824
+
<simpara>
825
+
Total number of columns of type
826
+
<literal>MYSQL_TYPE_TINY</literal>
827
+
fetched from a prepared statement (MySQL binary protocol).
828
+
</simpara>
829
+
</listitem>
830
+
</varlistentry>
831
+

832
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-text-fetched-short">
833
+
<term><literal>proto_text_fetched_short</literal></term>
834
+
<listitem>
835
+
<simpara>
836
+
Total number of columns of type
837
+
<literal>MYSQL_TYPE_SHORT</literal>
838
+
fetched from a normal query (MySQL text protocol).
839
+
</simpara>
840
+
</listitem>
841
+
</varlistentry>
842
+

843
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-binary-fetched-short">
844
+
<term><literal>proto_binary_fetched_short</literal></term>
845
+
<listitem>
846
+
<simpara>
847
+
Total number of columns of type
848
+
<literal>MYSQL_TYPE_SHORT</literal>
849
+
fetched from a prepared statement (MySQL binary protocol).
850
+
</simpara>
851
+
</listitem>
852
+
</varlistentry>
853
+

854
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-text-fetched-int24">
855
+
<term><literal>proto_text_fetched_int24</literal></term>
856
+
<listitem>
857
+
<simpara>
858
+
Total number of columns of type
859
+
<literal>MYSQL_TYPE_INT24</literal>
860
+
fetched from a normal query (MySQL text protocol).
861
+
</simpara>
862
+
</listitem>
863
+
</varlistentry>
864
+

865
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-binary-fetched-int24">
866
+
<term><literal>proto_binary_fetched_int24</literal></term>
867
+
<listitem>
868
+
<simpara>
869
+
Total number of columns of type
870
+
<literal>MYSQL_TYPE_INT24</literal>
871
+
fetched from a prepared statement (MySQL binary protocol).
872
+
</simpara>
873
+
</listitem>
874
+
</varlistentry>
875
+

876
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-text-fetched-int">
877
+
<term><literal>proto_text_fetched_int</literal></term>
878
+
<listitem>
879
+
<simpara>
880
+
Total number of columns of type
881
+
<literal>MYSQL_TYPE_LONG</literal>
882
+
fetched from a normal query (MySQL text protocol).
883
+
</simpara>
884
+
</listitem>
885
+
</varlistentry>
886
+

887
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-binary-fetched-int">
888
+
<term><literal>proto_binary_fetched_int</literal></term>
889
+
<listitem>
890
+
<simpara>
891
+
Total number of columns of type
892
+
<literal>MYSQL_TYPE_LONG</literal>
893
+
fetched from a prepared statement (MySQL binary protocol).
894
+
</simpara>
895
+
</listitem>
896
+
</varlistentry>
897
+

898
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-text-fetched-bigint">
899
+
<term><literal>proto_text_fetched_bigint</literal></term>
900
+
<listitem>
901
+
<simpara>
902
+
Total number of columns of type
903
+
<literal>MYSQL_TYPE_LONGLONG</literal>
904
+
fetched from a normal query (MySQL text protocol).
905
+
</simpara>
906
+
</listitem>
907
+
</varlistentry>
908
+

909
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-binary-fetched-bigint">
910
+
<term><literal>proto_binary_fetched_bigint</literal></term>
911
+
<listitem>
912
+
<simpara>
913
+
Total number of columns of type
914
+
<literal>MYSQL_TYPE_LONGLONG</literal>
915
+
fetched from a prepared statement (MySQL binary protocol).
916
+
</simpara>
917
+
</listitem>
918
+
</varlistentry>
919
+

920
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-text-fetched-decimal">
921
+
<term><literal>proto_text_fetched_decimal</literal></term>
922
+
<listitem>
923
+
<simpara>
924
+
Total number of columns of type
925
+
<literal>MYSQL_TYPE_DECIMAL</literal>, or <literal>MYSQL_TYPE_NEWDECIMAL</literal>
926
+
fetched from a normal query (MySQL text protocol).
927
+
</simpara>
928
+
</listitem>
929
+
</varlistentry>
930
+

931
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-binary-fetched-decimal">
932
+
<term><literal>proto_binary_fetched_decimal</literal></term>
933
+
<listitem>
934
+
<simpara>
935
+
Total number of columns of type
936
+
<literal>MYSQL_TYPE_DECIMAL</literal>, or <literal>MYSQL_TYPE_NEWDECIMAL</literal>
937
+
fetched from a prepared statement (MySQL binary protocol).
938
+
</simpara>
939
+
</listitem>
940
+
</varlistentry>
941
+

942
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-text-fetched-float">
943
+
<term><literal>proto_text_fetched_float</literal></term>
944
+
<listitem>
945
+
<simpara>
946
+
Total number of columns of type
947
+
<literal>MYSQL_TYPE_FLOAT</literal>
948
+
fetched from a normal query (MySQL text protocol).
949
+
</simpara>
950
+
</listitem>
951
+
</varlistentry>
952
+

953
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-binary-fetched-float">
954
+
<term><literal>proto_binary_fetched_float</literal></term>
955
+
<listitem>
956
+
<simpara>
957
+
Total number of columns of type
958
+
<literal>MYSQL_TYPE_FLOAT</literal>
959
+
fetched from a prepared statement (MySQL binary protocol).
960
+
</simpara>
961
+
</listitem>
962
+
</varlistentry>
963
+

964
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-text-fetched-double">
965
+
<term><literal>proto_text_fetched_double</literal></term>
966
+
<listitem>
967
+
<simpara>
968
+
Total number of columns of type
969
+
<literal>MYSQL_TYPE_DOUBLE</literal>
970
+
fetched from a normal query (MySQL text protocol).
971
+
</simpara>
972
+
</listitem>
973
+
</varlistentry>
974
+

975
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-binary-fetched-double">
976
+
<term><literal>proto_binary_fetched_double</literal></term>
977
+
<listitem>
978
+
<simpara>
979
+
Total number of columns of type
980
+
<literal>MYSQL_TYPE_DOUBLE</literal>
981
+
fetched from a prepared statement (MySQL binary protocol).
982
+
</simpara>
983
+
</listitem>
984
+
</varlistentry>
985
+

986
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-text-fetched-date">
987
+
<term><literal>proto_text_fetched_date</literal></term>
988
+
<listitem>
989
+
<simpara>
990
+
Total number of columns of type
991
+
<literal>MYSQL_TYPE_DATE</literal>, or <literal>MYSQL_TYPE_NEWDATE</literal>
992
+
fetched from a normal query (MySQL text protocol).
993
+
</simpara>
994
+
</listitem>
995
+
</varlistentry>
996
+

997
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-binary-fetched-date">
998
+
<term><literal>proto_binary_fetched_date</literal></term>
999
+
<listitem>
1000
+
<simpara>
1001
+
Total number of columns of type
1002
+
<literal>MYSQL_TYPE_DATE</literal>, or <literal>MYSQL_TYPE_NEWDATE</literal>
1003
+
fetched from a prepared statement (MySQL binary protocol).
1004
+
</simpara>
1005
+
</listitem>
1006
+
</varlistentry>
1007
+

1008
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-text-fetched-year">
1009
+
<term><literal>proto_text_fetched_year</literal></term>
1010
+
<listitem>
1011
+
<simpara>
1012
+
Total number of columns of type
1013
+
<literal>MYSQL_TYPE_YEAR</literal>
1014
+
fetched from a normal query (MySQL text protocol).
1015
+
</simpara>
1016
+
</listitem>
1017
+
</varlistentry>
1018
+

1019
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-binary-fetched-year">
1020
+
<term><literal>proto_binary_fetched_year</literal></term>
1021
+
<listitem>
1022
+
<simpara>
1023
+
Total number of columns of type
1024
+
<literal>MYSQL_TYPE_YEAR</literal>
1025
+
fetched from a prepared statement (MySQL binary protocol).
1026
+
</simpara>
1027
+
</listitem>
1028
+
</varlistentry>
1029
+

1030
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-text-fetched-time">
1031
+
<term><literal>proto_text_fetched_time</literal></term>
1032
+
<listitem>
1033
+
<simpara>
1034
+
Total number of columns of type
1035
+
<literal>MYSQL_TYPE_TIME</literal>
1036
+
fetched from a normal query (MySQL text protocol).
1037
+
</simpara>
1038
+
</listitem>
1039
+
</varlistentry>
1040
+

1041
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-binary-fetched-time">
1042
+
<term><literal>proto_binary_fetched_time</literal></term>
1043
+
<listitem>
1044
+
<simpara>
1045
+
Total number of columns of type
1046
+
<literal>MYSQL_TYPE_TIME</literal>
1047
+
fetched from a prepared statement (MySQL binary protocol).
1048
+
</simpara>
1049
+
</listitem>
1050
+
</varlistentry>
1051
+

1052
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-text-fetched-datetime">
1053
+
<term><literal>proto_text_fetched_datetime</literal></term>
1054
+
<listitem>
1055
+
<simpara>
1056
+
Total number of columns of type
1057
+
<literal>MYSQL_TYPE_DATETIME</literal>
1058
+
fetched from a normal query (MySQL text protocol).
1059
+
</simpara>
1060
+
</listitem>
1061
+
</varlistentry>
1062
+

1063
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-binary-fetched-datetime">
1064
+
<term><literal>proto_binary_fetched_datetime</literal></term>
1065
+
<listitem>
1066
+
<simpara>
1067
+
Total number of columns of type
1068
+
<literal>MYSQL_TYPE_DATETIME</literal>
1069
+
fetched from a prepared statement (MySQL binary protocol).
1070
+
</simpara>
1071
+
</listitem>
1072
+
</varlistentry>
1073
+

1074
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-text-fetched-timestamp">
1075
+
<term><literal>proto_text_fetched_timestamp</literal></term>
1076
+
<listitem>
1077
+
<simpara>
1078
+
Total number of columns of type
1079
+
<literal>MYSQL_TYPE_TIMESTAMP</literal>
1080
+
fetched from a normal query (MySQL text protocol).
1081
+
</simpara>
1082
+
</listitem>
1083
+
</varlistentry>
1084
+

1085
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-binary-fetched-timestamp">
1086
+
<term><literal>proto_binary_fetched_timestamp</literal></term>
1087
+
<listitem>
1088
+
<simpara>
1089
+
Total number of columns of type
1090
+
<literal>MYSQL_TYPE_TIMESTAMP</literal>
1091
+
fetched from a prepared statement (MySQL binary protocol).
1092
+
</simpara>
1093
+
</listitem>
1094
+
</varlistentry>
1095
+

1096
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-text-fetched-string">
1097
+
<term><literal>proto_text_fetched_string</literal></term>
1098
+
<listitem>
1099
+
<simpara>
1100
+
Total number of columns of type
1101
+
<literal>MYSQL_TYPE_STRING</literal>, <literal>MYSQL_TYPE_VARSTRING</literal>, or <literal>MYSQL_TYPE_VARCHAR</literal>
1102
+
fetched from a normal query (MySQL text protocol).
1103
+
</simpara>
1104
+
</listitem>
1105
+
</varlistentry>
1106
+

1107
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-binary-fetched-string">
1108
+
<term><literal>proto_binary_fetched_string</literal></term>
1109
+
<listitem>
1110
+
<simpara>
1111
+
Total number of columns of type
1112
+
<literal>MYSQL_TYPE_STRING</literal>, <literal>MYSQL_TYPE_VARSTRING</literal>, or <literal>MYSQL_TYPE_VARCHAR</literal>
1113
+
fetched from a prepared statement (MySQL binary protocol).
1114
+
</simpara>
1115
+
</listitem>
1116
+
</varlistentry>
1117
+

1118
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-text-fetched-blob">
1119
+
<term><literal>proto_text_fetched_blob</literal></term>
1120
+
<listitem>
1121
+
<simpara>
1122
+
Total number of columns of type
1123
+
<literal>MYSQL_TYPE_TINY_BLOB</literal>,
1124
+
<literal>MYSQL_TYPE_MEDIUM_BLOB</literal>,
1125
+
<literal>MYSQL_TYPE_LONG_BLOB</literal>,
1126
+
or <literal>MYSQL_TYPE_BLOB</literal>
1127
+
fetched from a normal query (MySQL text protocol).
1128
+
</simpara>
1129
+
</listitem>
1130
+
</varlistentry>
1131
+

1132
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-binary-fetched-blob">
1133
+
<term><literal>proto_binary_fetched_blob</literal></term>
1134
+
<listitem>
1135
+
<simpara>
1136
+
Total number of columns of type
1137
+
<literal>MYSQL_TYPE_TINY_BLOB</literal>,
1138
+
<literal>MYSQL_TYPE_MEDIUM_BLOB</literal>,
1139
+
<literal>MYSQL_TYPE_LONG_BLOB</literal>,
1140
+
or <literal>MYSQL_TYPE_BLOB</literal>
1141
+
fetched from a prepared statement (MySQL binary protocol).
1142
+
</simpara>
1143
+
</listitem>
1144
+
</varlistentry>
1145
+

1146
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-text-fetched-enum">
1147
+
<term><literal>proto_text_fetched_enum</literal></term>
1148
+
<listitem>
1149
+
<simpara>
1150
+
Total number of columns of type
1151
+
<literal>MYSQL_TYPE_ENUM</literal>
1152
+
fetched from a normal query (MySQL text protocol).
1153
+
</simpara>
1154
+
</listitem>
1155
+
</varlistentry>
1156
+

1157
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-binary-fetched-enum">
1158
+
<term><literal>proto_binary_fetched_enum</literal></term>
1159
+
<listitem>
1160
+
<simpara>
1161
+
Total number of columns of type
1162
+
<literal>MYSQL_TYPE_ENUM</literal>
1163
+
fetched from a prepared statement (MySQL binary protocol).
1164
+
</simpara>
1165
+
</listitem>
1166
+
</varlistentry>
1167
+

1168
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-text-fetched-set">
1169
+
<term><literal>proto_text_fetched_set</literal></term>
1170
+
<listitem>
1171
+
<simpara>
1172
+
Total number of columns of type
1173
+
<literal>MYSQL_TYPE_SET</literal>
1174
+
fetched from a normal query (MySQL text protocol).
1175
+
</simpara>
1176
+
</listitem>
1177
+
</varlistentry>
1178
+

1179
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-binary-fetched-set">
1180
+
<term><literal>proto_binary_fetched_set</literal></term>
1181
+
<listitem>
1182
+
<simpara>
1183
+
Total number of columns of type
1184
+
<literal>MYSQL_TYPE_SET</literal>
1185
+
fetched from a prepared statement (MySQL binary protocol).
1186
+
</simpara>
1187
+
</listitem>
1188
+
</varlistentry>
1189
+

1190
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-text-fetched-geometry">
1191
+
<term><literal>proto_text_fetched_geometry</literal></term>
1192
+
<listitem>
1193
+
<simpara>
1194
+
Total number of columns of type
1195
+
<literal>MYSQL_TYPE_GEOMETRY</literal>
1196
+
fetched from a normal query (MySQL text protocol).
1197
+
</simpara>
1198
+
</listitem>
1199
+
</varlistentry>
1200
+

1201
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-binary-fetched-geometry">
1202
+
<term><literal>proto_binary_fetched_geometry</literal></term>
1203
+
<listitem>
1204
+
<simpara>
1205
+
Total number of columns of type
1206
+
<literal>MYSQL_TYPE_GEOMETRY</literal>
1207
+
fetched from a prepared statement (MySQL binary protocol).
1208
+
</simpara>
1209
+
</listitem>
1210
+
</varlistentry>
1211
+

1212
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-text-fetched-other">
1213
+
<term><literal>proto_text_fetched_other</literal></term>
1214
+
<listitem>
1215
+
<simpara>
1216
+
Total number of columns of types
1217
+
<literal>MYSQL_TYPE_<replaceable>*</replaceable></literal>
1218
+
not listed previously
1219
+
fetched from a normal query (MySQL text protocol).
1220
+
</simpara>
1221
+
<note>
1222
+
<simpara>
1223
+
In theory, this should always be <literal>0</literal>.
1224
+
</simpara>
1225
+
</note>
1226
+
</listitem>
1227
+
</varlistentry>
1228
+

1229
+
<varlistentry xml:id="mysqlnd.stats.statistics.proto-binary-fetched-other">
1230
+
<term><literal>proto_binary_fetched_other</literal></term>
1231
+
<listitem>
1232
+
<simpara>
1233
+
Total number of columns of type
1234
+
<literal>MYSQL_TYPE_<replaceable>*</replaceable></literal>
1235
+
not listed previously
1236
+
fetched from a prepared statement (MySQL binary protocol).
1237
+
</simpara>
1238
+
<note>
1239
+
<simpara>
1240
+
In theory, this should always be <literal>0</literal>.
1241
+
</simpara>
1242
+
</note>
1243
+
</listitem>
1244
+
</varlistentry>
1245
+

1246
+
</variablelist>
1247
+

1248
+
<variablelist>
1249
+
<title>Connection Related Statistics</title>
1250
+

1251
+
<varlistentry xml:id="mysqlnd.stats.statistics.connect-success">
1252
+
<term><literal>connect_success</literal></term>
1253
+
<listitem>
1254
+
<simpara>
1255
+
Total number of successful connection attempts.
1256
+
</simpara>
1257
+
<note>
1258
+
<simpara>
1259
+
<literal>connect_success</literal> holds the sum of successful
1260
+
persistent and non-persistent connection attempts.
1261
+
Therefore, the number of successful non-persistent connection attempts
1262
+
is <literal>connect_success - pconnect_success</literal>.
1263
+
</simpara>
1264
+
</note>
1265
+
</listitem>
1266
+
</varlistentry>
1267
+

1268
+
<varlistentry xml:id="mysqlnd.stats.statistics.pconnect-success">
1269
+
<term><literal>pconnect_success</literal></term>
1270
+
<listitem>
1271
+
<simpara>
1272
+
Total number of successful persistent connection attempts.
1273
+
</simpara>
1274
+
</listitem>
1275
+
</varlistentry>
1276
+

1277
+
<varlistentry xml:id="mysqlnd.stats.statistics.connect-failure">
1278
+
<term><literal>connect_failure</literal></term>
1279
+
<listitem>
1280
+
<simpara>
1281
+
Total number of failed connection attempts.
1282
+
</simpara>
1283
+
</listitem>
1284
+
</varlistentry>
1285
+

1286
+
<varlistentry xml:id="mysqlnd.stats.statistics.reconnect">
1287
+
<term><literal>reconnect</literal></term>
1288
+
<listitem>
1289
+
<simpara>
1290
+
This is a process level scope statistic.
1291
+
</simpara>
1292
+
</listitem>
1293
+
</varlistentry>
1294
+

1295
+
<varlistentry xml:id="mysqlnd.stats.statistics.active-connections">
1296
+
<term><literal>active_connections</literal></term>
1297
+
<listitem>
1298
+
<simpara>
1299
+
This is a process level scope statistic.
1300
+
</simpara>
1301
+
<simpara>
1302
+
Total number of active persistent and non-persistent connections.
1303
+
</simpara>
1304
+
<note>
1305
+
<simpara>
1306
+
The total number of active non-persistent connections is
1307
+
<literal>active_connections - active_persistent_connections</literal>.
1308
+
</simpara>
1309
+
</note>
1310
+
</listitem>
1311
+
</varlistentry>
1312
+

1313
+
<varlistentry xml:id="mysqlnd.stats.statistics.active-persistent-connections">
1314
+
<term><literal>active_persistent_connections</literal></term>
1315
+
<listitem>
1316
+
<simpara>
1317
+
This is a process level scope statistic.
1318
+
</simpara>
1319
+
<simpara>
1320
+
Total number of active persistent connections.
1321
+
</simpara>
1322
+
</listitem>
1323
+
</varlistentry>
1324
+

1325
+
<varlistentry xml:id="mysqlnd.stats.statistics.explicit-close">
1326
+
<term><literal>explicit_close</literal></term>
1327
+
<listitem>
1328
+
<simpara>
1329
+
Total number of explicitly closed connections.
1330
+
</simpara>
1331
+
<example>
1332
+
<title>Examples of code snippets that cause an explicit close</title>
556
1333
<itemizedlist>
557
1334
<listitem>
558
-
<para>
559
-
Faulty client application
560
-
</para>
561
-
</listitem>
562
-
<listitem>
563
-
<para>
564
-
Client stopped reading after it found what it was looking for
565
-
but has made MySQL calculate more records than needed
566
-
</para>
1335
+
<programlisting>
1336
+
<![CDATA[
1337
+
$link = new mysqli(/* ... */);
1338
+
$link->close(/* ... */);
1339
+
]]>
1340
+
</programlisting>
567
1341
</listitem>
568
1342
<listitem>
569
-
<para>
570
-
Client application has stopped unexpectedly
571
-
</para>
1343
+
<programlisting>
1344
+
<![CDATA[
1345
+
$link = new mysqli(/* ... */);
1346
+
$link->connect(/* ... */);
1347
+
]]>
1348
+
</programlisting>
572
1349
</listitem>
573
-
</itemizedlist></entry>
574
-
</row>
575
-
<row>
576
-
<entry><literal>ps_prepared_never_executed</literal></entry>
577
-
<entry>Connection</entry>
578
-
<entry>Number of statements prepared but never executed.</entry>
579
-
<entry>Prepared statements occupy server resources. You should not prepare a
580
-
statement if you do not plan to execute it.</entry>
581
-
</row>
582
-
<row>
583
-
<entry><literal>ps_prepared_once_executed</literal></entry>
584
-
<entry>Connection</entry>
585
-
<entry>Number of prepared statements executed only one.</entry>
586
-
<entry>One of the ideas behind prepared statements is that the same query gets
587
-
executed over and over again (with different parameters) and some
588
-
parsing and other preparation work can be saved, if statement
589
-
execution is split up in separate prepare and execute stages. The
590
-
idea is to prepare once and <quote>cache</quote> results, for
591
-
example, the parse tree to be reused during multiple statement
592
-
executions. If you execute a prepared statement only once the two
593
-
stage processing can be inefficient compared to
594
-
<quote>normal</quote> queries because all the caching means extra
595
-
work and it takes (limited) server resources to hold the cached
596
-
information. Consequently, prepared statements that are executed
597
-
only once may cause performance hurts.</entry>
598
-
</row>
599
-
<row>
600
-
<entry><literal>rows_fetched_from_server_normal</literal>,
601
-
<literal>rows_fetched_from_server_ps</literal></entry>
602
-
<entry>Connection</entry>
603
-
<entry>Total number of result set rows successfully fetched from MySQL
604
-
regardless if the client application has consumed them or not.
605
-
Some of the rows may not have been fetched by the client
606
-
application but have been flushed implicitly.</entry>
607
-
<entry>See also <literal>packets_received_rset_row</literal></entry>
608
-
</row>
609
-
<row>
610
-
<entry><literal>rows_buffered_from_client_normal</literal>,
611
-
<literal>rows_buffered_from_client_ps</literal></entry>
612
-
<entry>Connection</entry>
613
-
<entry>Total number of successfully buffered rows originating from a "normal"
614
-
query or a prepared statement. This is the number of rows that
615
-
have been fetched from MySQL and buffered on client. Note that
616
-
there are two distinct statistics on rows that have been buffered
617
-
(MySQL to mysqlnd internal buffer) and buffered rows that have
618
-
been fetched by the client application (mysqlnd internal buffer to
619
-
client application). If the number of buffered rows is higher than
620
-
the number of fetched buffered rows it can mean that the client
621
-
application runs queries that cause larger result sets than needed
622
-
resulting in rows not read by the client.</entry>
623
-
<entry>Examples of queries that will buffer results:
624
-
<function>mysqli_query</function>,
625
-
<function>mysqli_store_result</function></entry>
626
-
</row>
627
-
<row>
628
-
<entry><literal>rows_fetched_from_client_normal_buffered</literal>,
629
-
<literal>rows_fetched_from_client_ps_buffered</literal></entry>
630
-
<entry>Connection</entry>
631
-
<entry>Total number of rows fetched by the client from a buffered result set
632
-
created by a normal query or a prepared statement.</entry>
633
-
<entry></entry>
634
-
</row>
635
-
<row>
636
-
<entry><literal>rows_fetched_from_client_normal_unbuffered</literal>,
637
-
<literal>rows_fetched_from_client_ps_unbuffered</literal></entry>
638
-
<entry>Connection</entry>
639
-
<entry>Total number of rows fetched by the client from a unbuffered result set
640
-
created by a "normal" query or a prepared statement.</entry>
641
-
<entry></entry>
642
-
</row>
643
-
<row>
644
-
<entry><literal>rows_fetched_from_client_ps_cursor</literal></entry>
645
-
<entry>Connection</entry>
646
-
<entry>Total number of rows fetch by the client from a cursor created by a
647
-
prepared statement.</entry>
648
-
<entry></entry>
649
-
</row>
650
-
<row>
651
-
<entry><literal>rows_skipped_normal</literal>,
652
-
<literal>rows_skipped_ps</literal></entry>
653
-
<entry>Connection</entry>
654
-
<entry>Reserved for future use (currently not supported)</entry>
655
-
<entry></entry>
656
-
</row>
657
-
<row>
658
-
<entry><literal>copy_on_write_saved</literal>,
659
-
<literal>copy_on_write_performed</literal></entry>
660
-
<entry>Process</entry>
661
-
<entry>With mysqlnd, variables returned by the extensions point into mysqlnd
662
-
internal network result buffers. If you do not change the
663
-
variables, fetched data will be kept only once in memory. If you
664
-
change the variables, mysqlnd has to perform a copy-on-write to
665
-
protect the internal network result buffers from being changed.
666
-
With the MySQL Client Library you always hold fetched data twice
667
-
in memory. Once in the internal MySQL Client Library buffers and
668
-
once in the variables returned by the extensions. In theory
669
-
mysqlnd can save up to 40% memory. However, note that the memory
670
-
saving cannot be measured using
671
-
<function>memory_get_usage</function>.</entry>
672
-
<entry></entry>
673
-
</row>
674
-
<row>
675
-
<entry><literal>explicit_free_result</literal>,
676
-
<literal>implicit_free_result</literal></entry>
677
-
<entry>Connection, Process (only during prepared statement cleanup)</entry>
678
-
<entry>Total number of freed result sets.</entry>
679
-
<entry>The free is always considered explicit but for result sets created by an
680
-
init command, for example,
681
-
<literal>mysqli_options(MYSQLI_INIT_COMMAND , ...)</literal></entry>
682
-
</row>
683
-
<row>
684
-
<entry><literal>proto_text_fetched_null</literal>,
685
-
<literal>proto_text_fetched_bit</literal>,
686
-
<literal>proto_text_fetched_tinyint</literal>
687
-
<literal>proto_text_fetched_short</literal>,
688
-
<literal>proto_text_fetched_int24</literal>,
689
-
<literal>proto_text_fetched_int</literal>
690
-
<literal>proto_text_fetched_bigint</literal>,
691
-
<literal>proto_text_fetched_decimal</literal>,
692
-
<literal>proto_text_fetched_float</literal>
693
-
<literal>proto_text_fetched_double</literal>,
694
-
<literal>proto_text_fetched_date</literal>,
695
-
<literal>proto_text_fetched_year</literal>
696
-
<literal>proto_text_fetched_time</literal>,
697
-
<literal>proto_text_fetched_datetime</literal>,
698
-
<literal>proto_text_fetched_timestamp</literal>
699
-
<literal>proto_text_fetched_string</literal>,
700
-
<literal>proto_text_fetched_blob</literal>,
701
-
<literal>proto_text_fetched_enum</literal>
702
-
<literal>proto_text_fetched_set</literal>,
703
-
<literal>proto_text_fetched_geometry</literal>,
704
-
<literal>proto_text_fetched_other</literal></entry>
705
-
<entry>Connection</entry>
706
-
<entry>Total number of columns of a certain type fetched from a normal query
707
-
(MySQL text protocol).</entry>
708
-
<entry>Mapping from C API / MySQL meta data type to statistics name:
1350
+
</itemizedlist>
1351
+
</example>
1352
+
</listitem>
1353
+
</varlistentry>
1354
+

1355
+
<varlistentry xml:id="mysqlnd.stats.statistics.implicit-close">
1356
+
<term><literal>implicit_close</literal></term>
1357
+
<listitem>
1358
+
<simpara>
1359
+
Total number of implicitly closed connections.
1360
+
</simpara>
1361
+
<example>
1362
+
<title>Examples of code snippets that cause an implicit close</title>
709
1363
<itemizedlist>
710
1364
<listitem>
711
-
<para>
712
-
<literal>MYSQL_TYPE_NULL</literal> - proto_text_fetched_null
713
-
</para>
714
-
</listitem>
715
-
<listitem>
716
-
<para>
717
-
<literal>MYSQL_TYPE_BIT</literal> - proto_text_fetched_bit
718
-
</para>
719
-
</listitem>
720
-
<listitem>
721
-
<para>
722
-
<literal>MYSQL_TYPE_TINY</literal> - proto_text_fetched_tinyint
723
-
</para>
724
-
</listitem>
725
-
<listitem>
726
-
<para>
727
-
<literal>MYSQL_TYPE_SHORT</literal> - proto_text_fetched_short
728
-
</para>
729
-
</listitem>
730
-
<listitem>
731
-
<para>
732
-
<literal>MYSQL_TYPE_INT24</literal> - proto_text_fetched_int24
733
-
</para>
734
-
</listitem>
735
-
<listitem>
736
-
<para>
737
-
<literal>MYSQL_TYPE_LONG</literal> - proto_text_fetched_int
738
-
</para>
739
-
</listitem>
740
-
<listitem>
741
-
<para>
742
-
<literal>MYSQL_TYPE_LONGLONG</literal> -
743
-
proto_text_fetched_bigint
744
-
</para>
745
-
</listitem>
746
-
<listitem>
747
-
<para>
748
-
<literal>MYSQL_TYPE_DECIMAL</literal>,
749
-
<literal>MYSQL_TYPE_NEWDECIMAL</literal> -
750
-
proto_text_fetched_decimal
751
-
</para>
752
-
</listitem>
753
-
<listitem>
754
-
<para>
755
-
<literal>MYSQL_TYPE_FLOAT</literal> - proto_text_fetched_float
756
-
</para>
757
-
</listitem>
758
-
<listitem>
759
-
<para>
760
-
<literal>MYSQL_TYPE_DOUBLE</literal> -
761
-
proto_text_fetched_double
762
-
</para>
763
-
</listitem>
764
-
<listitem>
765
-
<para>
766
-
<literal>MYSQL_TYPE_DATE</literal>,
767
-
<literal>MYSQL_TYPE_NEWDATE</literal> - proto_text_fetched_date
768
-
</para>
769
-
</listitem>
770
-
<listitem>
771
-
<para>
772
-
<literal>MYSQL_TYPE_YEAR</literal> - proto_text_fetched_year
773
-
</para>
774
-
</listitem>
775
-
<listitem>
776
-
<para>
777
-
<literal>MYSQL_TYPE_TIME</literal> - proto_text_fetched_time
778
-
</para>
779
-
</listitem>
780
-
<listitem>
781
-
<para>
782
-
<literal>MYSQL_TYPE_DATETIME</literal> -
783
-
proto_text_fetched_datetime
784
-
</para>
785
-
</listitem>
786
-
<listitem>
787
-
<para>
788
-
<literal>MYSQL_TYPE_TIMESTAMP</literal> -
789
-
proto_text_fetched_timestamp
790
-
</para>
791
-
</listitem>
792
-
<listitem>
793
-
<para>
794
-
<literal>MYSQL_TYPE_STRING</literal>,
795
-
<literal>MYSQL_TYPE_VARSTRING</literal>,
796
-
<literal>MYSQL_TYPE_VARCHAR</literal> -
797
-
proto_text_fetched_string
798
-
</para>
799
-
</listitem>
800
-
<listitem>
801
-
<para>
802
-
<literal>MYSQL_TYPE_TINY_BLOB</literal>,
803
-
<literal>MYSQL_TYPE_MEDIUM_BLOB</literal>,
804
-
<literal>MYSQL_TYPE_LONG_BLOB</literal>,
805
-
<literal>MYSQL_TYPE_BLOB</literal> - proto_text_fetched_blob
806
-
</para>
807
-
</listitem>
808
-
<listitem>
809
-
<para>
810
-
<literal>MYSQL_TYPE_ENUM</literal> - proto_text_fetched_enum
811
-
</para>
812
-
</listitem>
813
-
<listitem>
814
-
<para>
815
-
<literal>MYSQL_TYPE_SET</literal> - proto_text_fetched_set
816
-
</para>
817
-
</listitem>
818
-
<listitem>
819
-
<para>
820
-
<literal>MYSQL_TYPE_GEOMETRY</literal> -
821
-
proto_text_fetched_geometry
822
-
</para>
823
-
</listitem>
824
-
<listitem>
825
-
<para>
826
-
Any <literal>MYSQL_TYPE_*</literal> not listed before (there
827
-
should be none) - proto_text_fetched_other
828
-
</para>
829
-
</listitem>
830
-
</itemizedlist>
831
-
<para>
832
-
Note that the MYSQL_*-type constants may not be associated with
833
-
the very same SQL column types in every version of MySQL.
834
-
</para></entry>
835
-
</row>
836
-
<row>
837
-
<entry><literal>proto_binary_fetched_null</literal>,
838
-
<literal>proto_binary_fetched_bit</literal>,
839
-
<literal>proto_binary_fetched_tinyint</literal>
840
-
<literal>proto_binary_fetched_short</literal>,
841
-
<literal>proto_binary_fetched_int24</literal>,
842
-
<literal>proto_binary_fetched_int</literal>,
843
-
<literal>proto_binary_fetched_bigint</literal>,
844
-
<literal>proto_binary_fetched_decimal</literal>,
845
-
<literal>proto_binary_fetched_float</literal>,
846
-
<literal>proto_binary_fetched_double</literal>,
847
-
<literal>proto_binary_fetched_date</literal>,
848
-
<literal>proto_binary_fetched_year</literal>,
849
-
<literal>proto_binary_fetched_time</literal>,
850
-
<literal>proto_binary_fetched_datetime</literal>,
851
-
<literal>proto_binary_fetched_timestamp</literal>,
852
-
<literal>proto_binary_fetched_string</literal>,
853
-
<literal>proto_binary_fetched_blob</literal>,
854
-
<literal>proto_binary_fetched_enum</literal>,
855
-
<literal>proto_binary_fetched_set</literal>,
856
-
<literal>proto_binary_fetched_geometry</literal>,
857
-
<literal>proto_binary_fetched_other</literal></entry>
858
-
<entry>Connection</entry>
859
-
<entry>Total number of columns of a certain type fetched from a prepared
860
-
statement (MySQL binary protocol).</entry>
861
-
<entry>For type mapping see <literal>proto_text_*</literal> described in the
862
-
preceding text.</entry>
863
-
</row>
864
-
</tbody>
865
-
</tgroup>
866
-
</table>
867
-
<table xml:id="mysqlnd.stats.connection">
868
-
<title>Returned mysqlnd statistics: Connection</title>
869
-
<tgroup cols="4">
870
-
<colspec colwidth="10*"/>
871
-
<colspec colwidth="10*"/>
872
-
<colspec colwidth="40*"/>
873
-
<colspec colwidth="40*"/>
874
-
<thead>
875
-
<row>
876
-
<entry>Statistic</entry>
877
-
<entry>Scope</entry>
878
-
<entry>Description</entry>
879
-
<entry>Notes</entry>
880
-
</row>
881
-
</thead>
882
-
<tbody>
883
-
<row>
884
-
<entry><literal>connect_success</literal>, <literal>connect_failure</literal></entry>
885
-
<entry>Connection</entry>
886
-
<entry>Total number of successful / failed connection attempt.</entry>
887
-
<entry>Reused connections and all other kinds of connections are included.</entry>
888
-
</row>
889
-
<row>
890
-
<entry><literal>reconnect</literal></entry>
891
-
<entry>Process</entry>
892
-
<entry>Total number of (real_)connect attempts made on an already opened
893
-
connection handle.</entry>
894
-
<entry>The code sequence <literal>$link = new mysqli(...);
895
-
$link-&gt;real_connect(...)</literal> will cause a reconnect. But
896
-
<literal>$link = new mysqli(...); $link-&gt;connect(...)</literal>
897
-
will not because <literal>$link-&gt;connect(...)</literal> will
898
-
explicitly close the existing connection before a new connection
899
-
is established.</entry>
900
-
</row>
901
-
<row>
902
-
<entry><literal>pconnect_success</literal></entry>
903
-
<entry>Connection</entry>
904
-
<entry>Total number of successful persistent connection attempts.</entry>
905
-
<entry>Note that <literal>connect_success</literal> holds the sum of successful
906
-
persistent and non-persistent connection attempts. The number of
907
-
successful non-persistent connection attempts is
908
-
<literal>connect_success</literal> -
909
-
<literal>pconnect_success</literal>.</entry>
910
-
</row>
911
-
<row>
912
-
<entry><literal>active_connections</literal></entry>
913
-
<entry>Connection</entry>
914
-
<entry>Total number of active persistent and non-persistent connections.</entry>
915
-
<entry></entry>
916
-
</row>
917
-
<row>
918
-
<entry><literal>active_persistent_connections</literal></entry>
919
-
<entry>Connection</entry>
920
-
<entry>Total number of active persistent connections.</entry>
921
-
<entry>The total number of active non-persistent connections is
922
-
<literal>active_connections</literal> -
923
-
<literal>active_persistent_connections</literal>.</entry>
924
-
</row>
925
-
<row>
926
-
<entry><literal>explicit_close</literal></entry>
927
-
<entry>Connection</entry>
928
-
<entry>Total number of explicitly closed connections (ext/mysqli only).</entry>
929
-
<entry>Examples of code snippets that cause an explicit close :
930
-
<programlisting>
1365
+
<programlisting>
931
1366
<![CDATA[
932
-
$link = new mysqli(...); $link->close(...)
933
-
$link = new mysqli(...); $link->connect(...)
1367
+
$link = new mysqli(/* ... */);
1368
+
$link->real_connect(/* ... */);
934
1369
]]>
935
-
</programlisting></entry>
936
-
</row>
937
-
<row>
938
-
<entry><literal>implicit_close</literal></entry>
939
-
<entry>Connection</entry>
940
-
<entry>Total number of implicitly closed connections (ext/mysqli only).</entry>
941
-
<entry>Examples of code snippets that cause an implicit close :
942
-
<itemizedlist>
943
-
<listitem>
944
-
<para>
945
-
<literal>$link = new mysqli(...);
946
-
$link-&gt;real_connect(...)</literal>
947
-
</para>
1370
+
</programlisting>
948
1371
</listitem>
949
1372
<listitem>
950
-
<para>
951
-
<literal>unset($link)</literal>
952
-
</para>
1373
+
<programlisting>
1374
+
<code>unset($link)</code>
1375
+
</programlisting>
953
1376
</listitem>
954
1377
<listitem>
955
-
<para>
1378
+
<simpara>
956
1379
Persistent connection: pooled connection has been created with
957
1380
real_connect and there may be unknown options set - close
958
1381
implicitly to avoid returning a connection with unknown options
959
-
</para>
1382
+
</simpara>
960
1383
</listitem>
961
1384
<listitem>
962
-
<para>
1385
+
<simpara>
963
1386
Persistent connection: ping/change_user fails and ext/mysqli
964
1387
closes the connection
965
-
</para>
1388
+
</simpara>
966
1389
</listitem>
967
1390
<listitem>
968
-
<para>
969
-
end of script execution: close connections that have not been
1391
+
<simpara>
1392
+
End of script execution: close connections that have not been
970
1393
closed by the user
971
-
</para>
1394
+
</simpara>
972
1395
</listitem>
973
-
</itemizedlist></entry>
974
-
</row>
975
-
<row>
976
-
<entry><literal>disconnect_close</literal></entry>
977
-
<entry>Connection</entry>
978
-
<entry>Connection failures indicated by the C API call
979
-
<function>mysql_real_connect</function> during an attempt to
980
-
establish a connection.</entry>
981
-
<entry>It is called <literal>disconnect_close</literal> because the connection
982
-
handle passed to the C API call will be closed.</entry>
983
-
</row>
984
-
<row>
985
-
<entry><literal>in_middle_of_command_close</literal></entry>
986
-
<entry>Process</entry>
987
-
<entry>A connection has been closed in the middle of a command execution
1396
+
</itemizedlist>
1397
+
</example>
1398
+
</listitem>
1399
+
</varlistentry>
1400
+

1401
+
<varlistentry xml:id="mysqlnd.stats.statistics.disconnect-close">
1402
+
<term><literal>disconnect_close</literal></term>
1403
+
<listitem>
1404
+
<simpara>
1405
+
Connection failures indicated by the C API call
1406
+
<literal>mysql_real_connect</literal> during an attempt to
1407
+
establish a connection.
1408
+
</simpara>
1409
+
</listitem>
1410
+
</varlistentry>
1411
+

1412
+
<varlistentry xml:id="mysqlnd.stats.statistics.in-middle-of-command-close">
1413
+
<term><literal>in_middle_of_command_close</literal></term>
1414
+
<listitem>
1415
+
<simpara>
1416
+
This is a process level scope statistic.
1417
+
</simpara>
1418
+
<simpara>
1419
+
A connection has been closed in the middle of a command execution
988
1420
(outstanding result sets not fetched, after sending a query and
989
1421
before retrieving an answer, while fetching data, while
990
-
transferring data with LOAD DATA).</entry>
991
-
<entry>Unless you use asynchronous queries this should only happen if your
992
-
script stops unexpectedly and PHP shuts down the connections for
993
-
you.</entry>
994
-
</row>
995
-
<row>
996
-
<entry><literal>init_command_executed_count</literal></entry>
997
-
<entry>Connection</entry>
998
-
<entry>Total number of init command executions, for example,
999
-
<literal>mysqli_options(MYSQLI_INIT_COMMAND , ...)</literal>.</entry>
1000
-
<entry>The number of successful executions is
1001
-
<literal>init_command_executed_count</literal> -
1002
-
<literal>init_command_failed_count</literal>.</entry>
1003
-
</row>
1004
-
<row>
1005
-
<entry><literal>init_command_failed_count</literal></entry>
1006
-
<entry>Connection</entry>
1007
-
<entry>Total number of failed init commands.</entry>
1008
-
<entry></entry>
1009
-
</row>
1010
-
</tbody>
1011
-
</tgroup>
1012
-
</table>
1013
-
<table xml:id="mysqlnd.stats.com">
1014
-
<title>Returned mysqlnd statistics: COM_* Command</title>
1015
-
<tgroup cols="4">
1016
-
<colspec colwidth="10*"/>
1017
-
<colspec colwidth="10*"/>
1018
-
<colspec colwidth="40*"/>
1019
-
<colspec colwidth="40*"/>
1020
-
<thead>
1021
-
<row>
1022
-
<entry>Statistic</entry>
1023
-
<entry>Scope</entry>
1024
-
<entry>Description</entry>
1025
-
<entry>Notes</entry>
1026
-
</row>
1027
-
</thead>
1028
-
<tbody>
1029
-
<row>
1030
-
<entry><literal>com_quit</literal>, <literal>com_init_db</literal>,
1031
-
<literal>com_query</literal>, <literal>com_field_list</literal>,
1032
-
<literal>com_create_db</literal>, <literal>com_drop_db</literal>,
1033
-
<literal>com_refresh</literal>, <literal>com_shutdown</literal>,
1034
-
<literal>com_statistics</literal>,
1035
-
<literal>com_process_info</literal>,
1036
-
<literal>com_connect</literal>,
1037
-
<literal>com_process_kill</literal>, <literal>com_debug</literal>,
1038
-
<literal>com_ping</literal>, <literal>com_time</literal>,
1039
-
<literal>com_delayed_insert</literal>,
1040
-
<literal>com_change_user</literal>,
1041
-
<literal>com_binlog_dump</literal>,
1042
-
<literal>com_table_dump</literal>,
1043
-
<literal>com_connect_out</literal>,
1044
-
<literal>com_register_slave</literal>,
1045
-
<literal>com_stmt_prepare</literal>,
1046
-
<literal>com_stmt_execute</literal>,
1047
-
<literal>com_stmt_send_long_data</literal>,
1048
-
<literal>com_stmt_close</literal>,
1049
-
<literal>com_stmt_reset</literal>,
1050
-
<literal>com_stmt_set_option</literal>,
1051
-
<literal>com_stmt_fetch</literal>, <literal>com_daemon</literal></entry>
1052
-
<entry>Connection</entry>
1053
-
<entry>Total number of attempts to send a certain COM_* command from PHP to
1054
-
MySQL.</entry>
1055
-
<entry><para>
1056
-
The statistics are incremented after checking the line and
1057
-
immediately before sending the corresponding MySQL client server
1058
-
protocol packet. If mysqlnd fails to send the packet over the
1059
-
wire the statistics will not be decremented. In case of a failure
1060
-
mysqlnd emits a PHP warning <quote>Error while sending %s packet.
1061
-
PID=%d.</quote>
1062
-
</para>
1422
+
transferring data with LOAD DATA).
1423
+
</simpara>
1424
+
<warning>
1425
+
<simpara>
1426
+
Unless asynchronous queries are used,
1427
+
this should only happen if the PHP application terminated unexpectedly,
1428
+
and PHP shuts down the connection automatically.
1429
+
</simpara>
1430
+
</warning>
1431
+
</listitem>
1432
+
</varlistentry>
1063
1433

1064
-
<para>
1065
-
Usage examples:
1066
-
</para>
1434
+
<varlistentry xml:id="mysqlnd.stats.statistics.init-command-executed-count">
1435
+
<term><literal>init_command_executed_count</literal></term>
1436
+
<listitem>
1437
+
<simpara>
1438
+
Total number of init command executions.
1439
+
For example: <code>mysqli_options(MYSQLI_INIT_COMMAND , $value)</code>.
1440
+
</simpara>
1441
+
<simpara>
1442
+
The number of successful executions is
1443
+
<literal>init_command_executed_count - init_command_failed_count</literal>.
1444
+
</simpara>
1445
+
</listitem>
1446
+
</varlistentry>
1447
+

1448
+
<varlistentry xml:id="mysqlnd.stats.statistics.init-command-failed-count">
1449
+
<term><literal>init_command_failed_count</literal></term>
1450
+
<listitem>
1451
+
<simpara>
1452
+
Total number of failed init commands.
1453
+
</simpara>
1454
+
</listitem>
1455
+
</varlistentry>
1456
+
</variablelist>
1457
+

1458
+
<variablelist>
1459
+
<title><literal>COM_*</literal> Command Related Statistics</title>
1460
+

1461
+
<varlistentry xml:id="mysqlnd.stats.statistics.com">
1462
+
<term><literal>com_quit</literal></term>
1463
+
<term><literal>com_init_db</literal></term>
1464
+
<term><literal>com_query</literal></term>
1465
+
<term><literal>com_field_list</literal></term>
1466
+
<term><literal>com_create_db</literal></term>
1467
+
<term><literal>com_drop_db</literal></term>
1468
+
<term><literal>com_refresh</literal></term>
1469
+
<term><literal>com_shutdown</literal></term>
1470
+
<term><literal>com_statistics</literal></term>
1471
+
<term><literal>com_process_info</literal></term>
1472
+
<term><literal>com_connect</literal></term>
1473
+
<term><literal>com_process_kill</literal></term>
1474
+
<term><literal>com_debug</literal></term>
1475
+
<term><literal>com_ping</literal></term>
1476
+
<term><literal>com_time</literal></term>
1477
+
<term><literal>com_delayed_insert</literal></term>
1478
+
<term><literal>com_change_user</literal></term>
1479
+
<term><literal>com_binlog_dump</literal></term>
1480
+
<term><literal>com_table_dump</literal></term>
1481
+
<term><literal>com_connect_out</literal></term>
1482
+
<term><literal>com_register_slave</literal></term>
1483
+
<term><literal>com_stmt_prepare</literal></term>
1484
+
<term><literal>com_stmt_execute</literal></term>
1485
+
<term><literal>com_stmt_send_long_data</literal></term>
1486
+
<term><literal>com_stmt_close</literal></term>
1487
+
<term><literal>com_stmt_reset</literal></term>
1488
+
<term><literal>com_stmt_set_option</literal></term>
1489
+
<term><literal>com_stmt_fetch</literal></term>
1490
+
<term><literal>com_daemon</literal></term>
1491
+
<listitem>
1492
+
<simpara>
1493
+
Total number of attempts to send a certain <literal>COM_*</literal>
1494
+
command from PHP to MySQL.
1495
+
</simpara>
1496
+
<simpara>
1497
+
The statistics are incremented after checking the line and immediately
1498
+
before sending the corresponding MySQL client server protocol packet.
1499
+
</simpara>
1500
+
<caution>
1501
+
<simpara>
1502
+
If MySQLnd fails to send the packet over the wire the statistics will not be decremented.
1503
+
In case of a failure MySQLnd emits a PHP warning
1504
+
<quote>Error while sending %s packet. PID=%d.</quote>
1505
+
</simpara>
1506
+
</caution>
1507
+

1508
+
<example>
1509
+
<title>Usage examples</title>
1067
1510
<itemizedlist>
1068
1511
<listitem>
1069
1512
<para>
...
...
@@ -1091,98 +1534,100 @@ $link = new mysqli(...); $link->connect(...)
1091
1534
<literal>COM_EXECUTE</literal>
1092
1535
</para>
1093
1536
</listitem>
1094
-
</itemizedlist></entry>
1095
-
</row>
1096
-
</tbody>
1097
-
</tgroup>
1098
-
</table>
1099
-
<para>
1100
-
<emphasis role="bold">Miscellaneous</emphasis>
1101
-
</para>
1102
-
<table xml:id="mysqlnd.stats.misc">
1103
-
<title>Returned mysqlnd statistics: Miscellaneous</title>
1104
-
<tgroup cols="4">
1105
-
<colspec colwidth="10*"/>
1106
-
<colspec colwidth="10*"/>
1107
-
<colspec colwidth="40*"/>
1108
-
<colspec colwidth="40*"/>
1109
-
<thead>
1110
-
<row>
1111
-
<entry>Statistic</entry>
1112
-
<entry>Scope</entry>
1113
-
<entry>Description</entry>
1114
-
<entry>Notes</entry>
1115
-
</row>
1116
-
</thead>
1117
-
<tbody>
1118
-
<row>
1119
-
<entry><literal>explicit_stmt_close</literal>,
1120
-
<literal>implicit_stmt_close</literal></entry>
1121
-
<entry>Process</entry>
1122
-
<entry>Total number of close prepared statements.</entry>
1123
-
<entry>A close is always considered explicit but for a failed prepare.</entry>
1124
-
</row>
1125
-
<row>
1126
-
<entry><literal>mem_emalloc_count</literal>,
1127
-
<literal>mem_emalloc_ammount</literal>,
1128
-
<literal>mem_ecalloc_count</literal>,
1129
-
<literal>mem_ecalloc_ammount</literal>,
1130
-
<literal>mem_erealloc_count</literal>,
1131
-
<literal>mem_erealloc_ammount</literal>,
1132
-
<literal>mem_efree_count</literal>,
1133
-
<literal>mem_malloc_count</literal>,
1134
-
<literal>mem_malloc_ammount</literal>,
1135
-
<literal>mem_calloc_count</literal>,
1136
-
<literal>mem_calloc_ammount</literal>,
1137
-
<literal>mem_realloc_count</literal>,
1138
-
<literal>mem_realloc_ammount</literal>,
1139
-
<literal>mem_free_count</literal></entry>
1140
-
<entry>Process</entry>
1141
-
<entry>Memory management calls.</entry>
1142
-
<entry>Development only.</entry>
1143
-
</row>
1144
-
<row>
1145
-
<entry><literal>command_buffer_too_small</literal></entry>
1146
-
<entry>Connection</entry>
1147
-
<entry>Number of network command buffer extensions while sending commands from
1148
-
PHP to MySQL.</entry>
1149
-
<entry><para>
1150
-
mysqlnd allocates an internal command/network buffer of
1151
-
<literal>mysqlnd.net_cmd_buffer_size</literal>
1152
-
(<filename>php.ini</filename>) bytes for every connection. If a
1153
-
MySQL Client Server protocol command, for example,
1154
-
<literal>COM_QUERY</literal> (normal query), does not fit into
1155
-
the buffer, mysqlnd will grow the buffer to what is needed for
1156
-
sending the command. Whenever the buffer gets extended for one
1157
-
connection <literal>command_buffer_too_small</literal> will be
1158
-
incremented by one.
1159
-
</para>
1537
+
</itemizedlist>
1538
+
</example>
1539
+
</listitem>
1540
+
</varlistentry>
1541
+
</variablelist>
1160
1542

1161
-
<para>
1162
-
If mysqlnd has to grow the buffer beyond its initial size of
1163
-
<literal>mysqlnd.net_cmd_buffer_size</literal>
1164
-
(<filename>php.ini</filename>) bytes for almost every connection,
1165
-
you should consider to increase the default size to avoid
1166
-
re-allocations.
1167
-
</para>
1543
+
<variablelist>
1544
+
<title>Miscellaneous Statistics</title>
1168
1545

1169
-
<para>
1170
-
The default buffer size is 4096 bytes, which is the smallest value possible. The default can
1171
-
changed either through the <filename>php.ini</filename> setting
1172
-
<literal>mysqlnd.net_cmd_buffer_size</literal> or using
1173
-
<literal>mysqli_options(MYSQLI_OPT_NET_CMD_BUFFER_SIZE, int
1174
-
size)</literal>.
1175
-
</para></entry>
1176
-
</row>
1177
-
<row>
1178
-
<entry><literal>connection_reused</literal></entry>
1179
-
<entry></entry>
1180
-
<entry></entry>
1181
-
<entry></entry>
1182
-
</row>
1183
-
</tbody>
1184
-
</tgroup>
1185
-
</table>
1546
+
<varlistentry xml:id="mysqlnd.stats.statistics.stmt-close">
1547
+
<term><literal>explicit_stmt_close</literal></term>
1548
+
<term><literal>implicit_stmt_close</literal></term>
1549
+
<listitem>
1550
+
<simpara>
1551
+
This is a process level scope statistic.
1552
+
</simpara>
1553
+
<simpara>
1554
+
Total number of closed prepared statements.
1555
+
</simpara>
1556
+
<note>
1557
+
<simpara>
1558
+
A prepared statement is always explicitly closed. The only time it's closed implicitly is when preparing it fails.
1559
+
</simpara>
1560
+
</note>
1561
+
</listitem>
1562
+
</varlistentry>
1563
+

1564
+
<varlistentry xml:id="mysqlnd.stats.statistics.memory-management">
1565
+
<term><literal>mem_emalloc_count</literal></term>
1566
+
<term><literal>mem_emalloc_ammount</literal></term>
1567
+
<term><literal>mem_ecalloc_count</literal></term>
1568
+
<term><literal>mem_ecalloc_ammount</literal></term>
1569
+
<term><literal>mem_realloc_count</literal></term>
1570
+
<term><literal>mem_realloc_ammount</literal></term>
1571
+
<term><literal>mem_efree_count</literal></term>
1572
+
<term><literal>mem_malloc_count</literal></term>
1573
+
<term><literal>mem_malloc_ammount</literal></term>
1574
+
<term><literal>mem_calloc_count</literal></term>
1575
+
<term><literal>mem_calloc_ammount</literal></term>
1576
+
<term><literal>mem_ealloc_count</literal></term>
1577
+
<term><literal>mem_ealloc_ammount</literal></term>
1578
+
<term><literal>mem_free_count</literal></term>
1579
+
<listitem>
1580
+
<simpara>
1581
+
This is a process level scope statistic.
1582
+
</simpara>
1583
+
<simpara>
1584
+
Memory management calls.
1585
+
</simpara>
1586
+
</listitem>
1587
+
</varlistentry>
1588
+

1589
+
<varlistentry xml:id="mysqlnd.stats.statistics.command-buffer-too-small">
1590
+
<term><literal>command_buffer_too_small</literal></term>
1591
+
<!-- TODO: XInclude/sync description of INI setting
1592
+
ini.mysqlnd.net-cmd-buffer-size with this statistic -->
1593
+
<listitem>
1594
+
<simpara>
1595
+
Number of network command buffer extensions while sending commands from
1596
+
PHP to MySQL.
1597
+
</simpara>
1598
+
<simpara>
1599
+
MySQLnd allocates an internal command/network buffer of
1600
+
<link linkend="ini.mysqlnd.net-cmd-buffer-size">mysqlnd.net_cmd_buffer_size</link>
1601
+
bytes for every connection.
1602
+
</simpara>
1603
+
<simpara>
1604
+
If a MySQL Client Server protocol command,
1605
+
e.g. <literal>COM_QUERY</literal> (normal query),
1606
+
does not fit into the buffer,
1607
+
MySQLnd will grow the buffer to what is needed for sending the command.
1608
+
Whenever the buffer gets extended for one connection
1609
+
<literal>command_buffer_too_small</literal> will be incremented by one.
1610
+
</simpara>
1611
+
<simpara>
1612
+
If MySQLnd has to grow the buffer beyond its initial size of
1613
+
<link linkend="ini.mysqlnd.net-cmd-buffer-size">mysqlnd.net_cmd_buffer_size</link>
1614
+
bytes for almost every connection,
1615
+
considerations to increase the default size should be made to avoid
1616
+
re-allocations.
1617
+
</simpara>
1618
+
</listitem>
1619
+
</varlistentry>
1620
+

1621
+
<varlistentry xml:id="mysqlnd.stats.statistics.connection-reused">
1622
+
<term><literal>connection_reused</literal></term>
1623
+
<listitem>
1624
+
<simpara>
1625
+
The total number of times a persistent connection has been reused.
1626
+
</simpara>
1627
+
</listitem>
1628
+
</varlistentry>
1629
+
</variablelist>
1630
+
</section>
1186
1631
</chapter>
1187
1632
<!-- Keep this comment at the end of the file
1188
1633
Local variables:
1189
1634