Bug #34129 mysqldumpslow does not aggregate times
Submitted: 29 Jan 2008 11:03 Modified: 11 Nov 2008 1:38
Reporter: Martin Kirchner Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: mysqldump Command-line Client Severity:S2 (Serious)
Version:5.1.22 OS:Linux
Assigned to: CPU Architecture:Any
Tags: Contribution
Triage: Triaged: D3 (Medium) / R1 (None/Negligible) / E1 (None/Negligible)

[29 Jan 2008 11:03] Martin Kirchner
Description:
Hi!

mysqldumpslow does not aggregate times.

Best regards

Martin Kirchner

How to repeat:
I activated the slow query log and produced some slow queries. The slow query log contains now entries like 

# Time: 080129 11:51:12
# User@Host: root[root] @ localhost []
# Query_time: 0.001565  Lock_time: 0.000051 Rows_sent: 1  Rows_examined: 1839
SET timestamp=1201603872;
SELECT COUNT(*) FROM city_huge, Country WHERE city_huge.CountryCode=Country.Code AND Country.Continent='Asia' AND Country.Population < 1000000;

If I now run mysqldumpslow the aggregated times are always 0.00:

Count: 8  Time=0.00s (0s)  Lock=0.00s (0s)  Rows=0.0 (0), root[root]@localhost
  # Query_time: N.N  Lock_time: N.N Rows_sent: N  Rows_examined: N
  SET timestamp=N;
  SELECT COUNT(*) FROM city_huge, Country WHERE city_huge.CountryCode=Country.Code AND Country.Continent='S' AND Country.Population < N
[29 Jan 2008 12:32] Kai Voigt
Confirmed in class
Kai
[29 Jan 2008 12:45] Simon Wissinger
Here is a working fix for this problem:

Line 86 has to be

s/^# Query_time: (\d+\.?\d*)\s+Lock_time: (\d+\.?\d*)\s+Rows_sent: (\d+\.?\d*).*\n//;

instead of

s/^# Query_time: (\d+)  Lock_time: (\d+)  Rows_sent: (\d+).*\n//;
[31 Jan 2008 7:28] Valeriy Kravchuk
Thank you for a problem report.
[17 Mar 2008 22:43] Jim Winstead
Bug #35282 has been marked as a duplicate of this bug.
[7 Jul 2008 23:01] 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/commits/49139

2689 Chad MILLER	2008-07-07
      Bug#34129: mysqldumpslow does not aggregate times
      
      Query times were changed to contain subsecond information after a decimal.
      
      Change the capturing regex to account for decimal also.
[14 Oct 2008 20:13] Chad MILLER
Queued to 5.1+ -bugteam.
[10 Nov 2008 10:54] Bugs System
Pushed into 6.0.8-alpha  (revid:chad@mysql.com-20080707225653-u9x1mxnv2g04uvyp) (version source revid:chad@mysql.com-20081014200235-218ejrqp2fez515i) (pib:5)
[10 Nov 2008 11:35] Bugs System
Pushed into 5.1.30  (revid:chad@mysql.com-20080707225653-u9x1mxnv2g04uvyp) (version source revid:chad@mysql.com-20081014195901-4vmse19pxpjtf8w2) (pib:5)
[11 Nov 2008 1:38] Paul Dubois
Noted in 5.1.31, 6.0.8 changelogs.

mysqldumpslow did not aggregate times.
[11 Nov 2008 16:25] Paul Dubois
6.0.9 changelog, not 6.0.8.
[19 Jan 2009 11:21] Bugs System
Pushed into 5.1.31-ndb-6.2.17 (revid:tomas.ulin@sun.com-20090119095303-uwwvxiibtr38djii) (version source revid:tomas.ulin@sun.com-20090108105244-8opp3i85jw0uj5ib) (merge vers: 5.1.31-ndb-6.2.17) (pib:6)
[19 Jan 2009 12:59] Bugs System
Pushed into 5.1.31-ndb-6.3.21 (revid:tomas.ulin@sun.com-20090119104956-guxz190n2kh31fxl) (version source revid:tomas.ulin@sun.com-20090119104956-guxz190n2kh31fxl) (merge vers: 5.1.31-ndb-6.3.21) (pib:6)
[19 Jan 2009 16:05] Bugs System
Pushed into 5.1.31-ndb-6.4.1 (revid:tomas.ulin@sun.com-20090119144033-4aylstx5czzz88i5) (version source revid:tomas.ulin@sun.com-20090119144033-4aylstx5czzz88i5) (merge vers: 5.1.31-ndb-6.4.1) (pib:6)
[7 Apr 2010 1:47] Justin Dennis
This exact same bug still exists in the 5.1.45 Mac OS X x86 64-bit .dmg distribution of  mysqldumpslow.