Most statistics are associated to a connection, but some are associated
to the process in which case this will be mentioned.
Network Related Statistics
bytes_sent
-
Number of bytes sent from PHP to the MySQL server.
bytes_received
-
Number of bytes received from the MySQL server.
packets_sent
-
Number of packets sent by the MySQL Client Server protocol.
packets_received
-
Number of packets received from the MySQL Client Server protocol.
protocol_overhead_in
-
MySQL Client Server protocol overhead in bytes for incoming traffic.
Currently only the Packet Header (4 bytes) is considered as overhead.
protocol_overhead_in = packets_received * 4
protocol_overhead_out
-
MySQL Client Server protocol overhead in bytes for outgoing traffic.
Currently only the Packet Header (4 bytes) is considered as overhead.
protocol_overhead_out = packets_received * 4
bytes_received_ok_packet
-
Total size of bytes of MySQL Client Server protocol OK packets received.
OK packets can contain a status message.
The length of the status message can vary and thus the size of an OK
packet is not fixed.
Note:
The total size in bytes includes the size of the header packet
(4 bytes, see protocol overhead).
packets_received_ok
-
Number of MySQL Client Server protocol OK packets received.
bytes_received_eof_packet
-
Total size in bytes of MySQL Client Server protocol EOF packets received.
EOF can vary in size depending on the server version.
Also, EOF can transport an error message.
Note:
The total size in bytes includes the size of the header packet
(4 bytes, see protocol overhead).
packets_received_eof
-
Number of MySQL Client Server protocol EOF packets.
Like with other packet statistics the number of packets will be
increased even if PHP does not receive the expected packet but,
for example, an error message.
-
Total size in bytes of MySQL Client Server protocol result set header
packets.
The size of the packets varies depending on the payload
(LOAD LOCAL INFILE, INSERT,
UPDATE, SELECT, error message).
Note:
The total size in bytes includes the size of the header packet
(4 bytes, see protocol overhead).
-
Number of MySQL Client Server protocol result set header packets.
bytes_received_rset_field_meta_packet
-
Total size in bytes of MySQL Client Server protocol result set metadata
(field information) packets.
Of course the size varies with the fields in the result set.
The packet may also transport an error or an EOF packet in case of
COM_LIST_FIELDS.
Note:
The total size in bytes includes the size of the header packet
(4 bytes, see protocol overhead).
packets_received_rset_field_meta
-
Number of MySQL Client Server protocol result set metadata
(field information) packets.
bytes_received_rset_row_packet
-
Total size in bytes of MySQL Client Server protocol result set row data
packets.
The packet may also transport an error or an EOF packet.
One can compute the number of error and EOF packets by subtracting
rows_fetched_from_server_normal
and rows_fetched_from_server_ps
from bytes_received_rset_row_packet.
Note:
The total size in bytes includes the size of the header packet
(4 bytes, see protocol overhead).
packets_received_rset_row
-
Number of MySQL Client Server protocol result set row data packets.
bytes_received_prepare_response_packet
-
Total size in bytes of MySQL Client Server protocol OK for Prepared
Statement Initialization packets (prepared statement init packets).
The packet may also transport an error.
The packet size depends on the MySQL version.
Note:
The total size in bytes includes the size of the header packet
(4 bytes, see protocol overhead).
packets_received_prepare_response
-
Number of MySQL Client Server protocol OK for Prepared Statement
Initialization packets (prepared statement init packets).
bytes_received_change_user_packet
-
Total size in bytes of MySQL Client Server protocol COM_CHANGE_USER packets.
The packet may also transport an error or EOF.
Note:
The total size in bytes includes the size of the header packet
(4 bytes, see protocol overhead).
packets_received_change_user
-
Number of MySQL Client Server protocol COM_CHANGE_USER packets.
packets_sent_command
-
Number of MySQL Client Server protocol commands sent from PHP to MySQL.
There is no way to know which specific commands and how many of
them have been sent.
bytes_received_real_data_normal
-
Number of bytes of payload fetched by the PHP client from
mysqlnd using the text protocol.
This is the size of the actual data contained in result sets that do not
originate from prepared statements and which have been fetched by the PHP client.
Note that although a full result set may have been pulled from MySQL
by mysqlnd, this statistic only counts actual data
pulled from mysqlnd by the PHP client.
An example of a code sequence that will increase the value is as follows:
$mysqli = new mysqli();
$res = $mysqli->query("SELECT 'abc'");
$res->fetch_assoc();
$res->close();
Every fetch operation will increase the value.
However, the statistic will not be increased if the result set is only
buffered on the client, but not fetched, such as in the following example:
$mysqli = new mysqli();
$res = $mysqli->query("SELECT 'abc'");
$res->close();
bytes_received_real_data_ps
-
Number of bytes of the payload fetched by the PHP client from
mysqlnd using the prepared statement protocol.
This is the size of the actual data contained in result sets that
originate from prepared statements and which have been fetched by the PHP client.
The value will not be increased if the result set is not subsequently read by the PHP client.
Note that although a full result set may have been pulled from MySQL
by mysqlnd, this statistic only counts actual data
pulled from mysqlnd by the PHP client.
See also bytes_received_real_data_normal.
Result Set Related Statistics
result_set_queries
-
Number of queries that have generated a result set.
Examples of queries that generate a result set:
SELECT, SHOW.
The statistic will not be incremented if there is an error reading
the result set header packet from the line.
Note:
This statistic can be used as an indirect measure for the number of
queries PHP has sent to MySQL.
This could help identifying a client that causes a high database load.
non_result_set_queries
-
Number of queries that did not generate a result set.
Examples of queries that do not generate a result set:
INSERT, UPDATE, LOAD DATA.
The statistic will not be incremented if there is an error reading
the result set header packet from the line.
Note:
This statistic can be used as an indirect measure for the number of
queries PHP has sent to MySQL.
This could help identifying a client that causes a high database load.
no_index_used
-
Number of queries that have generated a result set but did not use an index.
(See also the mysqld start option --log-queries-not-using-indexes).
Note:
Those queries can be reported via an exception by calling
mysqli_report(MYSQLI_REPORT_INDEX);.
It is possible to have them be reported via a warning instead by calling
mysqli_report(MYSQLI_REPORT_INDEX ^ MYSQLI_REPORT_STRICT);.
bad_index_used
-
Number of queries that have generated a result set and did not use a good index.
(See also the mysqld start option --log-slow-queries).
Note:
Those queries can be reported via an exception by calling
mysqli_report(MYSQLI_REPORT_INDEX);.
It is possible to have them be reported via a warning instead by calling
mysqli_report(MYSQLI_REPORT_INDEX ^ MYSQLI_REPORT_STRICT);.
slow_queries
-
SQL statements that took more than long_query_time
seconds to execute and required at least
min_examined_row_limit rows to be examined.
buffered_sets
-
Number of buffered result sets returned by normal
(i.e. not via a prepared statement) queries.
Examples of API calls that will buffer result sets on the client:
mysqli_query(), mysqli_store_result(), mysqli_stmt_get_result()
unbuffered_sets
-
Number of unbuffered result sets returned by normal
(i.e. not via a prepared statement) queries.
Examples of API calls that will not buffer result sets on the client:
mysqli_use_result()
ps_buffered_sets
-
Number of buffered result sets returned by prepared statements.
Examples of API calls that will buffer result sets on the client:
mysqli_stmt_store_result()
ps_unbuffered_sets
-
Number of unbuffered result sets returned by prepared statements.
By default prepared statements are unbuffered,
thus most prepared statements will be accounted in this statistic.
flushed_normal_sets
-
Number of result sets returned by normal
(i.e. not via a prepared statement) queries
with unread data that have been silently flushed.
Note:
Flushing happens only with unbuffered result sets.
Unbuffered result sets must be fetched completely before a new query can
be run on the connection otherwise MySQL will throw an error.
If the application does not fetch all rows from an unbuffered result set,
mysqlnd does implicitly fetch the result set to clear the line.
See also rows_skipped_normal, rows_skipped_ps.
Some possible causes for an implicit flush:
-
Faulty client application
-
Client stopped reading after it found what it was looking for
but has made MySQL calculate more records than needed
-
Client application has stopped unexpectedly
flushed_ps_sets
-
Number of result sets from prepared statements
with unread data that have been silently flushed.
Note:
Flushing happens only with unbuffered result sets.
Unbuffered result sets must be fetched completely before a new query can
be run on the connection otherwise MySQL will throw an error.
If the application does not fetch all rows from an unbuffered result set,
mysqlnd does implicitly fetch the result set to clear the line.
See also rows_skipped_normal, rows_skipped_ps.
Some possible causes for an implicit flush:
-
Faulty client application
-
Client stopped reading after it found what it was looking for
but has made MySQL calculate more records than needed
-
Client application has stopped unexpectedly
ps_prepared_never_executed
-
Number of statements prepared but never executed.
ps_prepared_once_executed
-
Number of prepared statements executed only once.
rows_fetched_from_server_normal
rows_fetched_from_server_ps
-
Total number of result set rows fetched from the server.
This includes the rows which were not read by the client but
had been implicitly fetched due to flushed unbuffered result sets.
See also packets_received_rset_row.
rows_buffered_from_client_normal
-
Total number of buffered rows originating from a normal query.
This is the number of rows that have been fetched from MySQL and buffered on client.
Examples of queries that will buffer results:
rows_buffered_from_client_ps
-
Same as rows_buffered_from_client_normal
but for prepared statements.
rows_fetched_from_client_normal_buffered
-
Total number of rows fetched by the client from a buffered result set
created by a normal query.
rows_fetched_from_client_ps_buffered
-
Total number of rows fetched by the client from a buffered result set
created by a prepared statement.
rows_fetched_from_client_normal_unbuffered
-
Total number of rows fetched by the client from an unbuffered result set
created by a normal query.
rows_fetched_from_client_ps_unbuffered
-
Total number of rows fetched by the client from an unbuffered result set
created by a prepared statement.
rows_fetched_from_client_ps_cursor
-
Total number of rows fetch by the client from a cursor created by a
prepared statement.
rows_skipped_normal
rows_skipped_ps
-
Reserved for future use (currently not supported).
copy_on_write_saved
copy_on_write_performed
-
This is a process level scope statistic.
With mysqlnd, variables returned by the extensions point into mysqlnd
internal network result buffers.
If the data are not changed, the fetched data is kept only once in memory.
However, any modification to the data will require mysqlnd to perform
a copy-on-write operation.
explicit_free_result
implicit_free_result
-
This is a connection and process level scope statistic.
Total number of freed result sets.
proto_text_fetched_null
-
Total number of columns of type
MYSQL_TYPE_NULL
fetched from a normal query (MySQL text protocol).
proto_binary_fetched_null
-
Total number of columns of type
MYSQL_TYPE_NULL
fetched from a prepared statement (MySQL binary protocol).
proto_text_fetched_bit
-
Total number of columns of type
MYSQL_TYPE_BIT
fetched from a normal query (MySQL text protocol).
proto_binary_fetched_bit
-
Total number of columns of type
MYSQL_TYPE_BIT
fetched from a prepared statement (MySQL binary protocol).
proto_text_fetched_tinyint
-
Total number of columns of type
MYSQL_TYPE_TINY
fetched from a normal query (MySQL text protocol).
proto_binary_fetched_tinyint
-
Total number of columns of type
MYSQL_TYPE_TINY
fetched from a prepared statement (MySQL binary protocol).
proto_text_fetched_short
-
Total number of columns of type
MYSQL_TYPE_SHORT
fetched from a normal query (MySQL text protocol).
proto_binary_fetched_short
-
Total number of columns of type
MYSQL_TYPE_SHORT
fetched from a prepared statement (MySQL binary protocol).
proto_text_fetched_int24
-
Total number of columns of type
MYSQL_TYPE_INT24
fetched from a normal query (MySQL text protocol).
proto_binary_fetched_int24
-
Total number of columns of type
MYSQL_TYPE_INT24
fetched from a prepared statement (MySQL binary protocol).
proto_text_fetched_int
-
Total number of columns of type
MYSQL_TYPE_LONG
fetched from a normal query (MySQL text protocol).
proto_binary_fetched_int
-
Total number of columns of type
MYSQL_TYPE_LONG
fetched from a prepared statement (MySQL binary protocol).
proto_text_fetched_bigint
-
Total number of columns of type
MYSQL_TYPE_LONGLONG
fetched from a normal query (MySQL text protocol).
proto_binary_fetched_bigint
-
Total number of columns of type
MYSQL_TYPE_LONGLONG
fetched from a prepared statement (MySQL binary protocol).
proto_text_fetched_decimal
-
Total number of columns of type
MYSQL_TYPE_DECIMAL, or MYSQL_TYPE_NEWDECIMAL
fetched from a normal query (MySQL text protocol).
proto_binary_fetched_decimal
-
Total number of columns of type
MYSQL_TYPE_DECIMAL, or MYSQL_TYPE_NEWDECIMAL
fetched from a prepared statement (MySQL binary protocol).
proto_text_fetched_float
-
Total number of columns of type
MYSQL_TYPE_FLOAT
fetched from a normal query (MySQL text protocol).
proto_binary_fetched_float
-
Total number of columns of type
MYSQL_TYPE_FLOAT
fetched from a prepared statement (MySQL binary protocol).
proto_text_fetched_double
-
Total number of columns of type
MYSQL_TYPE_DOUBLE
fetched from a normal query (MySQL text protocol).
proto_binary_fetched_double
-
Total number of columns of type
MYSQL_TYPE_DOUBLE
fetched from a prepared statement (MySQL binary protocol).
proto_text_fetched_date
-
Total number of columns of type
MYSQL_TYPE_DATE, or MYSQL_TYPE_NEWDATE
fetched from a normal query (MySQL text protocol).
proto_binary_fetched_date
-
Total number of columns of type
MYSQL_TYPE_DATE, or MYSQL_TYPE_NEWDATE
fetched from a prepared statement (MySQL binary protocol).
proto_text_fetched_year
-
Total number of columns of type
MYSQL_TYPE_YEAR
fetched from a normal query (MySQL text protocol).
proto_binary_fetched_year
-
Total number of columns of type
MYSQL_TYPE_YEAR
fetched from a prepared statement (MySQL binary protocol).
proto_text_fetched_time
-
Total number of columns of type
MYSQL_TYPE_TIME
fetched from a normal query (MySQL text protocol).
proto_binary_fetched_time
-
Total number of columns of type
MYSQL_TYPE_TIME
fetched from a prepared statement (MySQL binary protocol).
proto_text_fetched_datetime
-
Total number of columns of type
MYSQL_TYPE_DATETIME
fetched from a normal query (MySQL text protocol).
proto_binary_fetched_datetime
-
Total number of columns of type
MYSQL_TYPE_DATETIME
fetched from a prepared statement (MySQL binary protocol).
proto_text_fetched_timestamp
-
Total number of columns of type
MYSQL_TYPE_TIMESTAMP
fetched from a normal query (MySQL text protocol).
proto_binary_fetched_timestamp
-
Total number of columns of type
MYSQL_TYPE_TIMESTAMP
fetched from a prepared statement (MySQL binary protocol).
proto_text_fetched_string
-
Total number of columns of type
MYSQL_TYPE_STRING, MYSQL_TYPE_VARSTRING, or MYSQL_TYPE_VARCHAR
fetched from a normal query (MySQL text protocol).
proto_binary_fetched_string
-
Total number of columns of type
MYSQL_TYPE_STRING, MYSQL_TYPE_VARSTRING, or MYSQL_TYPE_VARCHAR
fetched from a prepared statement (MySQL binary protocol).
proto_text_fetched_blob
-
Total number of columns of type
MYSQL_TYPE_TINY_BLOB,
MYSQL_TYPE_MEDIUM_BLOB,
MYSQL_TYPE_LONG_BLOB,
or MYSQL_TYPE_BLOB
fetched from a normal query (MySQL text protocol).
proto_binary_fetched_blob
-
Total number of columns of type
MYSQL_TYPE_TINY_BLOB,
MYSQL_TYPE_MEDIUM_BLOB,
MYSQL_TYPE_LONG_BLOB,
or MYSQL_TYPE_BLOB
fetched from a prepared statement (MySQL binary protocol).
proto_text_fetched_enum
-
Total number of columns of type
MYSQL_TYPE_ENUM
fetched from a normal query (MySQL text protocol).
proto_binary_fetched_enum
-
Total number of columns of type
MYSQL_TYPE_ENUM
fetched from a prepared statement (MySQL binary protocol).
proto_text_fetched_set
-
Total number of columns of type
MYSQL_TYPE_SET
fetched from a normal query (MySQL text protocol).
proto_binary_fetched_set
-
Total number of columns of type
MYSQL_TYPE_SET
fetched from a prepared statement (MySQL binary protocol).
proto_text_fetched_geometry
-
Total number of columns of type
MYSQL_TYPE_GEOMETRY
fetched from a normal query (MySQL text protocol).
proto_binary_fetched_geometry
-
Total number of columns of type
MYSQL_TYPE_GEOMETRY
fetched from a prepared statement (MySQL binary protocol).
proto_text_fetched_other
-
Total number of columns of types
MYSQL_TYPE_*
not listed previously
fetched from a normal query (MySQL text protocol).
Note:
In theory, this should always be 0.
proto_binary_fetched_other
-
Total number of columns of type
MYSQL_TYPE_*
not listed previously
fetched from a prepared statement (MySQL binary protocol).
Note:
In theory, this should always be 0.