Question

We have Perl mytop of Jeremy Zawodny version 2009-04-06 installed on Debian Squeeze OS, with MySQLd version 5.1.53, using apt-get command. I redo the "apt-get install mytop" that indicates that no newer version of mytop is available.

This version of mytop seems outdated, as it gives systematically very low value of queries done by MySQLd. In fact, it uses the status query to get the total queries since uptime:

SHOW STATUS LIKE 'Questions';

It yields an error result in the new version mysqld. In effect to get mysql total number of queries since uptime, the new mysqld server shifted the number of queries to 'Queries' instead of 'Questions':

SHOW STATUS LIKE 'Queries';

You can see an enormous difference between the two variables by:

mysql> SHOW STATUS LIKE 'Que%';
+---------------+--------+
| Variable_name | Value  |
+---------------+--------+
| Queries       | 135903 |
| Questions     | 160    |
+---------------+--------+
2 rows in set (0.00 sec)

that gives the both values of 'Queries' and 'Questions'.

mytop -uJohnDoe2 -ppassword

Here is the original mytop output:

MySQL on localhost (5.1.63-0+squeeze1-log)              up 0+01:42:35 [13:36:44]
 Queries: 265.0   qps:    0 Slow:     0.0         Se/In/Up/De(%):    14760/00/00/00
              qps now:    0 Slow qps: 0.0  Threads:    5 (   1/   5) 1500/00/00/00
 Key Efficiency: 100.0%  Bps in/out:   0.9/173.8   Now in/out:   8.3/ 1.5k

        Id      User         Host/IP         DB      Time    Cmd Query or State
        --      ----         -------         --      ----    --- --------------
     28019      root       localhost                    0  Query show full processlist
....

I copied mytop to mytop.pl, and replaced in the source Perl code the string "Questions" by "Queries", and run

mytop.pl -uJohnDoe2 -ppassword

And the modifed mytop.pl gives a more realistic monitoring:

MySQL on localhost (5.1.63-0+squeeze1-log)              up 0+01:42:23 [13:36:32]
 Queries: 136.1k  qps:   23 Slow:     0.0         Se/In/Up/De(%):    28/00/00/00
              qps now:   18 Slow qps: 0.0  Threads:    5 (   1/   5) 27/00/00/00
 Key Efficiency: 100.0%  Bps in/out:   0.1/ 18.3   Now in/out:   8.4/ 1.5k

        Id      User         Host/IP         DB      Time    Cmd Query or State
        --      ----         -------         --      ----    --- --------------
     30789      root       localhost                    0  Query show full processlist
....

Have you observed this problem in your system? i.e. Perl monitor of MySQL is now invalid in terms of Queries/Questions since MySQLd 5.1.63?

ADDED:

After reading the answer of Shlomi Noach, I added this link for modified Perl script file: mytop.pl.

Was it helpful?

Solution

I have indeed noticed this change, and blogged about it: questions or queries?

Apparently this came as a surprise to other monitoring tools (Innotop, MonYOG) developers.

With regard you case you have two very simple options:

  • Switch to innotop instead
  • Modify the source code for mytop and replace Questions with Queries.

The change was made in 5.1.31; in aforementioned post you can also read comment by an Oracle employee.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top