Bug #19779 mysql_explain_log documentation is outdated
Submitted: 12 May 2006 17:59 Modified: 18 Jul 2006 13:11
Reporter: Jan Willamowius Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.0.22-BK, 5.0.18 OS:
Assigned to: Iggy Galarza CPU Architecture:Any

[12 May 2006 17:59] Jan Willamowius
Description:
The documentation inside mysql_explain_log is outdated and was missing a command line option. The patch below fixes this.

How to repeat:
Look at the documentation inside the Perl script.

Suggested fix:
--- mysql_explain_log.sh.orig   2006-04-18 13:46:00.000000000 +0200
+++ mysql_explain_log.sh    2006-05-12 19:55:25.000000000 +0200
@@ -1,5 +1,6 @@
-#!@PERL@ -w
+#!@PERL@
 use strict;
+use warnings;
 use DBI;

 use Getopt::Long;
@@ -58,7 +59,7 @@
   }
   else {
     $Param->{Start} = time;
-    while(<STDIN>) {
+    while(<>) {
       $Param->{LineCount} ++ ;

       if ($Param->{ViewDate} ) {
@@ -317,6 +318,8 @@
 -p=PASSWORD
 --socket=SOCKET     mysqld socket file to connect
 -s=SOCKET
+--printerror=1      enable error output
+-e 1

 Read logfile from STDIN an try to EXPLAIN all SELECT statements. All UPDATE statements are rewritten to an EXPLAIN SELECT statement. The results of the EXPLAIN statement are collected and counted. All results with type=ALL are collec
@@ -331,7 +334,7 @@

 =head1 NAME

-explain_log.pl
+mysql_explain_log

 Feed a mysqld general logfile (created with mysqld --log) back into mysql
 and collect statistics about index usage with EXPLAIN.
@@ -348,7 +351,7 @@

 =head1 USAGE

-explain_log.pl [--date=YYMMDD] --host=dbhost] [--user=dbuser] [--password=dbpw] [--socket=/path/to/socket] < logfile
+mysql_explain_log [--date=YYMMDD] --host=dbhost] [--user=dbuser] [--password=dbpw] [--socket=/path/to/socket] < logfile

 --date=YYMMDD       select only entrys of date

@@ -370,21 +373,20 @@

 -s=SOCKET

+--printerror=1      enable error output
+
+-e 1
+
 =head1 EXAMPLE

-explain_log.pl --host=localhost --user=foo --password=bar < /var/lib/mysql/mobile.log
+mysql_explain_log --host=localhost --user=foo --password=bar < /var/lib/mysql/mobile.log

 =head1 AUTHORS

   Stefan Nitz
-  Jan Willamowius <jan@mobile.de>, http://www.mobile.de
+  Jan Willamowius <jan@willamowius.de>, http://www.willamowius.de
   Dennis Haney <davh@davh.dk> (Added socket support)

-=head1 RECRUITING
-
-If you are looking for a MySQL or Perl job, take a look at http://www.mobile.de
-and send me an email with your resume (you must be speaking German!).
-
 =head1 SEE ALSO

 mysql documentation
[12 May 2006 18:01] Jan Willamowius
Patch file

Attachment: mysql_explain_log.sh.patch (text/x-patch), 2.03 KiB.

[14 May 2006 15:04] Valeriy Kravchuk
Thank you for a patch. As far as I know, mysql_explain_log is not maintained by MySQL, so http://forge.mysql.com may be a better place to maintain and discuss it.
[14 May 2006 17:17] Jan Willamowius
mysql_explain_log is part of the standard MySQL distribution. It was initially contributed by a third party, but as long as it it is shipped with MySQL, MYSQL AB should at least keep it up to date by accepting patches.
[15 May 2006 21:05] Valeriy Kravchuk
I'll mark this bug report as verified. We should either keep mysql_explain_log (including options description) updated or exclude it from the official distribution (and move to forge.mysql.com).
[24 May 2006 6:11] Brian Aker
This has been removed from 5.1, but it should be fixed in 5.0.
[13 Jul 2006 0:56] 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/9102
[13 Jul 2006 1:14] Timothy Smith
Looks fine.
[13 Jul 2006 14:48] 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/9129
[18 Jul 2006 13:11] 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.

Added mysql_explain_log section to 4.1, 5.0 manuals. Added note to
5.1 changelog pointing out that mysql_explain_log is no longer included
in MySQL distributions as of 5.1.11.