Information Schema QUERY_CACHE_INFO Table

Description

The table is not a standard Information Schema table, and is a MariaDB extension.

The QUERY_CACHE_INFO table is created by the QUERY_CACHE_INFO plugin, and allows you to see the contents of the query cache. It creates a table in the information_schema database that shows all queries that are in the cache. You must have the PROCESS privilege (see GRANT) to use this table.

It contains the following columns:

Column Description
STATEMENT_SCHEMA Database used when query was included
STATEMENT_TEXT Query text
RESULT_BLOCKS_COUNT Number of result blocks
RESULT_BLOCKS_SIZE Size in bytes of result blocks
RESULT_BLOCKS_SIZE_USED Size in bytes of used blocks
LIMIT Added MariaDB 10.1.8.
MAX_SORT_LENGTH Added MariaDB 10.1.8.
GROUP_CONCAT_MAX_LENGTH Added MariaDB 10.1.8.
CHARACTER_SET_CLIENT Added MariaDB 10.1.8.
CHARACTER_SET_RESULT Added MariaDB 10.1.8.
COLLATION Added MariaDB 10.1.8.
TIMEZONE Added MariaDB 10.1.8.
DEFAULT_WEEK_FORMAT Added MariaDB 10.1.8.
DIV_PRECISION_INCREMENT Added MariaDB 10.1.8.
SQL_MODE Added MariaDB 10.1.8.
LC_TIME_NAMES Added MariaDB 10.1.8.
CLIENT_LONG_FLAG Added MariaDB 10.1.8.
CLIENT_PROTOCOL_41 Added MariaDB 10.1.8.
PROTOCOL_TYPE Added MariaDB 10.1.8.
MORE_RESULTS_EXISTS Added MariaDB 10.1.8.
IN_TRANS Added MariaDB 10.1.8.
AUTOCOMMIT Added MariaDB 10.1.8.
PACKET_NUMBER Added MariaDB 10.1.8.
HITS Incremented each time the query cache is hit. Added MariaDB 10.3.2.

For example:

SELECT * FROM information_schema.QUERY_CACHE_INFO;
+------------------+-----------------+---------------------+--------------------+-------------------------+
| STATEMENT_SCHEMA | STATEMENT_TEXT  | RESULT_BLOCKS_COUNT | RESULT_BLOCKS_SIZE | RESULT_BLOCKS_SIZE_USED |
+------------------+-----------------+---------------------+--------------------+-------------------------+
...
| test             | SELECT * FROM a |                   1 |                512 |                     143 |
| test             | select * FROM a |                   1 |                512 |                     143 |
...
+------------------+-----------------+---------------------+--------------------+-------------------------
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.

© 2021 MariaDB
Licensed under the Creative Commons Attribution 3.0 Unported License and the GNU Free Documentation License.
https://mariadb.com/kb/en/information-schema-query_cache_info-table/