The following conditions hold for a @code{INSERT INTO ... SELECT} statement:
The following conditions hold for an @code{INSERT INTO ... SELECT} statement:
@itemize @minus
@itemize @minus
@item
@item
...
@@ -18755,7 +18755,7 @@ The query cannot contain an @code{ORDER BY} clause.
...
@@ -18755,7 +18755,7 @@ The query cannot contain an @code{ORDER BY} clause.
@item
@item
The target table of the @code{INSERT} statement cannot appear in the
The target table of the @code{INSERT} statement cannot appear in the
@code{FROM} clause of the @code{SELECT} part of the query, because it's
@code{FROM} clause of the @code{SELECT} part of the query because it's
forbidden in ANSI SQL to @code{SELECT} from the same table into which you are
forbidden in ANSI SQL to @code{SELECT} from the same table into which you are
inserting. (The problem is that the @code{SELECT} possibly would
inserting. (The problem is that the @code{SELECT} possibly would
find records that were inserted earlier during the same run. When using
find records that were inserted earlier during the same run. When using
...
@@ -18767,7 +18767,7 @@ sub-select clauses, the situation could easily be very confusing!)
...
@@ -18767,7 +18767,7 @@ sub-select clauses, the situation could easily be very confusing!)
@end itemize
@end itemize
@findex mysql_info()
@findex mysql_info()
If you use @code{INSERT ... SELECT} or a @code{INSERT ... VALUES}
If you use @code{INSERT ... SELECT} or an @code{INSERT ... VALUES}
statement with multiple value lists, you can use the C API function
statement with multiple value lists, you can use the C API function
@code{mysql_info()} to get information about the query. The format of the
@code{mysql_info()} to get information about the query. The format of the
information string is shown below:
information string is shown below:
...
@@ -18797,13 +18797,13 @@ garbage is stripped and the remaining numeric part is inserted. If the value
...
@@ -18797,13 +18797,13 @@ garbage is stripped and the remaining numeric part is inserted. If the value
doesn't make sense as a number at all, the column is set to @code{0}.
doesn't make sense as a number at all, the column is set to @code{0}.
@item
@item
Inserting a string into a @code{CHAR}, @code{VARCHAR}, @code{TEXT} or
Inserting a string into a @code{CHAR}, @code{VARCHAR}, @code{TEXT}, or
@code{BLOB} column that exceeds the column's maximum length. The value is
@code{BLOB} column that exceeds the column's maximum length. The value is
truncated to the column's maximum length.
truncated to the column's maximum length.
@item
@item
Inserting a value into a date or time column that is illegal for the column
Inserting a value into a date or time column that is illegal for the column
type. The column is set to the appropriate ``zero'' value for the type.
type. The column is set to the appropriate zero value for the type.
@end itemize
@end itemize
@findex INSERT DELAYED
@findex INSERT DELAYED
...
@@ -18815,10 +18815,10 @@ for the
...
@@ -18815,10 +18815,10 @@ for the
useful if you have clients that can't wait for the @code{INSERT} to complete.
useful if you have clients that can't wait for the @code{INSERT} to complete.
This is a common problem when you use @strong{MySQL} for logging and you also
This is a common problem when you use @strong{MySQL} for logging and you also
periodically run @code{SELECT} statements that take a long time to complete.
periodically run @code{SELECT} statements that take a long time to complete.
@code{DELAYED} was introduced in @strong{MySQL} 3.22.15. It is a
@code{DELAYED} was introduced in @strong{MySQL} Version 3.22.15. It is a
@strong{MySQL} extension to ANSI SQL92.
@strong{MySQL} extension to ANSI SQL92.
When you use @code{INSERT DELAYED}, the client will get an ok at once
When you use @code{INSERT DELAYED}, the client will get an OK at once
and the row will be inserted when the table is not in use by any other thread.
and the row will be inserted when the table is not in use by any other thread.
Another major benefit of using @code{INSERT DELAYED} is that inserts
Another major benefit of using @code{INSERT DELAYED} is that inserts
...
@@ -18851,8 +18851,8 @@ or @code{WRITE} lock on the table. However, the handler will wait for all
...
@@ -18851,8 +18851,8 @@ or @code{WRITE} lock on the table. However, the handler will wait for all
structure is up to date.
structure is up to date.
@item
@item
The thread executes the @code{INSERT} statement but instead of writing
The thread executes the @code{INSERT} statement, but instead of writing
the row to the table it puts a copy of the final row into a queue that
the row to the table, it puts a copy of the final row into a queue that
is managed by the handler thread. Any syntax errors are noticed by the
is managed by the handler thread. Any syntax errors are noticed by the
thread and reported to the client program.
thread and reported to the client program.
...
@@ -18898,7 +18898,7 @@ Note that the above means that @code{INSERT DELAYED} commands have higher
...
@@ -18898,7 +18898,7 @@ Note that the above means that @code{INSERT DELAYED} commands have higher
priority than normal @code{INSERT} commands if there is an @code{INSERT
priority than normal @code{INSERT} commands if there is an @code{INSERT
DELAYED} handler already running! Other update commands will have to wait
DELAYED} handler already running! Other update commands will have to wait
until the @code{INSERT DELAYED} queue is empty, someone kills the handler
until the @code{INSERT DELAYED} queue is empty, someone kills the handler
thread (with @code{KILL thread_id}) or someone executes @code{FLUSH TABLES}.
thread (with @code{KILL thread_id}), or someone executes @code{FLUSH TABLES}.
@item
@item
The following status variables provide information about @code{INSERT
The following status variables provide information about @code{INSERT
...
@@ -18923,7 +18923,7 @@ DELAYED} when you are really sure you need it!
...
@@ -18923,7 +18923,7 @@ DELAYED} when you are really sure you need it!
@findex REPLACE
@findex REPLACE
@node REPLACE, LOAD DATA, INSERT, Reference
@node REPLACE, LOAD DATA, INSERT, Reference
@section @code{REPLACE} syntax
@section @code{REPLACE} Syntax
@example
@example
REPLACE [LOW_PRIORITY | DELAYED]
REPLACE [LOW_PRIORITY | DELAYED]
...
@@ -18947,7 +18947,7 @@ In other words, you can't access the values of the old row from a
...
@@ -18947,7 +18947,7 @@ In other words, you can't access the values of the old row from a
@findex LOAD DATA INFILE
@findex LOAD DATA INFILE
@node LOAD DATA, UPDATE, REPLACE, Reference
@node LOAD DATA, UPDATE, REPLACE, Reference
@section @code{LOAD DATA INFILE} syntax
@section @code{LOAD DATA INFILE} Syntax
@example
@example
LOAD DATA [LOW_PRIORITY] [LOCAL] INFILE 'file_name.txt' [REPLACE | IGNORE]
LOAD DATA [LOW_PRIORITY] [LOCAL] INFILE 'file_name.txt' [REPLACE | IGNORE]
...
@@ -18966,7 +18966,7 @@ The @code{LOAD DATA INFILE} statement reads rows from a text file into a
...
@@ -18966,7 +18966,7 @@ The @code{LOAD DATA INFILE} statement reads rows from a text file into a
table at a very high speed. If the @code{LOCAL} keyword is specified, the
table at a very high speed. If the @code{LOCAL} keyword is specified, the
file is read from the client host. If @code{LOCAL} is not specified, the
file is read from the client host. If @code{LOCAL} is not specified, the
file must be located on the server. (@code{LOCAL} is available in
file must be located on the server. (@code{LOCAL} is available in
@strong{MySQL} 3.22.6 or later.)
@strong{MySQL} Version 3.22.6 or later.)
For security reasons, when reading text files located on the server, the
For security reasons, when reading text files located on the server, the
files must either reside in the database directory or be readable by all.
files must either reside in the database directory or be readable by all.
...
@@ -18985,7 +18985,7 @@ host to the server host. On the other hand, you do not need the
...
@@ -18985,7 +18985,7 @@ host to the server host. On the other hand, you do not need the
@c old version
@c old version
If you are using @strong{MySQL} before Version 3.23.24 you can't read from a
If you are using @strong{MySQL} before Version 3.23.24 you can't read from a
FIFO with @code{LOAD DATA INFILE}; If you need to read from a FIFO (for
FIFO with @code{LOAD DATA INFILE}. If you need to read from a FIFO (for
example the output from gunzip), use @code{LOAD DATA LOCAL INFILE}
example the output from gunzip), use @code{LOAD DATA LOCAL INFILE}
instead.
instead.
...
@@ -19052,7 +19052,7 @@ must precede @code{LINES} if both are specified.
...
@@ -19052,7 +19052,7 @@ must precede @code{LINES} if both are specified.
If you specify a @code{FIELDS} clause,
If you specify a @code{FIELDS} clause,
each of its subclauses (@code{TERMINATED BY}, @code{[OPTIONALLY] ENCLOSED
each of its subclauses (@code{TERMINATED BY}, @code{[OPTIONALLY] ENCLOSED
BY} and @code{ESCAPED BY}) is also optional, except that you must
BY}, and @code{ESCAPED BY}) is also optional, except that you must
specify at least one of them.
specify at least one of them.
If you don't specify a @code{FIELDS} clause, the defaults are the
If you don't specify a @code{FIELDS} clause, the defaults are the
...
@@ -19074,17 +19074,17 @@ when reading input:
...
@@ -19074,17 +19074,17 @@ when reading input:
@itemize @bullet
@itemize @bullet
@item
@item
Look for line boundaries at newlines
Look for line boundaries at newlines.
@item
@item
Break lines into fields at tabs
Break lines into fields at tabs.
@item
@item
Do not expect fields to be enclosed within any quoting characters
Do not expect fields to be enclosed within any quoting characters.
@item
@item
Interpret occurrences of tab, newline or @samp{\} preceded by
Interpret occurrences of tab, newline, or @samp{\} preceded by
@samp{\} as literal characters that are part of field values
@samp{\} as literal characters that are part of field values.
@end itemize
@end itemize
Conversely, the defaults cause @code{SELECT ... INTO OUTFILE} to act as
Conversely, the defaults cause @code{SELECT ... INTO OUTFILE} to act as
...
@@ -19092,17 +19092,17 @@ follows when writing output:
...
@@ -19092,17 +19092,17 @@ follows when writing output:
@itemize @bullet
@itemize @bullet
@item
@item
Write tabs between fields
Write tabs between fields.
@item
@item
Do not enclose fields within any quoting characters
Do not enclose fields within any quoting characters.
@item
@item
Use @samp{\} to escape instances of tab, newline or @samp{\} that occur
Use @samp{\} to escape instances of tab, newline or @samp{\} that occur
within field values
within field values.
@item
@item
Write newlines at the ends of lines
Write newlines at the ends of lines.
@end itemize
@end itemize
Note that to write @code{FIELDS ESCAPED BY '\\'}, you must specify two
Note that to write @code{FIELDS ESCAPED BY '\\'}, you must specify two
...
@@ -19271,7 +19271,7 @@ values are written and read using the ``display'' widths of the columns. For
...
@@ -19271,7 +19271,7 @@ values are written and read using the ``display'' widths of the columns. For
example, if a column is declared as @code{INT(7)}, values for the column are
example, if a column is declared as @code{INT(7)}, values for the column are
written using 7-character fields. On input, values for the column are
written using 7-character fields. On input, values for the column are
obtained by reading 7 characters. Fixed-row format also affects handling of
obtained by reading 7 characters. Fixed-row format also affects handling of
@code{NULL} values; see below. Note that fixedsize format will not work
@code{NULL} values; see below. Note that fixed-size format will not work
if you are using a multi-byte character set.
if you are using a multi-byte character set.
@end itemize
@end itemize
...
@@ -19420,7 +19420,7 @@ For more information about the efficiency of @code{INSERT} versus
...
@@ -19420,7 +19420,7 @@ For more information about the efficiency of @code{INSERT} versus
@findex UPDATE
@findex UPDATE
@node UPDATE, USE, LOAD DATA, Reference
@node UPDATE, USE, LOAD DATA, Reference
@section @code{UPDATE} syntax
@section @code{UPDATE} Syntax
@example
@example
UPDATE [LOW_PRIORITY] [IGNORE] tbl_name SET col_name1=expr1,col_name2=expr2,...
UPDATE [LOW_PRIORITY] [IGNORE] tbl_name SET col_name1=expr1,col_name2=expr2,...
...
@@ -19460,16 +19460,16 @@ this and doesn't update it.
...
@@ -19460,16 +19460,16 @@ this and doesn't update it.
@findex mysql_info()
@findex mysql_info()
@code{UPDATE} returns the number of rows that were actually changed.
@code{UPDATE} returns the number of rows that were actually changed.
In @strong{MySQL} 3.22 or later, the C API function @code{mysql_info()}
In @strong{MySQL} Version 3.22 or later, the C API function @code{mysql_info()}
returns the number of rows that were matched and updated and the number of
returns the number of rows that were matched and updated and the number of
warnings that occurred during the @code{UPDATE}.
warnings that occurred during the @code{UPDATE}.
In @strong{MySQL} Version 3.23 you can use @code{LIMIT #} to ensure that
In @strong{MySQL} Version 3.23, you can use @code{LIMIT #} to ensure that
only a given number of rows are changed.
only a given number of rows are changed.
@findex USE
@findex USE
@node USE, FLUSH, UPDATE, Reference
@node USE, FLUSH, UPDATE, Reference
@section @code{USE} syntax
@section @code{USE} Syntax
@example
@example
USE db_name
USE db_name
...
@@ -19477,7 +19477,7 @@ USE db_name
...
@@ -19477,7 +19477,7 @@ USE db_name
The @code{USE db_name} statement tells @strong{MySQL} to use the @code{db_name}
The @code{USE db_name} statement tells @strong{MySQL} to use the @code{db_name}
database as the default database for subsequent queries. The database remains
database as the default database for subsequent queries. The database remains
current until the end of the session, or until another @code{USE} statement
current until the end of the session or until another @code{USE} statement
is issued:
is issued:
@example
@example
...
@@ -19507,7 +19507,7 @@ The @code{USE} statement is provided for Sybase compatibility.
...
@@ -19507,7 +19507,7 @@ The @code{USE} statement is provided for Sybase compatibility.
@cindex caches, clearing
@cindex caches, clearing
@findex FLUSH
@findex FLUSH
@node FLUSH, KILL, USE, Reference
@node FLUSH, KILL, USE, Reference
@section @code{FLUSH} syntax (clearing caches)
@section @code{FLUSH} Syntax (Clearing Caches)
@example
@example
FLUSH flush_option [,flush_option]
FLUSH flush_option [,flush_option]
...
@@ -19542,7 +19542,7 @@ the @code{mysql} database.
...
@@ -19542,7 +19542,7 @@ the @code{mysql} database.
@item @code{TABLES} @tab Closes all open tables and force all tables in use to be closed.
@item @code{TABLES} @tab Closes all open tables and force all tables in use to be closed.
@item @code{[TABLE | TABLES] table_name [,table_name...]} @tab Flush only the given tables
@item @code{[TABLE | TABLES] table_name [,table_name...]} @tab Flushes only the given tables.
@item @code{TABLES WITH READ LOCK} @tab Closes all open tables and locks all tables for all databases with a read until one executes @code{UNLOCK TABLES}. This is very convinient way to get backups if you have a file system, like Veritas,that can take snapshots in time.
@item @code{TABLES WITH READ LOCK} @tab Closes all open tables and locks all tables for all databases with a read until one executes @code{UNLOCK TABLES}. This is very convinient way to get backups if you have a file system, like Veritas,that can take snapshots in time.
...
@@ -19550,20 +19550,20 @@ the @code{mysql} database.
...
@@ -19550,20 +19550,20 @@ the @code{mysql} database.
@end multitable
@end multitable
You can also access each of the commands shown above with the @code{mysqladmin}
You can also access each of the commands shown above with the @code{mysqladmin}
utility, using the @code{flush-hosts}, @code{flush-logs}, @code{reload}
utility, using the @code{flush-hosts}, @code{flush-logs}, @code{reload},
or @code{flush-tables} commands.
or @code{flush-tables} commands.
@cindex @code{mysqladmin}
@cindex @code{mysqladmin}
@findex KILL
@findex KILL
@node KILL, SHOW, FLUSH, Reference
@node KILL, SHOW, FLUSH, Reference
@section @code{KILL} syntax
@section @code{KILL} Syntax
@example
@example
KILL thread_id
KILL thread_id
@end example
@end example
Each connection to @code{mysqld} runs in a separate thread. You can see
Each connection to @code{mysqld} runs in a separate thread. You can see
which threads are running with the @code{SHOW PROCESSLIST} command, and kill
which threads are running with the @code{SHOW PROCESSLIST} command and kill
a thread with the @code{KILL thread_id} command.
a thread with the @code{KILL thread_id} command.
If you have the @strong{process} privilege, you can see and kill all threads.
If you have the @strong{process} privilege, you can see and kill all threads.
...
@@ -19585,7 +19585,7 @@ commands to examine and kill threads.
...
@@ -19585,7 +19585,7 @@ commands to examine and kill threads.
@findex SHOW GRANTS
@findex SHOW GRANTS
@findex SHOW CREATE TABLE
@findex SHOW CREATE TABLE
@node SHOW, EXPLAIN, KILL, Reference
@node SHOW, EXPLAIN, KILL, Reference
@section @code{SHOW} syntax (Get information about tables, columns,...)
@section @code{SHOW} Syntax (Get Information About Tables, Columns,...)
@example
@example
SHOW DATABASES [LIKE wild]
SHOW DATABASES [LIKE wild]
...
@@ -19600,7 +19600,7 @@ or SHOW GRANTS FOR user
...
@@ -19600,7 +19600,7 @@ or SHOW GRANTS FOR user
or SHOW CREATE TABLE table_name
or SHOW CREATE TABLE table_name
@end example
@end example
@code{SHOW} provides information about databases, tables, columns or
@code{SHOW} provides information about databases, tables, columns, or
status information about the server. If the @code{LIKE wild} part is
status information about the server. If the @code{LIKE wild} part is
used, the @code{wild} string can be a string that uses the SQL @samp{%}
used, the @code{wild} string can be a string that uses the SQL @samp{%}
and @samp{_} wild-card characters.
and @samp{_} wild-card characters.
...
@@ -19623,7 +19623,7 @@ and @samp{_} wild-card characters.
...
@@ -19623,7 +19623,7 @@ and @samp{_} wild-card characters.
@cindex displaying, information, @code{SHOW}
@cindex displaying, information, @code{SHOW}
@node SHOW DATABASE INFO, SHOW TABLE STATUS, SHOW, SHOW
@node SHOW DATABASE INFO, SHOW TABLE STATUS, SHOW, SHOW
@subsection SHOW information about database, tables, columns and index
@subsection SHOW Information About Databases, Tables, Columns, and Indexes
You can use @code{db_name.tbl_name} as an alternative to the @code{tbl_name
You can use @code{db_name.tbl_name} as an alternative to the @code{tbl_name
FROM db_name} syntax. These two statements are equivalent:
FROM db_name} syntax. These two statements are equivalent:
...
@@ -19639,7 +19639,7 @@ host. You can also get this list using the @code{mysqlshow} command.
...
@@ -19639,7 +19639,7 @@ host. You can also get this list using the @code{mysqlshow} command.
@code{SHOW TABLES} lists the tables in a given database. You can also
@code{SHOW TABLES} lists the tables in a given database. You can also
get this list using the @code{mysqlshow db_name} command.
get this list using the @code{mysqlshow db_name} command.
@strong{Note:} If a user doesn't have any privileges for a table, the table
@strong{NOTE:} If a user doesn't have any privileges for a table, the table
will not show up in the output from @code{SHOW TABLES} or @code{mysqlshow
will not show up in the output from @code{SHOW TABLES} or @code{mysqlshow
db_name}.
db_name}.
...
@@ -19652,7 +19652,7 @@ The @code{DESCRIBE} statement provides information similar to
...
@@ -19652,7 +19652,7 @@ The @code{DESCRIBE} statement provides information similar to
@code{SHOW COLUMNS}.
@code{SHOW COLUMNS}.
@xref{DESCRIBE, , @code{DESCRIBE}}.
@xref{DESCRIBE, , @code{DESCRIBE}}.
@code{SHOW FIELDS} is a synonym for @code{SHOW COLUMNS} and
@code{SHOW FIELDS} is a synonym for @code{SHOW COLUMNS}, and
@code{SHOW KEYS} is a synonym for @code{SHOW INDEX}. You can also
@code{SHOW KEYS} is a synonym for @code{SHOW INDEX}. You can also
list a table's columns or indexes with @code{mysqlshow db_name tbl_name}
list a table's columns or indexes with @code{mysqlshow db_name tbl_name}
or @code{mysqlshow -k db_name tbl_name}.
or @code{mysqlshow -k db_name tbl_name}.
...
@@ -19663,9 +19663,9 @@ are returned:
...
@@ -19663,9 +19663,9 @@ are returned:
@multitable @columnfractions .35 .65
@multitable @columnfractions .35 .65
@item @strong{Column} @tab @strong{Meaning}
@item @strong{Column} @tab @strong{Meaning}
@item @code{Table} @tab Name of the table
@item @code{Table} @tab Name of the table.
@item @code{Non_unique} @tab 0 if the index can't contain duplicates.
@item @code{Non_unique} @tab 0 if the index can't contain duplicates.
@item @code{Key_name} @tab Name of the index
@item @code{Key_name} @tab Name of the index.
@item @code{Seq_in_index} @tab Column sequence number in index, starting with 1.
@item @code{Seq_in_index} @tab Column sequence number in index, starting with 1.
@item @code{Column_name} @tab Column name.
@item @code{Column_name} @tab Column name.
@item @code{Collation} @tab How the column is sorted in the index. In
@item @code{Collation} @tab How the column is sorted in the index. In
...
@@ -19681,34 +19681,34 @@ only partly indexed. @code{NULL} if the entire key is indexed.
...
@@ -19681,34 +19681,34 @@ only partly indexed. @code{NULL} if the entire key is indexed.
@cindex tables, displaying status
@cindex tables, displaying status
@cindex status, tables
@cindex status, tables
@node SHOW TABLE STATUS, SHOW STATUS, SHOW DATABASE INFO, SHOW
@node SHOW TABLE STATUS, SHOW STATUS, SHOW DATABASE INFO, SHOW
@subsection SHOW status information about tables
@subsection SHOW Status Information About Tables
@code{SHOW TABLE STATUS} (new in version 3.23) works likes @code{SHOW
@code{SHOW TABLE STATUS} (new in Version 3.23) works likes @code{SHOW
STATUS}, but provides a lot of information about each table. You can
STATUS}, but provides a lot of information about each table. You can
also get this list using the @code{mysqlshow --status db_name} command.
also get this list using the @code{mysqlshow --status db_name} command.
The following columns are returned:
The following columns are returned:
@multitable @columnfractions .30 .70
@multitable @columnfractions .30 .70
@item @strong{Column} @tab @strong{Meaning}
@item @strong{Column} @tab @strong{Meaning}
@item @code{Name} @tab Name of the table
@item @code{Name} @tab Name of the table.
@item @code{Type} @tab Type of table (BDB, ISAM, MERGE, MyISAM or HEAP)
@item @code{Type} @tab Type of table (BDB, ISAM, MERGE, MyISAM, or HEAP).
@item @code{Row_format} @tab The row storage format (Fixed, Dynamic, or Compressed)
@item @code{Row_format} @tab The row storage format (Fixed, Dynamic, or Compressed).
@item @code{Rows} @tab Number of rows
@item @code{Rows} @tab Number of rows.
@item @code{Avg_row_length} @tab Average row length
@item @code{Avg_row_length} @tab Average row length.
@item @code{Data_length} @tab Length of the data file
@item @code{Data_length} @tab Length of the data file.
@item @code{Max_data_length} @tab Max length of the data file
@item @code{Max_data_length} @tab Max length of the data file.
@item @code{Index_length} @tab Length of the index file
@item @code{Index_length} @tab Length of the index file.
@item @code{Data_free} @tab Number of allocated but not used bytes
@item @code{Data_free} @tab Number of allocated but not used bytes.
@item @code{Auto_increment} @tab Next autoincrement value
@item @code{Auto_increment} @tab Next autoincrement value.
@item @code{Create_time} @tab When the table was created
@item @code{Create_time} @tab When the table was created.
@item @code{Update_time} @tab When the data file was last updated
@item @code{Update_time} @tab When the data file was last updated.
@item @code{Check_time} @tab When one last run a check on the table
@item @code{Check_time} @tab When the table was last checked.
@item @code{Create_options} @tab Extra options used with @code{CREATE TABLE}
@item @code{Create_options} @tab Extra options used with @code{CREATE TABLE}.
@item @code{Comment} @tab The comment used when creating the table (or some information why @strong{MySQL} couldn't access the table information).
@item @code{Comment} @tab The comment used when creating the table (or some information why @strong{MySQL} couldn't access the table information).
@end multitable
@end multitable
@node SHOW STATUS, SHOW VARIABLES, SHOW TABLE STATUS, SHOW
@node SHOW STATUS, SHOW VARIABLES, SHOW TABLE STATUS, SHOW
@subsection SHOW status information
@subsection SHOW Status Information
@cindex @code{mysqladmin}
@cindex @code{mysqladmin}
@code{SHOW STATUS} provides server status information
@code{SHOW STATUS} provides server status information
...
@@ -19775,13 +19775,13 @@ The status variables listed above have the following meaning:
...
@@ -19775,13 +19775,13 @@ The status variables listed above have the following meaning:
@multitable @columnfractions .35 .65
@multitable @columnfractions .35 .65
@item @strong{Variable} @tab @strong{Meaning}
@item @strong{Variable} @tab @strong{Meaning}
@item @code{Aborted_clients} @tab Number of connections that has been aborted because the client has died without closing the connection properly.
@item @code{Aborted_clients} @tab Number of connections aborted because the client died without closing the connection properly.
@item @code{Aborted_connects} @tab Number of tries to connect to the @strong{MySQL} server that has failed.
@item @code{Aborted_connects} @tab Number of tries to connect to the @strong{MySQL} server that failed.
@item @code{Bytes_received} @tab Number of bytes received from all clients
@item @code{Bytes_received} @tab Number of bytes received from all clients.
@item @code{Bytes_sent} @tab Number of bytes sent to all clients
@item @code{Bytes_sent} @tab Number of bytes sent to all clients.
@item @code{Connections} @tab Number of connection attempts to the @strong{MySQL} server.
@item @code{Connections} @tab Number of connection attempts to the @strong{MySQL} server.
@item @code{Created_tmp_disk_tables} @tab Number of implicit temporary tables on disk that have been created while executing statements.
@item @code{Created_tmp_disk_tables} @tab Number of implicit temporary tables on disk created while executing statements.
@item @code{Created_tmp_tables} @tab Number of implicit temporary tables in memory that have been created while executing statements.
@item @code{Created_tmp_tables} @tab Number of implicit temporary tables in memory created while executing statements.
@item @code{Created_tmp_files} @tab How many temporary files @code{mysqld} have created.
@item @code{Created_tmp_files} @tab How many temporary files @code{mysqld} have created.
@item @code{Delayed_insert_threads} @tab Number of delayed insert handler threads in use.
@item @code{Delayed_insert_threads} @tab Number of delayed insert handler threads in use.
@item @code{Delayed_writes} @tab Number of rows written with @code{INSERT DELAYED}.
@item @code{Delayed_writes} @tab Number of rows written with @code{INSERT DELAYED}.
...
@@ -19790,7 +19790,7 @@ The status variables listed above have the following meaning:
...
@@ -19790,7 +19790,7 @@ The status variables listed above have the following meaning:
@item @code{Handler_delete} @tab Number of times a row was deleted from a table.
@item @code{Handler_delete} @tab Number of times a row was deleted from a table.
@item @code{Handler_read_first} @tab Number of times the first entry was read from an index.
@item @code{Handler_read_first} @tab Number of times the first entry was read from an index.
If this is high, it suggests that the server is doing a lot of full index scans, for example,
If this is high, it suggests that the server is doing a lot of full index scans, for example,
@code{SELECT col1 FROM foo}, assuming that col1 is indexed
@code{SELECT col1 FROM foo}, assuming that col1 is indexed.
@item @code{Handler_read_key} @tab Number of requests to read a row based on a key. If this
@item @code{Handler_read_key} @tab Number of requests to read a row based on a key. If this
is high, it is a good indication that your queries and tables are properly indexed.
is high, it is a good indication that your queries and tables are properly indexed.
@item @code{Handler_read_next} @tab Number of requests to read next row in key order. This
@item @code{Handler_read_next} @tab Number of requests to read next row in key order. This
...
@@ -19799,9 +19799,9 @@ will be incremented if you are doing an index scan.
...
@@ -19799,9 +19799,9 @@ will be incremented if you are doing an index scan.
@item @code{Handler_read_rnd} @tab Number of requests to read a row based on a fixed position.
@item @code{Handler_read_rnd} @tab Number of requests to read a row based on a fixed position.
This will be high if you are doing a lot of queries that require sorting of the result.
This will be high if you are doing a lot of queries that require sorting of the result.
@item @code{Handler_read_rnd_next} @tab Number of requests to read the next row in the datafile.
@item @code{Handler_read_rnd_next} @tab Number of requests to read the next row in the datafile.
This will be high if you are doing a lot of table scans - generally this suggests that you tables
This will be high if you are doing a lot of table scans. Generally this suggests that your tables
are not properly indexed or that you queries are not written to take advantaged of the indeces you
are not properly indexed or that your queries are not written to take advantage of the indexes you
have..
have.
@item @code{Handler_update} @tab Number of requests to update a row in a table.
@item @code{Handler_update} @tab Number of requests to update a row in a table.
@item @code{Handler_write} @tab Number of requests to insert a row in a table.
@item @code{Handler_write} @tab Number of requests to insert a row in a table.
@item @code{Key_blocks_used} @tab The number of used blocks in the key cache.
@item @code{Key_blocks_used} @tab The number of used blocks in the key cache.
...
@@ -19809,21 +19809,21 @@ have..
...
@@ -19809,21 +19809,21 @@ have..
@item @code{Key_reads} @tab The number of physical reads of a key block from disk.
@item @code{Key_reads} @tab The number of physical reads of a key block from disk.
@item @code{Key_write_requests} @tab The number of requests to write a key block to the cache.
@item @code{Key_write_requests} @tab The number of requests to write a key block to the cache.
@item @code{Key_writes} @tab The number of physical writes of a key block to disk.
@item @code{Key_writes} @tab The number of physical writes of a key block to disk.
@item @code{Max_used_connections} @tab The maximum number of connections that has been in use simultaneously.
@item @code{Max_used_connections} @tab The maximum number of connections in use simultaneously.
@item @code{Not_flushed_key_blocks} @tab Keys blocks in the key cache that has changed but hasn't yet been flushed to disk.
@item @code{Not_flushed_key_blocks} @tab Keys blocks in the key cache that has changed but hasn't yet been flushed to disk.
@item @code{Not_flushed_delayed_rows} @tab Number of rows waiting to be written in @code{INSERT DELAY} queues.
@item @code{Not_flushed_delayed_rows} @tab Number of rows waiting to be written in @code{INSERT DELAY} queues.
@item @code{Open_tables} @tab Number of tables that are open.
@item @code{Open_tables} @tab Number of tables that are open.
@item @code{Open_files} @tab Number of files that are open.
@item @code{Open_files} @tab Number of files that are open.
@item @code{Open_streams} @tab Number of streams that are open (used mainly for logging)
@item @code{Open_streams} @tab Number of streams that are open (used mainly for logging).
@item @code{Opened_tables} @tab Number of tables that have been opened.
@item @code{Opened_tables} @tab Number of tables that have been opened.
@item @code{Select_full_join} @tab Number of joins without keys (Should be 0).
@item @code{Select_full_join} @tab Number of joins without keys (Should be 0).
@item @code{Select_full_range_join} @tab Number of joins where we used a range search on reference table.
@item @code{Select_full_range_join} @tab Number of joins where we used a range search on reference table.
@item @code{Select_range} @tab Number of joins where we used ranges on the first table (It's normally not critical even if this is big)
@item @code{Select_range} @tab Number of joins where we used ranges on the first table. (It's normally not critical even if this is big.)
@item @code{Select_scan} @tab Number of joins where we scanned the first table.
@item @code{Select_scan} @tab Number of joins where we scanned the first table.
@item @code{Select_range_check} @tab Number of joins without keys where we check for key usage after each row (Should be 0).
@item @code{Select_range_check} @tab Number of joins without keys where we check for key usage after each row (Should be 0).
@item @code{Questions} @tab Number of queries sent to the server.
@item @code{Questions} @tab Number of queries sent to the server.
@item @code{Slow_launch_threads} @tab Number of threads that have taken more than @code{slow_launch_time} to connect.
@item @code{Slow_launch_threads} @tab Number of threads that have taken more than @code{slow_launch_time} to connect.
@item @code{Slow_queries} @tab Number of queries that has taken more than @code{long_query_time}. @xref{Slow query log}.
@item @code{Slow_queries} @tab Number of queries that have taken more than @code{long_query_time}. @xref{Slow query log}.
@item @code{Sort_merge_passes} @tab Number of merges the sort has to do. If this value is large you should consider increasing @code{sort_buffer}.
@item @code{Sort_merge_passes} @tab Number of merges the sort has to do. If this value is large you should consider increasing @code{sort_buffer}.
@item @code{Sort_range} @tab Number of sorts that where done with ranges.
@item @code{Sort_range} @tab Number of sorts that where done with ranges.
@item @code{Sort_rows} @tab Number of sorted rows.
@item @code{Sort_rows} @tab Number of sorted rows.
...
@@ -19845,9 +19845,9 @@ If @code{key_reads} is big, then your @code{key_cache} is probably too
...
@@ -19845,9 +19845,9 @@ If @code{key_reads} is big, then your @code{key_cache} is probably too
small. The cache hit rate can be calculated with
small. The cache hit rate can be calculated with
@code{key_reads}/@code{key_read_requests}.
@code{key_reads}/@code{key_read_requests}.
@item
@item
If @code{Handler_read_rnd} is big, then you have a probably a lot of
If @code{Handler_read_rnd} is big, then you probably have a lot of queries
queries that requires @strong{MySQL} to scan whole tables or you have
that require @strong{MySQL} to scan whole tables or you have joins that don't use
joins that doesn't use keys properly.
keys properly.
@item
@item
If @code{Created_tmp_tables} or @code{Sort_merge_passes} are high then
If @code{Created_tmp_tables} or @code{Sort_merge_passes} are high then
your @code{mysqld} @code{sort_buffer} variables is probably too small.
your @code{mysqld} @code{sort_buffer} variables is probably too small.
...
@@ -19860,7 +19860,7 @@ tables.
...
@@ -19860,7 +19860,7 @@ tables.
@node SHOW VARIABLES, SHOW PROCESSLIST, SHOW STATUS, SHOW
@node SHOW VARIABLES, SHOW PROCESSLIST, SHOW STATUS, SHOW
@subsection SHOW VARIABLES
@subsection SHOW VARIABLES
@code{SHOW VARIABLES} shows the values of the some of @strong{MySQL} system
@code{SHOW VARIABLES} shows the values of some @strong{MySQL} system
variables. You can also get this information using the @code{mysqladmin
variables. You can also get this information using the @code{mysqladmin
variables} command. If the default values are unsuitable, you can set most
variables} command. If the default values are unsuitable, you can set most
of these variables using command-line options when @code{mysqld} starts up.
of these variables using command-line options when @code{mysqld} starts up.
@@ -41183,7 +41183,7 @@ within a row in an existing table.
...
@@ -41183,7 +41183,7 @@ within a row in an existing table.
the week starts on Monday (some European countries). By default,
the week starts on Monday (some European countries). By default,
@code{WEEK()} assumes the week starts on Sunday.
@code{WEEK()} assumes the week starts on Sunday.
@item
@item
@code{TIME} columns weren't stored properly (bug in @strong{MySQL} 3.22.0).
@code{TIME} columns weren't stored properly (bug in @strong{MySQL} Version 3.22.0).
@item
@item
@code{UPDATE} now returns information about how many rows were
@code{UPDATE} now returns information about how many rows were
matched and updated, and how many ``warnings'' occurred when doing the update.
matched and updated, and how many ``warnings'' occurred when doing the update.
...
@@ -41626,7 +41626,7 @@ Added command @code{variables} to @code{mysqladmin}.
...
@@ -41626,7 +41626,7 @@ Added command @code{variables} to @code{mysqladmin}.
@item
@item
A lot of small changes to the binary releases.
A lot of small changes to the binary releases.
@item
@item
Fixed a bug in the new protocol from @strong{MySQL} 3.21.20.
Fixed a bug in the new protocol from @strong{MySQL} Version 3.21.20.
@item
@item
Changed @code{ALTER TABLE} to work with Windows (Windows can't rename
Changed @code{ALTER TABLE} to work with Windows (Windows can't rename
open files). Also fixed a couple of small bugs in the Windows version.
open files). Also fixed a couple of small bugs in the Windows version.
...
@@ -41924,7 +41924,7 @@ Sorting on calculated @code{DOUBLE} values sorted on integer results instead.
...
@@ -41924,7 +41924,7 @@ Sorting on calculated @code{DOUBLE} values sorted on integer results instead.
@code{mysql} no longer needs a database argument.
@code{mysql} no longer needs a database argument.
@item
@item
Changed the place where @code{HAVING} should be. According to ANSI, it should
Changed the place where @code{HAVING} should be. According to ANSI, it should
be after @code{GROUP BY} but before @code{ORDER BY}. @strong{MySQL} 3.20
be after @code{GROUP BY} but before @code{ORDER BY}. @strong{MySQL} Version 3.20
incorrectly had it last.
incorrectly had it last.
@item
@item
Added Sybase command @code{USE DATABASE} to start using another database.
Added Sybase command @code{USE DATABASE} to start using another database.
...
@@ -42008,7 +42008,7 @@ easily portable to Win95.
...
@@ -42008,7 +42008,7 @@ easily portable to Win95.
Changed the @code{CREATE COLUMN} syntax of @code{NOT NULL} columns to be after
Changed the @code{CREATE COLUMN} syntax of @code{NOT NULL} columns to be after
the @code{DEFAULT} value, as specified in the ANSI SQL standard. This will
the @code{DEFAULT} value, as specified in the ANSI SQL standard. This will
make @code{mysqldump} with @code{NOT NULL} and default values incompatible with
make @code{mysqldump} with @code{NOT NULL} and default values incompatible with
@strong{MySQL} 3.20.
@strong{MySQL} Version 3.20.
@item
@item
Added many function name aliases so the functions can be used with
Added many function name aliases so the functions can be used with
ODBC or ANSI SQL92 syntax.
ODBC or ANSI SQL92 syntax.
...
@@ -42957,7 +42957,7 @@ New functions: @code{INSERT()}, @code{RTRIM()}, @code{LTRIM()} and
...
@@ -42957,7 +42957,7 @@ New functions: @code{INSERT()}, @code{RTRIM()}, @code{LTRIM()} and
@code{AUTO_INCREMENT}). The format for @code{SHOW FIELDS FROM tbl_name}
@code{AUTO_INCREMENT}). The format for @code{SHOW FIELDS FROM tbl_name}
is changed so the @code{Type} column contains information suitable for
is changed so the @code{Type} column contains information suitable for
@code{CREATE TABLE}. In previous releases, some @code{CREATE TABLE}
@code{CREATE TABLE}. In previous releases, some @code{CREATE TABLE}
information had to be patched when recreating tables.
information had to be patched when re-creating tables.
@item
@item
Some parser bugs from 3.19.5 (@code{BLOB} and @code{TIMESTAMP}) are corrected.
Some parser bugs from 3.19.5 (@code{BLOB} and @code{TIMESTAMP}) are corrected.
@code{TIMESTAMP} now returns different date information depending on its
@code{TIMESTAMP} now returns different date information depending on its
...
@@ -43173,7 +43173,7 @@ Delayed insert handler has pending inserts to a table.
...
@@ -43173,7 +43173,7 @@ Delayed insert handler has pending inserts to a table.
@end enumerate
@end enumerate
@item
@item
Before @strong{MySQL} 3.23.2 an @code{UPDATE} that updated a key with
Before @strong{MySQL} Version 3.23.2 an @code{UPDATE} that updated a key with
a @code{WHERE} on the same key may have failed because the key was used to
a @code{WHERE} on the same key may have failed because the key was used to
search for records and the same row may have been found multiple times:
search for records and the same row may have been found multiple times:
...
@@ -43190,7 +43190,7 @@ mysql> UPDATE tbl_name SET KEY=KEY+1 WHERE KEY+0 > 100;
...
@@ -43190,7 +43190,7 @@ mysql> UPDATE tbl_name SET KEY=KEY+1 WHERE KEY+0 > 100;
This will work because @strong{MySQL} will not use index on expressions in
This will work because @strong{MySQL} will not use index on expressions in
the @code{WHERE} clause.
the @code{WHERE} clause.
@item
@item
Before @strong{MySQL} 3.23, all numeric types where treated as fixed-point
Before @strong{MySQL} Version 3.23, all numeric types where treated as fixed-point
fields. That means you had to specify how many decimals a floating-point
fields. That means you had to specify how many decimals a floating-point
field shall have. All results were returned with the correct number of
field shall have. All results were returned with the correct number of
decimals.
decimals.
...
@@ -43661,7 +43661,7 @@ If you run into problems with a new port, you may have to do some debugging
...
@@ -43661,7 +43661,7 @@ If you run into problems with a new port, you may have to do some debugging
of @strong{MySQL}!
of @strong{MySQL}!
@xref{Debugging server}.
@xref{Debugging server}.
@strong{Note:} Before you start debugging @code{mysqld}, first get the test
@strong{NOTE:} Before you start debugging @code{mysqld}, first get the test
programs @code{mysys/thr_alarm} and @code{mysys/thr_lock} to work. This
programs @code{mysys/thr_alarm} and @code{mysys/thr_lock} to work. This
will ensure that your thread installation has even a remote chance to work!
will ensure that your thread installation has even a remote chance to work!
...
@@ -43778,7 +43778,7 @@ If you have problems debugging threads with gdb, you should download
...
@@ -43778,7 +43778,7 @@ If you have problems debugging threads with gdb, you should download
gdb 5.x and try this instead. The new gdb version has very improved
gdb 5.x and try this instead. The new gdb version has very improved
thread handling!
thread handling!
Here follows an example how to debug mysqld:
Here is an example how to debug mysqld:
@example
@example
shell> gdb /usr/local/libexec/mysqld
shell> gdb /usr/local/libexec/mysqld
...
@@ -43962,7 +43962,7 @@ The currently recognized flag characters are:
...
@@ -43962,7 +43962,7 @@ The currently recognized flag characters are:
@multitable @columnfractions .1 .9
@multitable @columnfractions .1 .9
@item d @tab Enable output from DBUG_<N> macros for for the current state. May be followed by a list of keywords which selects output only for the DBUG macros with that keyword. A empty list of keywords implies output for all macros.
@item d @tab Enable output from DBUG_<N> macros for for the current state. May be followed by a list of keywords which selects output only for the DBUG macros with that keyword. A empty list of keywords implies output for all macros.
@item D @tab Delay after each debugger output line. The argument is the number of tenths of seconds to delay, subject to machine capabilities. I.E. @code{-#D,20} is delay two seconds.
@item D @tab Delay after each debugger output line. The argument is the number of tenths of seconds to delay, subject to machine capabilities. That is, @code{-#D,20} is delay two seconds.
@item f @tab Limit debugging and/or tracing, and profiling to the list of named functions. Note that a null list will disable all functions. The appropriate "d" or "t" flags must still be given, this flag only limits their actions if they are enabled.
@item f @tab Limit debugging and/or tracing, and profiling to the list of named functions. Note that a null list will disable all functions. The appropriate "d" or "t" flags must still be given, this flag only limits their actions if they are enabled.
@item F @tab Identify the source file name for each line of debug or trace output.
@item F @tab Identify the source file name for each line of debug or trace output.
@item i @tab Identify the process with the pid or thread id for each line of debug or trace output.
@item i @tab Identify the process with the pid or thread id for each line of debug or trace output.
...
@@ -44079,7 +44079,7 @@ for the application but generally it's very hard to say that a given
...
@@ -44079,7 +44079,7 @@ for the application but generally it's very hard to say that a given
lock type is better than another; Everything depends on the application
lock type is better than another; Everything depends on the application
and different part of the application may require different lock types.
and different part of the application may require different lock types.
Here follows some tips about locking in @strong{MySQL}:
Here are some tips about locking in @strong{MySQL}:
On web application most applications do lots of selects, very few
On web application most applications do lots of selects, very few
deletes, updates mainly on keys and inserts in some specific tables.
deletes, updates mainly on keys and inserts in some specific tables.
...
@@ -44153,7 +44153,7 @@ If there are some small differences in the implementation, they may be fixed
...
@@ -44153,7 +44153,7 @@ If there are some small differences in the implementation, they may be fixed
by changing @file{my_pthread.h} and @file{my_pthread.c}.
by changing @file{my_pthread.h} and @file{my_pthread.c}.
@item
@item
Run @code{thr_alarm}. If it runs without any ``warning'', ``error'' or aborted
Run @code{thr_alarm}. If it runs without any ``warning'', ``error'' or aborted
messages, you are on the right track. Here follows a successful run on
messages, you are on the right track. Here is a successful run on