.\" Title: \fBmysql_explain_log\fR .\" Author: .\" Generator: DocBook XSL Stylesheets v1.70.1 .\" Date: 01/11/2008 .\" Manual: MySQL Database System .\" Source: MySQL 5.0 .\" .TH "\fBMYSQL_EXPLAIN_LOG" "1" "01/11/2008" "MySQL 5.0" "MySQL Database System" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .SH "NAME" mysql_explain_log \- use EXPLAIN on statements in query log .SH "SYNOPSIS" .HP 39 \fBmysql_explain_log [\fR\fB\fIoptions\fR\fR\fB] < \fR\fB\fIlog_file\fR\fR .SH "DESCRIPTION" .PP \fBmysql_explain_log\fR reads its standard input for query log contents. It uses EXPLAIN to analyze SELECT statements found in the input. UPDATE statements are rewritten to SELECT statements and also analyzed with EXPLAIN. \fBmysql_explain_log\fR then displays a summary of its results. .PP The results may assist you in determining which queries result in table scans and where it would be beneficial to add indexes to your tables. .PP Invoke \fBmysql_explain_log\fR like this, where \fIlog_file\fR contains all or part of a MySQL query log: .sp .RS 3n .nf shell> \fBmysql_explain_log [\fR\fB\fIoptions\fR\fR\fB] < \fR\fB\fIlog_file\fR\fR .fi .RE .PP \fBmysql_explain_log\fR understands the following options: .TP 3n \(bu \fB\-\-help\fR, \fB\-?\fR .sp Display a help message and exit. .TP 3n \(bu \fB\-\-date=\fR\fB\fIYYMMDD\fR\fR, \fB\-d \fR\fB\fIYYMMDD\fR\fR .sp Select entries from the log only for the given date. .TP 3n \(bu \fB\-\-host=\fR\fB\fIhost_name\fR\fR, \fB\-h \fR\fB\fIhost_name\fR\fR .sp Connect to the MySQL server on the given host. .TP 3n \(bu \fB\-\-password=\fR\fB\fIpassword\fR\fR, \fB\-p \fR\fB\fIpassword\fR\fR .sp The password to use when connecting to the server. .sp Specifying a password on the command line should be considered insecure. See Section\ 5.6, \(lqKeeping Your Password Secure\(rq. .TP 3n \(bu \fB\-\-printerror=1\fR, \fB\-e 1\fR .sp Enable error output. .TP 3n \(bu \fB\-\-socket=\fR\fB\fIpath\fR\fR, \fB\-S \fR\fB\fIpath\fR\fR .sp For connections to localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use. .TP 3n \(bu \fB\-\-user=\fR\fB\fIuser_name\fR\fR, \fB\-u \fR\fB\fIuser_name\fR\fR .sp The MySQL username to use when connecting to the server. .SH "COPYRIGHT" .PP Copyright 2007\-2008 MySQL AB .PP This documentation is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. .PP You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110\-1301 USA or see http://www.gnu.org/licenses/. .SH "SEE ALSO" For more information, please refer to the MySQL Reference Manual, which may already be installed locally and which is also available online at http://dev.mysql.com/doc/. .SH AUTHOR MySQL AB (http://www.mysql.com/).