Skip to main content

system.query_log

A read-only in-memory table stores all the query logs;

MySQL [(none)]> select * from system.query_log limit 1;
+----------+--------------+-----------+------------+----------+---------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------+------------+--------------------------------+------------+-------------------------+------------------+-----------+--------+---------+-------------+--------------+---------------+------------------+--------------------------+-----------+------------+---------------+-----------------------+-----------------+------------------+-------------+--------------+-----------+--------------+-------------+-----------------------+----------------+----------------+-------------+----------------+-------+
| log_type | handler_type | tenant_id | cluster_id | sql_user | sql_user_quota | sql_user_privileges | query_id | query_kind | query_text | event_date | event_time | current_database | databases | tables | columns | projections | written_rows | written_bytes | written_io_bytes | written_io_bytes_cost_ms | scan_rows | scan_bytes | scan_io_bytes | scan_io_bytes_cost_ms | scan_partitions | total_partitions | result_rows | result_bytes | cpu_usage | memory_usage | client_info | client_address | exception_code | exception_text | stack_trace | server_version | extra |
+----------+--------------+-----------+------------+----------+---------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------+------------+--------------------------------+------------+-------------------------+------------------+-----------+--------+---------+-------------+--------------+---------------+------------------+--------------------------+-----------+------------+---------------+-----------------------+-----------------+------------------+-------------+--------------+-----------+--------------+-------------+-----------------------+----------------+----------------+-------------+----------------+-------+
| 1 | MySQL | admin | | root | UserQuota { max_cpu: 0, max_memory_in_bytes: 0, max_storage_in_bytes: 0 } | UserGrantSet { entries: [GrantEntry { user: "root", host_pattern: "127.0.0.1", object: Global, privileges: BitFlags<UserPrivilegeType>(0b1111111101111, Usage | Select | Insert | Update | Delete | Create | Drop | Alter | Super | CreateUser | CreateRole | Grant) }], roles: {} } | f178084a-cae0-422d-887d-422cb4a8f14e | SelectPlan | select * from system.query_log | 2022-03-09 | 2022-03-09 03:44:21.450 | default | | | | | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 32 | 2672 | | Some(127.0.0.1:55362) | 0 | | | | |
+----------+--------------+-----------+------------+----------+---------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------+------------+--------------------------------+------------+-------------------------+------------------+-----------+--------+---------+-------------+--------------+---------------+------------------+--------------------------+-----------+------------+---------------+-----------------------+-----------------+------------------+-------------+--------------+-----------+--------------+-------------+-----------------------+----------------+----------------+-------------+----------------+-------+
1 row in set (0.024 sec)