mysql.slow_log Table

The mysql.slow_log table stores the contents of the Slow Query Log if slow logging is active and the output is being written to table (see Writing logs into tables).

It contains the following fields:

Field Type Null Key Default Description
start_time timestamp(6) NO CURRENT_TIMESTAMP(6) Time the query began.
user_host mediumtext NO NULL User and host combination.
query_time time(6) NO NULL Total time the query took to execute.
lock_time time(6) NO NULL Total time the query was locked.
rows_sent int(11) NO NULL Number of rows sent.
rows_examined int(11) NO NULL Number of rows examined.
db varchar(512) NO NULL Default database.
last_insert_id int(11) NO NULL last_insert_id.
insert_id int(11) NO NULL Insert id.
server_id int(10) unsigned NO NULL The server's id.
sql_text mediumtext NO NULL Full query.
thread_id bigint(21) unsigned NO NULL Thread id.
rows_affected int(11) NO NULL Number of rows affected by an UPDATE or DELETE (from MariaDB 10.1.2)

Example

SELECT * FROM mysql.slow_log\G
...
*************************** 2. row ***************************
    start_time: 2014-11-11 07:56:28.721519
     user_host: root[root] @ localhost []
    query_time: 00:00:12.000215
     lock_time: 00:00:00.000000
     rows_sent: 1
 rows_examined: 0
            db: test
last_insert_id: 0
     insert_id: 0
     server_id: 1
      sql_text: SELECT SLEEP(12)
     thread_id: 74
...
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/mysqlslow_log-table/