Bug #63542 Turn slow log off for a session
Submitted: 2 Dec 2011 15:25 Modified: 12 Dec 2011 21:02
Reporter: Peter Laursen (Basic Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:any OS:Any
Assigned to: Paul DuBois CPU Architecture:Any
Tags: qc

[2 Dec 2011 15:25] Peter Laursen
Description:
There is a variable 'sql_log_off'
http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_sql_log_off

"If set to 1, no logging is done to the general query log for this client."

How to repeat:
See above.

Suggested fix:
First: a small docs issue:  *for this session* makes no sense if scope is GLOBAL (what docs say it can be). It think (from comparing with docs for previous versions) that the GLOBAL scope was introduced after this passage was written (5.0 docs tell scope is SESSION only).

Second and more important:  I think it should also turn off logging to slow log (if it does not). A SUPER user may very well execute some queries (maintenance queries, ad-hoc queries) that he knows very well in advance are slow (because indexes are not optimized for such queries - indexes are optimized for applications) and there is no reason to record it in the slow log in such case. It may actually cause unnecessary concern.

Alternatively a seperate variable for slow log could be provided, but I am generally not in favour of more options and variables.

(Except for the small docs issue, I expect this to be classified as a 'feature request' - but no less important IMHO.   Actually I find *protection from irrelevant garbage* more important for the slow log than for the general log. And if the reationale is that a *SUPER user should be allowed to hide* what he he is doing from people having access to the logs, then it does not work fully if not writing to the slow log also gets disabled).
[2 Dec 2011 15:29] Peter Laursen
fixed typo in synopsis.
[2 Dec 2011 18:41] Valeriy Kravchuk
I can accept this as a valid documentation request, but for the rest we do need a separate feature request, as now MySQL works as designed with this variable.
[12 Dec 2011 20:53] Paul DuBois
Quite a few session-only variables were modified in 5.5.3 to also have global values.

Modified description:

This variable controls whether logging to the binary log is done. The
default value is 1 (do logging). To change logging for the current
session, change the session value of this variable. The session user
must have the SUPER privilege to set this variable.
[12 Dec 2011 21:02] Paul DuBois
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly, and will be included in the next release of the relevant products.