Bug #93963 Slow query log doesn't log a slow CREATE INDEX with admin statements enabled
Submitted: 17 Jan 12:56 Modified: 21 Feb 3:08
Reporter: Jeremy Smyth Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Logging Severity:S3 (Non-critical)
Version:8.0.13 OS:Any
Assigned to: CPU Architecture:Any
Tags: regression, slow query log

[17 Jan 12:56] Jeremy Smyth
Description:
When log_slow_admin_statements is ON and long_query_time suitably low, an 8-second CREATE INDEX statement was logged to the slow query log in 5.7 but is not in 8.0.13.

How to repeat:
SET SESSION long_query_time=0.5;
SET GLOBAL log_output='TABLE';
SET GLOBAL slow_query_log=ON;
USE employees;

SELECT emp_no, salary FROM salaries
  WHERE from_date BETWEEN '1986-01-01' AND '1986-01-07'
  ORDER BY from_date, salary;
-- is logged

SET GLOBAL log_slow_admin_statements=ON;

CREATE INDEX from_date ON salaries(from_date);
-- should be logged but isn't, and was in 5.7
[18 Jan 12:30] Umesh Shastry
Hello Jeremy,

Thank you for the report!

regards,
Umesh
[21 Feb 3:08] Paul Dubois
Posted by developer:
 
Fixed in 8.0.16.

The server could fail to write slow queries to the slow query log due
to incorrect calculation of query execution time.