// mysql · logging & diagnostics

log_slow_extra

Add extra fields such as rows sent, bytes and temporary table counts to slow log entries.

默认
OFF
Range
ON, OFF
Restart needed
否
Default checked on
MySQL 8.4 LTS

作用

Available from MySQL 8.0.14 when logging to a file.

默认值

OFF. OFF (MySQL 8.4).

Check the current value

SHOW GLOBAL VARIABLES LIKE 'log_slow_extra';

SELECT VARIABLE_NAME, VARIABLE_SOURCE, MIN_VALUE, MAX_VALUE, SET_TIME
FROM performance_schema.variables_info
WHERE VARIABLE_NAME = 'log_slow_extra';

Change it

SET GLOBAL log_slow_extra = ON;    -- until the next restart
SET PERSIST log_slow_extra = ON;   -- now and after restarts

No restart. SET GLOBAL or SET PERSIST takes effect immediately; SET PERSIST also writes mysqld-auto.cnf so the value survives restarts.

When to change it

Turn it on with the slow log; the extra fields show why a statement was slow.

What can go wrong

Slightly larger log lines.

Questions about log_slow_extra

What is the default value of log_slow_extra in MySQL?

OFF. OFF (MySQL 8.4).

Does changing log_slow_extra require a restart?

No. No restart. SET GLOBAL or SET PERSIST takes effect immediately; SET PERSIST also writes mysqld-auto.cnf so the value survives restarts.

When should I change log_slow_extra?

Turn it on with the slow log; the extra fields show why a statement was slow.

Back to all MySQL settings, or check the MySQL manual for every option.

// one client for every engine

Check log_slow_extra on your own server

SQLly runs the query above against MySQL and the other engines in this reference, from one desktop app on macOS, Windows and Linux.