Таблица mysql.slow_log
Таблица mysql.slow_log хранит содержимое журнала медленных запросов, если медленные запросы активны и вывод записывается в таблицу (см. Запись логов в таблицы).
Она содержит следующие поля:
| Поле | Тип | Null | Ключ | Значение по умолчанию | Описание |
|---|---|---|---|---|---|
start_time |
timestamp(6) |
NO | CURRENT_TIMESTAMP(6) |
Время начала запроса. | |
user_host |
mediumtext |
NO | NULL |
Комбинация пользователя и хоста. | |
query_time |
time(6) |
NO | NULL |
Общее время выполнения запроса. | |
lock_time |
time(6) |
NO | NULL |
Общее время блокировки запроса. | |
rows_sent |
int(11) |
NO | NULL |
Количество отправленных строк. | |
rows_examined |
int(11) |
NO | NULL |
Количество просмотренных строк. | |
db |
varchar(512) |
NO | NULL |
База данных по умолчанию. | |
last_insert_id |
int(11) |
NO | NULL |
last_insert_id. | |
insert_id |
int(11) |
NO | NULL |
Идентификатор вставки. | |
server_id |
int(10) unsigned |
NO | NULL |
Идентификатор сервера. | |
sql_text |
mediumtext |
NO | NULL |
Полный запрос. | |
thread_id |
bigint(21) unsigned |
NO | NULL |
Идентификатор потока. | |
rows_affected |
int(11) |
NO | NULL |
Количество строк, затронутых операциями UPDATE или DELETE (с MariaDB 10.1.2). |
Пример
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.
© 2023 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/