Bug #9141 4.1 does not log into slow log ALTER, OPTIMIZE and ANALYZE statements
Submitted: 12 Mar 2005 10:11 Modified: 26 Jul 2005 15:47
Reporter: Alexander Keremidarski
Status: Closed
Category:Server: Replication Severity:S3 (Non-critical)
Version:4.1.10 OS:Any (any)
Assigned to: Bugs System Target Version:

[12 Mar 2005 10:11] Alexander Keremidarski
Description:
Synposys says it all.

Untill 4.0 all "slow" sattements were logged. 
4.1 does not log ALTER, CREATE|DROP INDEX (which are mapped to ALTER), OPTIMIZE and
ANALYZE

With regard of the fact that all these sattements are locking the table they are very
expensive from performance standpoint. 

Furthermore the changes section of the manual say nothing about such change in slow log
behaviour.

How to repeat:
Create random MyISAM table, populate it with lot of data so each of the ANALYZE, OPTIMIZE
and ALTER TABLE take more than long_query_time treshold 

Observe that none of these statements appears in slow log.
[12 Mar 2005 11:20] Sergei Golubchik
It was implemented in 4.1.1

namely, BACKUP TABLE, RESTORE TABLE,  CREATE INDEX, ALTER TABLE,  REPAIR, CHECK, ANALYZE,
OPTIMIZE do not go into slow log.

We'll fix the manual
[12 Mar 2005 16:43] Alexander Keremidarski
What is the reason behind this change?
What kind of problems does it resolve?

slow_log is primary optimization tool for MySQL.
Limiting its functionality makes it less helpful in perfomance tuning.
[9 Jun 2005 8:36] Konstantin Osipov
Salle,
will it be OK if I add ALTER, OPTIMIZE, ANALYZE to the slow query log if the option
--log-slow-queries-not-using-indexes is set?
Or you need for this feature it's own name?
[11 Jun 2005 13:40] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/25901
[16 Jun 2005 21:06] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/26090
[16 Jun 2005 21:10] Konstantin Osipov
Added option --log-slow-admin-statements into 4.1, currently tagged 4.1.13
[17 Jun 2005 4:53] Paul DuBois
Noted in 4.1.13 changelog, slow query log
section, and server options section.
[25 Jul 2005 20:09] Elliot Murphy
Re-opening bug as Binlog Dump command needs to be updated in the same way.
[25 Jul 2005 21:58] Elliot Murphy
Hmm, reviewing the current 4.1 code, it appears that the original patch already set
thd->enable_slow_log= opt_log_slow_admin_statements for COM_BINLOG_DUMP, just like it is
done for SQLCOM_CHECK, SQLCOM_ANALYZE, and others.