Commit 4de34841 authored by monty@donna.mysql.fi's avatar monty@donna.mysql.fi

Merge work:/my/mysql into donna.mysql.fi:/home/my/bk/mysql

parents c91715e3 32d403f0
Branches unavailable
Tags unavailable
No related merge requests found
...@@ -469,6 +469,11 @@ Functions for Use in @code{SELECT} and @code{WHERE} Clauses ...@@ -469,6 +469,11 @@ Functions for Use in @code{SELECT} and @code{WHERE} Clauses
* Silent column changes:: Silent column changes * Silent column changes:: Silent column changes
@code{INSERT} Syntax
* INSERT SELECT::
* INSERT DELAYED::
@code{SHOW} Syntax (Get Information About Tables, Columns,...) @code{SHOW} Syntax (Get Information About Tables, Columns,...)
* SHOW DATABASE INFO:: * SHOW DATABASE INFO::
...@@ -487,7 +492,8 @@ MySQL Table Types ...@@ -487,7 +492,8 @@ MySQL Table Types
* ISAM:: ISAM tables * ISAM:: ISAM tables
* HEAP:: HEAP tables * HEAP:: HEAP tables
* BDB:: BDB or Berkeley_db tables * BDB:: BDB or Berkeley_db tables
* INNOBASE:: * GEMINI:: GEMINI tables
* INNOBASE:: INNOBASE tables
MyISAM Tables MyISAM Tables
...@@ -509,12 +515,19 @@ BDB or Berkeley_db Tables ...@@ -509,12 +515,19 @@ BDB or Berkeley_db Tables
* BDB TODO:: * BDB TODO::
* BDB errors:: * BDB errors::
GEMINI Tables
* GEMINI overview::
* GEMINI start::
* GEMINI features::
* GEMINI TODO::
INNOBASE Tables INNOBASE Tables
* INNOBASE overview:: * INNOBASE overview::
* Innobase startup options:: * INNOBASE start:: INNOBASE startup options
* Using Innobase tables:: * Using INNOBASE tables:: Using INNOBASE tables
* INNOBASE restrictions:: * INNOBASE restrictions:: Some restrictions on @code{INNOBASE} tables:
MySQL Tutorial MySQL Tutorial
...@@ -582,7 +595,7 @@ Replication in MySQL ...@@ -582,7 +595,7 @@ Replication in MySQL
* Replication Options:: Replication Options in my.cnf * Replication Options:: Replication Options in my.cnf
* Replication SQL:: SQL Commands related to replication * Replication SQL:: SQL Commands related to replication
* Replication FAQ:: Frequently Asked Questions about replication * Replication FAQ:: Frequently Asked Questions about replication
* Troubleshooting Replication:: Troubleshooting Replication. Troubleshooting Replication. Troubleshooting Replication. Troubleshooting Replication. Troubleshooting Replication. Troubleshooting Replication. Troubleshooting Replication. Troubleshooting Replication. Troubleshooting Replication. Troubleshooting Replication. Troubleshooting Replication. Troubleshooting Replication. Troubleshooting Replication. * Troubleshooting Replication:: Troubleshooting Replication. Troubleshooting Replication. Troubleshooting Replication
Getting Maximum Performance from MySQL Getting Maximum Performance from MySQL
...@@ -4198,7 +4211,7 @@ Please report bad or out-of-date mirrors to @email{webmaster@@mysql.com}. ...@@ -4198,7 +4211,7 @@ Please report bad or out-of-date mirrors to @email{webmaster@@mysql.com}.
@c @uref{http://mysql.tradenet.ee, WWW} @c @uref{http://mysql.tradenet.ee, WWW}
@item @item
@c EMAIL: tonu@spamm.ee (Tõnu Samuel) @c EMAIL: tonu@spam.ee (Tõnu Samuel)
@image{Flags/estonia} Estonia [OKinteractive] @ @image{Flags/estonia} Estonia [OKinteractive] @
@uref{http://mysql.mirror.ok.ee, WWW} @uref{http://mysql.mirror.ok.ee, WWW}
...@@ -6146,7 +6159,9 @@ source tree: ...@@ -6146,7 +6159,9 @@ source tree:
@itemize @itemize
@item @item
Download @strong{BitKeeper} from @uref{http://www.bitmover.com/cgi-bin/download.cgi}. Download @strong{BitKeeper} from
@uref{http://www.bitmover.com/cgi-bin/download.cgi}. You will need
@strong{Bitkeeper} 2.0 or newer to access our repository.
@item @item
Follow the instructions to install it. Follow the instructions to install it.
@item @item
...@@ -9527,6 +9542,12 @@ problems. @xref{Windows}. ...@@ -9527,6 +9542,12 @@ problems. @xref{Windows}.
If you are using BDB (Berkeley DB) tables, you should familiarize If you are using BDB (Berkeley DB) tables, you should familiarize
yourself with the different BDB specific startup options. @xref{BDB start}. yourself with the different BDB specific startup options. @xref{BDB start}.
If you are using Gemini tables, refer to the Gemini-specific startup options.
@xref{GEMINI start}.
If you are using Innobase tables, refer to the Innobase-specific startup
options. @xref{INNOBASE start}.
@node Automatic start, Command-line options, Starting server, Post-installation @node Automatic start, Command-line options, Starting server, Post-installation
@subsection Starting and Stopping MySQL Automatically @subsection Starting and Stopping MySQL Automatically
@cindex starting, the server automatically @cindex starting, the server automatically
...@@ -10796,7 +10817,7 @@ other contexts, however. ...@@ -10796,7 +10817,7 @@ other contexts, however.
@strong{MySQL} doesn't yet support the Oracle SQL extension: @strong{MySQL} doesn't yet support the Oracle SQL extension:
@code{SELECT ... INTO TABLE ...}. @strong{MySQL} supports instead the @code{SELECT ... INTO TABLE ...}. @strong{MySQL} supports instead the
ANSI SQL syntax @code{INSERT INTO ... SELECT ...}, which is basically ANSI SQL syntax @code{INSERT INTO ... SELECT ...}, which is basically
the same thing. @xref{INSERT}. the same thing. @xref{INSERT SELECT}.
@example @example
INSERT INTO tblTemp2 (fldID) SELECT tblTemp1.fldOrder_ID FROM tblTemp1 WHERE INSERT INTO tblTemp2 (fldID) SELECT tblTemp1.fldOrder_ID FROM tblTemp1 WHERE
...@@ -10888,7 +10909,7 @@ still allowed to happen. The new inserted records will not be seen by ...@@ -10888,7 +10909,7 @@ still allowed to happen. The new inserted records will not be seen by
any of the clients that have a @code{READ} lock until they release their read any of the clients that have a @code{READ} lock until they release their read
locks. With @code{INSERT DELAYED} you can queue inserts into a local queue, locks. With @code{INSERT DELAYED} you can queue inserts into a local queue,
until the locks are released, without having the client wait for the insert until the locks are released, without having the client wait for the insert
to complete. to complete. @xref{INSERT DELAYED}.
``Atomic,'' in the sense that we mean it, is nothing magical. It only means ``Atomic,'' in the sense that we mean it, is nothing magical. It only means
that you can be sure that while each specific update is running, no other that you can be sure that while each specific update is running, no other
...@@ -10911,9 +10932,10 @@ Many of our users who have speed foremost in their minds are not at all ...@@ -10911,9 +10932,10 @@ Many of our users who have speed foremost in their minds are not at all
concerned about transactions. For them transactions are not an concerned about transactions. For them transactions are not an
issue. For those of our users who are concerned with or have wondered issue. For those of our users who are concerned with or have wondered
about transactions vis-a-vis @strong{MySQL}, there is a ``@strong{MySQL} about transactions vis-a-vis @strong{MySQL}, there is a ``@strong{MySQL}
way'' as we have outlined above. For those where safety is more important way'' as we have outlined above. For those where safety is more
than speed, we recommend them to use the @code{BDB} tables for all their important than speed, we recommend them to use the @code{BDB},
critical data. @xref{BDB}. @code{GEMINI} or @code{INNOBASE} tables for all their critical
data. @xref{Table types}.
One final note: We are currently working on a safe replication schema One final note: We are currently working on a safe replication schema
that we believe to be better than any commercial replication system we that we believe to be better than any commercial replication system we
...@@ -11139,12 +11161,14 @@ Entry level SQL92. ODBC levels 0-2. ...@@ -11139,12 +11161,14 @@ Entry level SQL92. ODBC levels 0-2.
@cindex tables, updating @cindex tables, updating
@cindex updating, tables @cindex updating, tables
@cindex @code{BDB} tables @cindex @code{BDB} tables
@cindex @code{GEMINI} tables
@cindex @code{INNOBASE} tables
The following mostly applies only for @code{ISAM}, @code{MyISAM}, and The following mostly applies only for @code{ISAM}, @code{MyISAM}, and
@code{HEAP} tables. If you only use transaction-safe tables (@code{BDB} @code{HEAP} tables. If you only use transaction-safe tables (@code{BDB},
tables) in an a update, you can do @code{COMMIT} and @code{ROLLBACK} also @code{GEMINI} or @code{INNOBASE} tables) in an a update, you can do
with @strong{MySQL}. @xref{COMMIT}. @code{COMMIT} and @code{ROLLBACK} also with @strong{MySQL}.
@xref{COMMIT}.
The problem with handling @code{COMMIT}-@code{ROLLBACK} efficiently with The problem with handling @code{COMMIT}-@code{ROLLBACK} efficiently with
the above table types would require a completely different table layout the above table types would require a completely different table layout
...@@ -18339,6 +18363,7 @@ The different table types are: ...@@ -18339,6 +18363,7 @@ The different table types are:
@multitable @columnfractions .20 .80 @multitable @columnfractions .20 .80
@item BDB or Berkeley_db @tab Transaction-safe tables with page locking. @xref{BDB}. @item BDB or Berkeley_db @tab Transaction-safe tables with page locking. @xref{BDB}.
@item GEMINI @tab Transaction-safe tables with row-level locking @xref{GEMINI}.
@item HEAP @tab The data for this table is only stored in memory. @xref{HEAP}. @item HEAP @tab The data for this table is only stored in memory. @xref{HEAP}.
@item ISAM @tab The original table handler. @xref{ISAM}. @item ISAM @tab The original table handler. @xref{ISAM}.
@item INNOBASE @tab Transaction-safe tables with row locking. @xref{INNOBASE}. @item INNOBASE @tab Transaction-safe tables with row locking. @xref{INNOBASE}.
...@@ -19617,12 +19642,13 @@ mysql> INSERT INTO tbl_name (col1,col2) VALUES(col2*2,15); ...@@ -19617,12 +19642,13 @@ mysql> INSERT INTO tbl_name (col1,col2) VALUES(col2*2,15);
@item @item
If you specify the keyword @code{LOW_PRIORITY}, execution of the If you specify the keyword @code{LOW_PRIORITY}, execution of the
@code{INSERT} is delayed until no other clients are reading from the table. @code{INSERT} is delayed until no other clients are reading from the
In this case the client has to wait until the insert statement is completed, table. In this case the client has to wait until the insert statement
which may take a long time if the table is in heavy use. This is in is completed, which may take a long time if the table is in heavy
contrast to @code{INSERT DELAYED}, which lets the client continue at once. use. This is in contrast to @code{INSERT DELAYED}, which lets the client
Note that @code{LOW_PRIORITY} should normally not be used with @code{MyISAM} continue at once. @xref{INSERT DELAYED}. Note that @code{LOW_PRIORITY}
tables as this disables concurrent inserts.@xref{MyISAM}. should normally not be used with @code{MyISAM} tables as this disables
concurrent inserts. @xref{MyISAM}.
@item @item
If you specify the keyword @code{IGNORE} in an @code{INSERT} with many value If you specify the keyword @code{IGNORE} in an @code{INSERT} with many value
...@@ -19644,32 +19670,6 @@ with the @code{mysql_insert_id} function. ...@@ -19644,32 +19670,6 @@ with the @code{mysql_insert_id} function.
@xref{mysql_insert_id, , @code{mysql_insert_id()}}. @xref{mysql_insert_id, , @code{mysql_insert_id()}}.
@end itemize @end itemize
With @code{INSERT ... SELECT} statement you can quickly insert many rows
into a table from one or many tables.
@example
INSERT INTO tblTemp2 (fldID) SELECT tblTemp1.fldOrder_ID FROM tblTemp1 WHERE
tblTemp1.fldOrder_ID > 100;
@end example
The following conditions hold for an @code{INSERT ... SELECT} statement:
@itemize @minus
@item
The query cannot contain an @code{ORDER BY} clause.
@item
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
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
find records that were inserted earlier during the same run. When using
sub-select clauses, the situation could easily be very confusing!)
@item
@code{AUTO_INCREMENT} columns work as usual.
@end itemize
@findex mysql_info() @findex mysql_info()
If you use @code{INSERT ... SELECT} or an @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
...@@ -19710,17 +19710,76 @@ Inserting a value into a date or time column that is illegal for the column ...@@ -19710,17 +19710,76 @@ 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 REPLACE ... SELECT
@findex INSERT ... SELECT
@menu
* INSERT SELECT::
* INSERT DELAYED::
@end menu
@node INSERT SELECT, INSERT DELAYED, INSERT, INSERT
@subsection INSERT ... SELECT Syntax
@example
INSERT [LOW_PRIORITY] [IGNORE] [INTO] tbl_name [(column list)] SELECT ...
@end example
With @code{INSERT ... SELECT} statement you can quickly insert many rows
into a table from one or many tables.
@example
INSERT INTO tblTemp2 (fldID) SELECT tblTemp1.fldOrder_ID FROM tblTemp1 WHERE
tblTemp1.fldOrder_ID > 100;
@end example
The following conditions hold for an @code{INSERT ... SELECT} statement:
@itemize @minus
@item
The query cannot contain an @code{ORDER BY} clause.
@item
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
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
find records that were inserted earlier during the same run. When using
sub-select clauses, the situation could easily be very confusing!)
@item
@code{AUTO_INCREMENT} columns work as usual.
@item
You can use the C API function @code{mysql_info()} to get information about
the query. @xref{INSERT}.
@end itemize
You can of course also use @code{REPLACE} instead of @code{INSERT} to
overwrite old rows.
@findex INSERT DELAYED @findex INSERT DELAYED
@findex DELAYED @findex DELAYED
@cindex INSERT DELAYED
@node INSERT DELAYED, , INSERT SELECT, INSERT
@subsection @code{INSERT DELAYED} syntax
@example
INSERT DELAYED ...
@end example
The @code{DELAYED} option for the @code{INSERT} statement is a
@strong{MySQL}-specific option that is very 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
periodically run @code{SELECT} and @code{UPDATE} statements that take a
long time to complete. @code{DELAYED} was introduced in @strong{MySQL}
Version 3.22.15. It is a @strong{MySQL} extension to ANSI SQL92.
The @code{DELAYED} option @code{INSERT DELAYED} only works with @code{ISAM} and @code{MyISAM}
for the tables. Note that as @code{MyISAM} tables supports concurrent
@code{INSERT} statement is a @strong{MySQL}-specific option that is very @code{SELECT} and @code{INSERT}, if there is no empty blocks in the data
useful if you have clients that can't wait for the @code{INSERT} to complete. file, you very seldom need to use @code{INSERT DELAYED} with
This is a common problem when you use @strong{MySQL} for logging and you also @code{MyISAM}.
periodically run @code{SELECT} statements that take a long time to complete.
@code{DELAYED} was introduced in @strong{MySQL} Version 3.22.15. It is a
@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.
...@@ -22608,6 +22667,7 @@ used them. ...@@ -22608,6 +22667,7 @@ used them.
@cindex table types, choosing @cindex table types, choosing
@cindex @code{BDB} table type @cindex @code{BDB} table type
@cindex @code{Berkeley_db} table type @cindex @code{Berkeley_db} table type
@cindex @code{GEMINI} table type
@cindex @code{HEAP} table type @cindex @code{HEAP} table type
@cindex @code{ISAM} table type @cindex @code{ISAM} table type
@cindex @code{INNOBASE} table type @cindex @code{INNOBASE} table type
...@@ -22678,7 +22738,8 @@ of both worlds. ...@@ -22678,7 +22738,8 @@ of both worlds.
* ISAM:: ISAM tables * ISAM:: ISAM tables
* HEAP:: HEAP tables * HEAP:: HEAP tables
* BDB:: BDB or Berkeley_db tables * BDB:: BDB or Berkeley_db tables
* INNOBASE:: * GEMINI:: GEMINI tables
* INNOBASE:: INNOBASE tables
@end menu @end menu
@node MyISAM, MERGE, Table types, Table types @node MyISAM, MERGE, Table types, Table types
...@@ -23295,7 +23356,7 @@ SUM_OVER_ALL_KEYS(max_length_of_key + sizeof(char*) * 2) ...@@ -23295,7 +23356,7 @@ SUM_OVER_ALL_KEYS(max_length_of_key + sizeof(char*) * 2)
@cindex tables, @code{BDB} @cindex tables, @code{BDB}
@cindex tables, @code{Berkeley DB} @cindex tables, @code{Berkeley DB}
@node BDB, INNOBASE, HEAP, Table types @node BDB, GEMINI, HEAP, Table types
@section BDB or Berkeley_db Tables @section BDB or Berkeley_db Tables
@menu @menu
...@@ -23310,9 +23371,8 @@ SUM_OVER_ALL_KEYS(max_length_of_key + sizeof(char*) * 2) ...@@ -23310,9 +23371,8 @@ SUM_OVER_ALL_KEYS(max_length_of_key + sizeof(char*) * 2)
@node BDB overview, BDB install, BDB, BDB @node BDB overview, BDB install, BDB, BDB
@subsection Overview over BDB tables @subsection Overview over BDB tables
BDB tables are included in the @strong{MySQL} source distribution BDB is included in the @strong{MySQL} source distribution starting
starting from 3.23.34 and will be activated in the @strong{MySQL}-max from 3.23.34 and will be activated in the @strong{MySQL}-max binary.
binary.
Berkeley DB (@uref{http://www.sleepycat.com}) has provided Berkeley DB (@uref{http://www.sleepycat.com}) has provided
@strong{MySQL} with a transaction-safe table handler. This will survive @strong{MySQL} with a transaction-safe table handler. This will survive
...@@ -23509,22 +23569,103 @@ This is not fatal but we don't recommend that you delete tables if you are ...@@ -23509,22 +23569,103 @@ This is not fatal but we don't recommend that you delete tables if you are
not in @code{auto_commit} mode, until this problem is fixed (the fix is not in @code{auto_commit} mode, until this problem is fixed (the fix is
not trivial). not trivial).
@node INNOBASE, , BDB, Table types @cindex tables, @code{GEMINI}
@node GEMINI, INNOBASE, BDB, Table types
@section GEMINI Tables
@menu
* GEMINI overview::
* GEMINI start::
* GEMINI features::
* GEMINI TODO::
@end menu
@node GEMINI overview, GEMINI start, GEMINI, GEMINI
@subsection Overview of GEMINI tables
The @code{GEMINI} table type is developed and supported by NuSphere Corporation
(@uref{http://www.nusphere.com}). It features row-level locking, transaction
support (@code{COMMIT} and @code{ROLLBACK}), and automatic crash recovery.
@code{GEMINI} tables will be included in the @strong{MySQL} 4.0 source
distribution.
@node GEMINI start, GEMINI features, GEMINI overview, GEMINI
@subsection GEMINI startup options
If you are running with @code{AUTOCOMMIT=0} then your changes in @code{GEMINI}
tables will not be updated until you execute @code{COMMIT}. Instead of commit
you can execute @code{ROLLBACK} to forget your changes. @xref{COMMIT}.
If you are running with @code{AUTOCOMMIT=1} (the default), your changes
will be committed immediately. You can start an extended transaction with
the @code{BEGIN WORK} SQL command, after which your changes will not be
committed until you execute @code{COMMIT} (or decide to @code{ROLLBACK}
the changes).
The following options to @code{mysqld} can be used to change the behavior of
GEMINI tables:
@multitable @columnfractions .30 .70
@item @strong{Option} @tab @strong{Meaning}
@item @code{--gemini-full-recovery} @tab Default.
@item @code{--gemini-no-recovery} @tab Turn off recovery logging. Not recommended.
@item @code{--gemini-lazy-commit} @tab Relaxes the flush log at commit rule.
@item @code{--gemini-unbuffered-io} @tab All database writes bypass OS cache.
@item @code{--skip-gemini} @tab Don't use Gemini.
@item @code{--O gemini_db_buffers=#} @tab Number of database buffers in database cache.
@item @code{--O gemini_connection_limit=#} @tab Maximum number of connections to Gemini.
@item @code{--O gemini_spin_retries=#} @tab Spin lock retries (optimization).
@item @code{--O gemini_io_threads=#} @tab Number of background I/O threads.
@item @code{--O gemini_lock_table_size=#} @tab Set the maximum number of locks. Default 4096.
@end multitable
If you use @code{--skip-gemini}, @strong{MySQL} will not initialize the
Gemini table handler, saving memory; you cannot use Gemini tables if you
use @code{--skip-gemini}.
@node GEMINI features, GEMINI TODO, GEMINI start, GEMINI
@subsection Features of @code{GEMINI} tables:
@itemize @bullet
@item
If a query result can be resolved solely from the index key, Gemini will
not read the actual row stored in the database.
@item
Locking on Gemini tables is done at row level.
@item
@code{SELECT COUNT(*) FROM table_name} is fast; Gemini maintains a count
of the number of rows in the table.
@end itemize
@node GEMINI TODO, , GEMINI features, GEMINI
@subsection Current limitations of @code{GEMINI} tables:
@itemize @bullet
@item
BLOB columns are not supported in @code{GEMINI} tables.
@item
The maximum number of concurrent users accessing @code{GEMINI} tables is
limited by @code{gemini_connection_limit}. The default is 100 users.
@end itemize
NuSphere is working on removing these limitations.
@node INNOBASE, , GEMINI, Table types
@section INNOBASE Tables @section INNOBASE Tables
@menu @menu
* INNOBASE overview:: * INNOBASE overview::
* Innobase startup options:: * INNOBASE start:: INNOBASE startup options
* Using Innobase tables:: * Using INNOBASE tables:: Using INNOBASE tables
* INNOBASE restrictions:: * INNOBASE restrictions:: Some restrictions on @code{INNOBASE} tables:
@end menu @end menu
@node INNOBASE overview, Innobase startup options, INNOBASE, INNOBASE @node INNOBASE overview, INNOBASE start, INNOBASE, INNOBASE
@subsection INNOBASE Tables overview @subsection INNOBASE Tables overview
Innobase tables are included in the @strong{MySQL} source distribution Innobase is included in the @strong{MySQL} source distribution starting
starting from 3.23.34 and will be activated in the @strong{MySQL}-max from 3.23.34 and will be activated in the @strong{MySQL}-max binary.
binary.
If you have downloaded a binary version of @strong{MySQL} that includes If you have downloaded a binary version of @strong{MySQL} that includes
support for Berkeley DB, simply follow the instructions for support for Berkeley DB, simply follow the instructions for
...@@ -23550,8 +23691,8 @@ Innobase is a table handler that is under the GNU GPL License Version 2 ...@@ -23550,8 +23691,8 @@ Innobase is a table handler that is under the GNU GPL License Version 2
(of June 1991). In the source distribution of MySQL, Innobase appears as (of June 1991). In the source distribution of MySQL, Innobase appears as
a subdirectory. a subdirectory.
@node Innobase startup options, Using Innobase tables, INNOBASE overview, INNOBASE @node INNOBASE start, Using INNOBASE tables, INNOBASE overview, INNOBASE
@subsection Innobase startup options @subsection INNOBASE startup options
To use Innobase tables you must specify configuration parameters To use Innobase tables you must specify configuration parameters
in the MySQL configuration file in the @code{[mysqld]} section of in the MySQL configuration file in the @code{[mysqld]} section of
...@@ -23647,8 +23788,8 @@ Innobase cannot notice. In cases like this the timeout is useful to ...@@ -23647,8 +23788,8 @@ Innobase cannot notice. In cases like this the timeout is useful to
resolve the situation. resolve the situation.
@end multitable @end multitable
@node Using Innobase tables, INNOBASE restrictions, Innobase startup options, INNOBASE @node Using INNOBASE tables, INNOBASE restrictions, INNOBASE start, INNOBASE
@subsection Using Innobase tables @subsection Using INNOBASE tables
Technically, Innobase is a database backend placed under MySQL. Innobase Technically, Innobase is a database backend placed under MySQL. Innobase
has its own buffer pool for caching data and indexes in main has its own buffer pool for caching data and indexes in main
...@@ -23723,7 +23864,7 @@ P.O.Box 800 ...@@ -23723,7 +23864,7 @@ P.O.Box 800
Finland Finland
@end example @end example
@node INNOBASE restrictions, , Using Innobase tables, INNOBASE @node INNOBASE restrictions, , Using INNOBASE tables, INNOBASE
@subsection Some restrictions on @code{INNOBASE} tables: @subsection Some restrictions on @code{INNOBASE} tables:
@itemize @bullet @itemize @bullet
...@@ -26474,7 +26615,7 @@ tables}. ...@@ -26474,7 +26615,7 @@ tables}.
* Replication Options:: Replication Options in my.cnf * Replication Options:: Replication Options in my.cnf
* Replication SQL:: SQL Commands related to replication * Replication SQL:: SQL Commands related to replication
* Replication FAQ:: Frequently Asked Questions about replication * Replication FAQ:: Frequently Asked Questions about replication
* Troubleshooting Replication:: Troubleshooting Replication. Troubleshooting Replication. Troubleshooting Replication. Troubleshooting Replication. Troubleshooting Replication. Troubleshooting Replication. Troubleshooting Replication. Troubleshooting Replication. Troubleshooting Replication. Troubleshooting Replication. Troubleshooting Replication. Troubleshooting Replication. Troubleshooting Replication. * Troubleshooting Replication:: Troubleshooting Replication. Troubleshooting Replication. Troubleshooting Replication
@end menu @end menu
@node Replication Intro, Replication Implementation, Replication, Replication @node Replication Intro, Replication Implementation, Replication, Replication
...@@ -29913,7 +30054,7 @@ performance in a threaded system! ...@@ -29913,7 +30054,7 @@ performance in a threaded system!
@xref{Multiple servers}. @xref{Multiple servers}.
This is an example of the config file on behalf of @code{mysqld_multi}. This is an example of the config file on behalf of @code{mysqld_multi}.
@example @example
# This file should probably be in your home dir (~/.my.cnf) or /etc/my.cnf # This file should probably be in your home dir (~/.my.cnf) or /etc/my.cnf
...@@ -39138,8 +39279,7 @@ Two APIs are available in the @strong{MySQL} ...@@ -39138,8 +39279,7 @@ Two APIs are available in the @strong{MySQL}
@section MySQL Python APIs @section MySQL Python APIs
The @strong{MySQL} @uref{http://www.mysql.com/Downloads/Contrib/,Contrib directory} The @strong{MySQL} @uref{http://www.mysql.com/Downloads/Contrib/,Contrib directory}
contains a Python contains a Python interface written by Joseph Skinner.
interface written by Joseph Skinner.
You can also use the Python interface to iODBC to access a You can also use the Python interface to iODBC to access a
@strong{MySQL} server. @strong{MySQL} server.
...@@ -41449,6 +41589,12 @@ Our security expert. ...@@ -41449,6 +41589,12 @@ Our security expert.
@item @item
Vio interface (foundation for the the encrypted client/server protocol). Vio interface (foundation for the the encrypted client/server protocol).
@item @item
MySQL Filesystem (Way to use MySQL databases as files and directories).
@item
CASE Expression
@item
MD5(), COALESCE() functions.
@item
@code{RAID} support for @code{MyISAM} tables. @code{RAID} support for @code{MyISAM} tables.
@end itemize @end itemize
...@@ -41904,6 +42050,11 @@ not yet 100 % confident in this code. ...@@ -41904,6 +42050,11 @@ not yet 100 % confident in this code.
Added the @code{INNOBASE} table handler and the @code{BDB} table handler Added the @code{INNOBASE} table handler and the @code{BDB} table handler
to the @strong{MySQL} source distribution. to the @strong{MySQL} source distribution.
@item @item
Updated the documentation about @code{GEMINI} tables.
@item
Fixed thread-hang-bug in @code{INSERT DELAYED} when inserting
@code{NULL} into an @code{AUTO_INCREMENT} column.
@item
@code{REPLACE} will not replace a row that conflicts with an @code{REPLACE} will not replace a row that conflicts with an
@code{auto_increment} generated key. @code{auto_increment} generated key.
@item @item
...@@ -46806,6 +46957,11 @@ ORDER BY columns in the result, something that is you are not allowed ...@@ -46806,6 +46957,11 @@ ORDER BY columns in the result, something that is you are not allowed
to do in ANSI SQL. to do in ANSI SQL.
@item @item
Because @strong{MySQL} allows you to work with table types that doesn't
support transactions (and thus can't @code{rollback} data) some things
behaves a little different in @strong{MySQL} than in other SQL servers:
(This is just to ensure that @strong{MySQL} never need to do a rollback
for a SQL command). This may be a little akward at times as column
Because @strong{MySQL} allows you to work with table types that don't Because @strong{MySQL} allows you to work with table types that don't
support transactions, and thus can't @code{rollback} data, some things support transactions, and thus can't @code{rollback} data, some things
behave a little differently in @strong{MySQL} than in other SQL servers. behave a little differently in @strong{MySQL} than in other SQL servers.
...@@ -3,3 +3,8 @@ a tmsp ...@@ -3,3 +3,8 @@ a tmsp
5 19711006010203 5 19711006010203
6 19711006010203 6 19711006010203
8 19711006010203 8 19711006010203
a b
1 b
2 c
3 d
4 e
...@@ -15,3 +15,17 @@ insert into t1 set a = 8,tmsp=19711006010203; ...@@ -15,3 +15,17 @@ insert into t1 set a = 8,tmsp=19711006010203;
select * from t1 where tmsp=0; select * from t1 where tmsp=0;
select * from t1 where tmsp=19711006010203; select * from t1 where tmsp=19711006010203;
drop table t1; drop table t1;
#
# Test bug when inserting NULL into an auto_increment field with
# INSERT DELAYED
#
create table t1 (a int not null auto_increment primary key, b char(10));
insert delayed into t1 values (1,"b");
insert delayed into t1 values (null,"c");
insert delayed into t1 values (3,"d"),(null,"e");
--error 1136
insert delayed into t1 values (3,"this will give an","error");
select * from t1;
drop table t1;
#!@PERL@ #!@PERL@
# mysqldumpslow - parse and summarize the MySQL slow query log # mysqldumpslow - parse and summarize the MySQL slow query log
# Original version by Tim Bunce, sometime in 2000.
# Further changes by Tim Bunce, 8th March 2001.
use strict; use strict;
use Getopt::Long; use Getopt::Long;
...@@ -8,69 +11,128 @@ use Getopt::Long; ...@@ -8,69 +11,128 @@ use Getopt::Long;
# at, al, and ar are the corresponding averages # at, al, and ar are the corresponding averages
my %opt = ( my %opt = (
s => 'at', s => 'at',
h => '*', h => '*',
); );
GetOptions(\%opt, GetOptions(\%opt,
'v+', # verbose 'v+', # verbose
'd+', # debug 'd+', # debug
's=s', # what to sort by (t, at, l, al, r, ar etc) 's=s', # what to sort by (t, at, l, al, r, ar etc)
'a!', # don't abstract all numbers to N and strings to 'S' 'r!', # reverse the sort order (largest last instead of first)
'g=s', # grep: only consider stmts that include this string 't=i', # just show the top n queries
'h=s', # hostname of db server (can be wildcard) 'a!', # don't abstract all numbers to N and strings to 'S'
'n=i', # abstract numbers with at least n digits within names
'g=s', # grep: only consider stmts that include this string
'h=s', # hostname of db server for *-slow.log filename (can be wildcard)
'i=s', # name of server instance (if using mysql.server startup script)
'l!', # don't subtract lock time from total time
) or die "Bad option"; ) or die "Bad option";
my %stmt;
my $datadir = "/var/lib/mysql"; # XXX should fetch dynamically
@ARGV = <$datadir/$opt{h}-slow.log>;
$/ = "\n#"; # read entire statements using paragraph mode
while (<>) {
print "[$_]\n" if $opt{v};
s/^#// unless %stmt;
s/\s*Time: (\d+) Lock_time: (\d+) Rows_sent: (\d+).*\n//;
my ($t, $l, $r) = ($1, $2, $3);
s/^use \w+;\n//; # not consistently added unless (@ARGV) {
s/^SET timestamp=\d+;\n//; my $defaults = `my_print_defaults mysqld`;
my $basedir = ($defaults =~ m/--basedir=(.*)/)[0]
s/^[ ]*\n//mg; # delete blank lines or die "Can't determine basedir from 'my_print_defaults mysqld' output: $defaults";
s/^[ ]*/ /mg; # normalize leading whitespace warn "basedir=$basedir\n" if $opt{v};
s/\s*;\s*(#\s*)?$//; # remove traing semicolon(+newline-hash)
my $datadir = ($defaults =~ m/--datadir=(.*)/)[0];
next if $opt{g} and !m/$opt{g}/i; if (!$datadir or $opt{i}) {
# determine the datadir from the instances section of /etc/my.cnf, if any
unless ($opt{a}) { my $instances = `my_print_defaults instances`;
s/\b\d+\b/N/g; die "Can't determine datadir from 'my_print_defaults mysqld' output: $defaults"
s/\b0x[0-9A-Fa-f]+\b/N/g; unless $instances;
s/'.*?'/'S'/g; my @instances = ($instances =~ m/^--(\w+)-/mg);
s/".*?"/"S"/g; die "No -i 'instance_name' specified to select among known instances: @instances.\n"
} unless $opt{i};
die "Instance '$opt{i}' is unknown (known instances: @instances)\n"
unless grep { $_ eq $opt{i} } @instances;
$datadir = ($instances =~ m/--$opt{i}-datadir=(.*)/)[0]
or die "Can't determine --$opt{i}-datadir from 'my_print_defaults instances' output: $instances";
warn "datadir=$datadir\n" if $opt{v};
}
@ARGV = <$datadir/$opt{h}-slow.log>;
die "Can't find '$datadir/$opt{h}-slow.log'\n" unless @ARGV;
}
$stmt{$_}->{c} += 1; warn "\nReading mysql slow query log from @ARGV\n";
$stmt{$_}->{t} += $t;
$stmt{$_}->{l} += $l;
$stmt{$_}->{r} += $r;
warn "[$_]" if $opt{d}; my @pending;
my %stmt;
$/ = ";\n#"; # read entire statements using paragraph mode
while ( defined($_ = shift @pending) or defined($_ = <>) ) {
warn "[[$_]]\n" if $opt{d}; # show raw paragraph being read
my @chunks = split /^\/.*Version.*started with[\000-\377]*?Time.*Id.*Command.*Argument.*\n/m;
if (@chunks > 1) {
unshift @pending, map { length($_) ? $_ : () } @chunks;
warn "<<".join(">>\n<<",@chunks).">>" if $opt{d};
next;
}
s/^#? Time: \d{6}\s+\d+:\d+:\d+.*\n//;
my ($user,$host) = s/^#? User\@Host:\s+(\S+)\s+\@\s+(\S+).*\n// ? ($1,$2) : ('','');
s/^# Time: (\d+) Lock_time: (\d+) Rows_sent: (\d+).*\n//;
my ($t, $l, $r) = ($1, $2, $3);
$t -= $l unless $opt{l};
# remove fluff that mysqld writes to log when it (re)starts:
s!^/.*Version.*started with:.*\n!!mg;
s!^Tcp port: \d+ Unix socket: \S+\n!!mg;
s!^Time.*Id.*Command.*Argument.*\n!!mg;
s/^use \w+;\n//; # not consistently added
s/^SET timestamp=\d+;\n//;
s/^[ ]*\n//mg; # delete blank lines
s/^[ ]*/ /mg; # normalize leading whitespace
s/\s*;\s*(#\s*)?$//; # remove trailing semicolon(+newline-hash)
next if $opt{g} and !m/$opt{g}/io;
unless ($opt{a}) {
s/\b\d+\b/N/g;
s/\b0x[0-9A-Fa-f]+\b/N/g;
s/'.*?'/'S'/g;
s/".*?"/"S"/g;
# -n=8: turn log_20001231 into log_NNNNNNNN
s/([a-z_]+)(\d{$opt{n},})/$1.('N' x length($2))/ieg if $opt{n};
# abbreviate massive "in (...)" statements and similar
s!(([NS],){100,})!sprintf("$2,{repeated %d times}",length($1)/2)!eg;
}
my $s = $stmt{$_} ||= { users=>{}, hosts=>{} };
$s->{c} += 1;
$s->{t} += $t;
$s->{l} += $l;
$s->{r} += $r;
$s->{users}->{$user}++ if $user;
$s->{hosts}->{$host}++ if $host;
warn "{{$_}}\n\n" if $opt{d}; # show processed statement string
} }
foreach (keys %stmt) { foreach (keys %stmt) {
my $v = $stmt{$_} || die; my $v = $stmt{$_} || die;
my ($c, $t, $l, $r) = @{ $v }{qw(c t l r)}; my ($c, $t, $l, $r) = @{ $v }{qw(c t l r)};
$v->{at} = $t / $c; $v->{at} = $t / $c;
$v->{al} = $l / $c; $v->{al} = $l / $c;
$v->{ar} = $r / $c; $v->{ar} = $r / $c;
} }
my @sorted = sort { $stmt{$a}->{$opt{s}} <=> $stmt{$b}->{$opt{s}} } keys %stmt; my @sorted = sort { $stmt{$b}->{$opt{s}} <=> $stmt{$a}->{$opt{s}} } keys %stmt;
@sorted = @sorted[0 .. $opt{t}-1] if $opt{t};
@sorted = reverse @sorted if $opt{r};
foreach (@sorted) { foreach (@sorted) {
my $v = $stmt{$_} || die; my $v = $stmt{$_} || die;
my ($c, $t,$at, $l,$al, $r,$ar) = @{ $v }{qw(c t at l al r ar)}; my ($c, $t,$at, $l,$al, $r,$ar) = @{ $v }{qw(c t at l al r ar)};
printf "Count: %d Time: %.2f (%d) Lock_time: %.2f (%d) Rows_sent: %.1f (%d) \n%s\n\n", my @users = keys %{$v->{users}};
$c, $at,$t, $al,$l, $ar,$r, $_; my $user = (@users==1) ? $users[0] : sprintf "%dusers",scalar @users;
my @hosts = keys %{$v->{hosts}};
my $host = (@hosts==1) ? $hosts[0] : sprintf "%dhosts",scalar @hosts;
printf "Count: %d Time=%.2fs (%ds) Lock=%.2fs (%ds) Rows=%.1f (%d), $user\@$host\n%s\n\n",
$c, $at,$t, $al,$l, $ar,$r, $_;
} }
...@@ -133,7 +133,8 @@ set_field_to_null(Field *field) ...@@ -133,7 +133,8 @@ set_field_to_null(Field *field)
return 0; return 0;
} }
if (!current_thd->no_errors) if (!current_thd->no_errors)
my_printf_error(ER_BAD_NULL_ERROR,ER(ER_BAD_NULL_ERROR),MYF(0),field->field_name); my_printf_error(ER_BAD_NULL_ERROR,ER(ER_BAD_NULL_ERROR),MYF(0),
field->field_name);
return 1; return 1;
} }
return 0; return 0;
......
...@@ -247,9 +247,12 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields, ...@@ -247,9 +247,12 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields,
} }
if (lock_type == TL_WRITE_DELAYED) if (lock_type == TL_WRITE_DELAYED)
{ {
id=0; // No auto_increment id if (!error)
info.copied=values_list.elements; {
end_delayed_insert(thd); id=0; // No auto_increment id
info.copied=values_list.elements;
end_delayed_insert(thd);
}
} }
else else
{ {
...@@ -486,7 +489,7 @@ class delayed_insert :public ilink { ...@@ -486,7 +489,7 @@ class delayed_insert :public ilink {
table(0),tables_in_use(0),stacked_inserts(0), status(0), dead(0), table(0),tables_in_use(0),stacked_inserts(0), status(0), dead(0),
group_count(0) group_count(0)
{ {
thd.user=thd.host=(char*) ""; thd.user=0; thd.host=(char*) localhost;
thd.current_tablenr=0; thd.current_tablenr=0;
thd.version=refresh_version; thd.version=refresh_version;
thd.command=COM_DELAYED_INSERT; thd.command=COM_DELAYED_INSERT;
...@@ -676,7 +679,7 @@ static TABLE *delayed_get_table(THD *thd,TABLE_LIST *table_list) ...@@ -676,7 +679,7 @@ static TABLE *delayed_get_table(THD *thd,TABLE_LIST *table_list)
TABLE *delayed_insert::get_local_table(THD* client_thd) TABLE *delayed_insert::get_local_table(THD* client_thd)
{ {
my_ptrdiff_t adjust_ptrs; my_ptrdiff_t adjust_ptrs;
Field **field,**org_field; Field **field,**org_field, *found_next_number_field;
TABLE *copy; TABLE *copy;
/* First request insert thread to get a lock */ /* First request insert thread to get a lock */
...@@ -719,11 +722,14 @@ TABLE *delayed_insert::get_local_table(THD* client_thd) ...@@ -719,11 +722,14 @@ TABLE *delayed_insert::get_local_table(THD* client_thd)
adjust_ptrs=PTR_BYTE_DIFF(copy->record[0],table->record[0]); adjust_ptrs=PTR_BYTE_DIFF(copy->record[0],table->record[0]);
found_next_number_field=table->found_next_number_field;
for (org_field=table->field ; *org_field ; org_field++,field++) for (org_field=table->field ; *org_field ; org_field++,field++)
{ {
if (!(*field= (*org_field)->new_field(copy))) if (!(*field= (*org_field)->new_field(copy)))
return 0; return 0;
(*field)->move_field(adjust_ptrs); // Point at copy->record[0] (*field)->move_field(adjust_ptrs); // Point at copy->record[0]
if (*org_field == found_next_number_field)
(*field)->table->found_next_number_field= *field;
} }
*field=0; *field=0;
...@@ -806,14 +812,17 @@ static int write_delayed(THD *thd,TABLE *table,enum_duplicates duplic, ...@@ -806,14 +812,17 @@ static int write_delayed(THD *thd,TABLE *table,enum_duplicates duplic,
static void end_delayed_insert(THD *thd) static void end_delayed_insert(THD *thd)
{ {
DBUG_ENTER("end_delayed_insert");
delayed_insert *di=thd->di; delayed_insert *di=thd->di;
pthread_mutex_lock(&di->mutex); pthread_mutex_lock(&di->mutex);
DBUG_PRINT("info",("tables in use: %d",di->tables_in_use));
if (!--di->tables_in_use || di->thd.killed) if (!--di->tables_in_use || di->thd.killed)
{ // Unlock table { // Unlock table
di->status=1; di->status=1;
pthread_cond_signal(&di->cond); pthread_cond_signal(&di->cond);
} }
pthread_mutex_unlock(&di->mutex); pthread_mutex_unlock(&di->mutex);
DBUG_VOID_RETURN;
} }
...@@ -951,6 +960,7 @@ static pthread_handler_decl(handle_delayed_insert,arg) ...@@ -951,6 +960,7 @@ static pthread_handler_decl(handle_delayed_insert,arg)
pthread_mutex_unlock(&di->thd.mysys_var->mutex); pthread_mutex_unlock(&di->thd.mysys_var->mutex);
di->thd.proc_info=0; di->thd.proc_info=0;
DBUG_PRINT("info",("Waiting for someone to insert rows"));
for ( ; ;) for ( ; ;)
{ {
int error; int error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment