Bug #96369 Contribution by Facebook: Add long-query-time to mysqldump
Submitted: 29 Jul 2019 21:11 Modified: 25 May 2022 11:58
Reporter: FBContrib Admin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: mysqldump Command-line Client Severity:S3 (Non-critical)
Version:8.0.13 OS:Any
Assigned to: CPU Architecture:Any

[29 Jul 2019 21:11] FBContrib Admin
Description:
Background innformation provided by Facebook:
The slow log currently contains noise from mysqldump because their queries are usually longer running. This adds an option to mysqldump to specify long_query_time as a session variable to avoid this problem.

Specifying --long_query_time=0 for mysqldump means using the server's value instead of explicitly setting it. It does not set long_query_time to 0.

Use case:

We often enable the slow query log to capture slow queries and find applications that are causing problems on the server. However, mysqldump often trips these slow query log timers because it needs to perform a full table scan. This option allows mysqldump to skip logging to the slow query log.

https://github.com/mysql/mysql-server 
Patch on top of 8.0.13: https://github.com/mysql/mysql-server/commit/e4924f36486f971f8a04252e01c803457a2c72f7

How to repeat:
See description

Suggested fix:
See contribution code attached
[29 Jul 2019 21:11] FBContrib Admin
Add long-query-time to mysqldump 
(*) This code is contributed under the Facebook agreement

Contribution: fb_patch_114.txt (text/plain), 5.61 KiB.

[25 May 2022 11:58] Margaret Fisher
Posted by developer:
 
Added bug number to changelog for WL #13447:

        A new mysqldump option
        --mysqld-long-query-time lets you set a
        custom value of the long_query_time system
        variable for mysqldump’s session. Use the
        new option to increase the elapsed time allowed for
        mysqldump’s queries before they are written
        to the slow query log file, in order to avoid unnecessary
        logging. Thanks to Facebook for the contribution.
[26 May 2022 20:02] Margaret Fisher
Bug number published