Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
1a754720
Commit
1a754720
authored
Nov 02, 2001
by
arjen@co3064164-a.bitbike.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
manual.texi:
InnoDB section merge from Heikki.
parent
8066874e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
258 additions
and
144 deletions
+258
-144
Docs/manual.texi
Docs/manual.texi
+258
-144
No files found.
Docs/manual.texi
View file @
1a754720
...
@@ -37458,37 +37458,85 @@ SUM_OVER_ALL_KEYS(max_length_of_key + sizeof(char*) * 2)
...
@@ -37458,37 +37458,85 @@ SUM_OVER_ALL_KEYS(max_length_of_key + sizeof(char*) * 2)
@section InnoDB Tables
@section InnoDB Tables
@menu
@menu
* InnoDB overview:: InnoDB
tables o
verview
* InnoDB overview:: InnoDB
Tables O
verview
* InnoDB start:: InnoDB
startup o
ptions
* InnoDB start:: InnoDB
Startup O
ptions
* InnoDB init:: Creating InnoDB
table space.
* InnoDB init:: Creating InnoDB
Tablespace
* Using InnoDB tables:: Creating InnoDB
t
ables
* Using InnoDB tables:: Creating InnoDB
T
ables
* Adding and removing:: Adding and
removing InnoDB data and log f
iles
* Adding and removing:: Adding and
Removing InnoDB Data and Log F
iles
* Backing up:: Backing up and
recovering an InnoDB d
atabase
* Backing up:: Backing up and
Recovering an InnoDB D
atabase
* Moving:: Moving an InnoDB
database to another m
achine
* Moving:: Moving an InnoDB
Database to Another M
achine
* InnoDB transaction model:: InnoDB
transaction m
odel.
* InnoDB transaction model:: InnoDB
Transaction M
odel.
* Implementation:: Implementation of
m
ultiversioning
* Implementation:: Implementation of
M
ultiversioning
* Table and index:: Table and
index s
tructures
* Table and index:: Table and
Index S
tructures
* File space management:: File
space management and d
isk i/o
* File space management:: File
Space Management and D
isk i/o
* Error handling:: Error
h
andling
* Error handling:: Error
H
andling
* InnoDB restrictions:: Restrictions on InnoDB
t
ables
* InnoDB restrictions:: Restrictions on InnoDB
T
ables
* InnoDB contact information:: InnoDB
contact i
nformation.
* InnoDB contact information:: InnoDB
Contact I
nformation.
@end menu
@end menu
@node InnoDB overview, InnoDB start, InnoDB, InnoDB
@node InnoDB overview, InnoDB start, InnoDB, InnoDB
@subsection InnoDB tables overview
@subsection InnoDB Tables Overview
InnoDB provides MySQL with a transaction-safe table handler with
commit, rollback, and crash recovery capabilities. InnoDB does
locking on row level and also provides an Oracle-style
consistent
non-locking read in @code{SELECT}s. These features increase
multiuser concurrency and performance. There is no need for
lock escalation in InnoDB,
because row level locks in InnoDB fit in very small space.
InnoDB tables support @code{FOREIGN KEY} constraints
as the first table type in MySQL.
InnoDB has been designed for maximum performance
when processing
large data volumes. Its CPU efficiency is probably not
matched by any other disk-based relational database engine.
Technically, InnoDB is a complete database backend placed under MySQL.
InnoDB has its own buffer pool for caching data and indexes in main
memory. InnoDB stores its tables and indexes in a tablespace, which
may consist of several files. This is different from, for example,
MyISAM tables where each table is stored as a separate file.
InnoDB tables can be of any size also on those operating
systems where file size is limited to 2 GB.
You can find the latest information about InnoDB at
@uref{http://www.innodb.com}. The most up-to-date version of the
InnoDB manual is always placed there, and you can also order
commercial licenses and support for InnoDB.
InnoDB is currently (October 2001) used in production at
several large database sites requiring high performance.
The famous Internet news site Slashdot.org runs on
InnoDB. Mytrix, Inc. stores over 1 TB of data in
InnoDB, and another site handles an average
load of 800 inserts/updates per second in InnoDB.
InnoDB tables are included in the MySQL source distribution
InnoDB tables are included in the MySQL source distribution
starting from 3.23.34a and are activated in the @strong{MySQL -max}
starting from 3.23.34a and are activated in the MySQL -Max
binary.
binary. For Windows the -Max binaries are contained in the
standard distribution.
If you have downloaded a binary version of MySQL that includes
If you have downloaded a binary version of MySQL that includes
support for InnoDB (mysqld-max), simply follow the instructions for
support for InnoDB, simply follow the instructions of the
installing a binary version of MySQL. @xref{Installing binary}.
MySQL manual
for installing a binary version of MySQL. If you already have
MySQL-3.23 installed, then the simplest way to install
MySQL -Max is to replace the server executable @file{mysqld}
with the corresponding executable in the -Max distribution.
MySQL and MySQL -Max differ only in the server executable.
@xref{Installing binary}.
@xref{mysqld-max, , @code{mysqld-max}}.
@xref{mysqld-max, , @code{mysqld-max}}.
To compile MySQL with InnoDB support, download MySQL-3.23.37 or newer
To compile MySQL with InnoDB support,
and configure MySQL with the @code{--with-innodb} option.
download MySQL-3.23.34a or newer version from
@uref{http://www.mysql.com}
and configure MySQL with the
@code{--with-innodb} option. See the
MySQL manual
about installing a MySQL source distribution.
@xref{Installing source}.
@xref{Installing source}.
@example
@example
...
@@ -37496,47 +37544,23 @@ cd /path/to/source/of/mysql-3.23.37
...
@@ -37496,47 +37544,23 @@ cd /path/to/source/of/mysql-3.23.37
./configure --with-innodb
./configure --with-innodb
@end example
@end example
To get InnoDB to work you have to specify where the data for InnoDB
To use InnoDB you have to specify InnoDB startup options in
tables should be stored by specifying the @code{innodb_data_file_path}
your @file{my.cnf} or @file{my.ini} file. The minimal way
option on the command line or in an MySQL option file. @xref{InnoDB
to modify it is to add to the @code{[mysqld]} section the line
start}. If you have configured MySQL for InnoDB but you have not
specified the above option, @code{mysqld} will print at start:
@example
@example
Can't initialize InnoDB as 'innodb_data_file_path' is not set
innodb_data_file_path=ibdata:30M
@end example
@end example
InnoDB provides MySQL with a transaction-safe table handler with
but to get good performance it is best that you specify options
commit, rollback, and crash recovery capabilities. InnoDB does
like recommended below in the section 'InnoDB startup options'.
locking on row level, and also provides an Oracle-style consistent
non-locking read in @code{SELECT}s, which increases transaction
concurrency. There is not need for lock escalation in InnoDB,
because row level locks in InnoDB fit in very small space.
InnoDB has been designed for maximum performance when processing
large data volumes. Its CPU efficiency is probably not
matched by any other disk-based relational database engine.
You can find the latest information about InnoDB at
@uref{http://www.innodb.com}. The most up-to-date version of the
InnoDB manual is always placed there, and you can also order commercial
support for InnoDB.
Technically, InnoDB is a database backend placed under MySQL. InnoDB
has its own buffer pool for caching data and indexes in main
memory. InnoDB stores its tables and indexes in a tablespace, which
may consist of several files. This is different from, for example,
@code{MyISAM} tables where each table is stored as a separate file.
InnoDB is distributed under the GNU GPL License Version 2 (of June 1991).
InnoDB is distributed under the GNU GPL License Version 2 (of June 1991).
In the source distribution of MySQL, InnoDB appears as a subdirectory.
In the source distribution of MySQL, InnoDB appears as a subdirectory.
@node InnoDB start, InnoDB init, InnoDB overview, InnoDB
@node InnoDB start, InnoDB init, InnoDB overview, InnoDB
@subsection InnoDB startup options
@subsection InnoDB Startup Options
Beginning from MySQL-3.23.37 the prefix of the options is changed
from @code{innobase_...} to @code{innodb_...}.
To use InnoDB tables you @strong{MUST} specify configuration parameters
To use InnoDB tables you @strong{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
...
@@ -37550,6 +37574,10 @@ hard disk. Below is an example of possible configuration parameters in
...
@@ -37550,6 +37574,10 @@ hard disk. Below is an example of possible configuration parameters in
@file{my.cnf} for InnoDB:
@file{my.cnf} for InnoDB:
@example
@example
[mysqld]
# You can write your other MySQL server options here
# ...
#
innodb_data_file_path = ibdata1:2000M;ibdata2:2000M
innodb_data_file_path = ibdata1:2000M;ibdata2:2000M
innodb_data_home_dir = c:\ibdata
innodb_data_home_dir = c:\ibdata
set-variable = innodb_mirrored_log_groups=1
set-variable = innodb_mirrored_log_groups=1
...
@@ -37558,19 +37586,34 @@ set-variable = innodb_log_files_in_group=3
...
@@ -37558,19 +37586,34 @@ set-variable = innodb_log_files_in_group=3
set-variable = innodb_log_file_size=30M
set-variable = innodb_log_file_size=30M
set-variable = innodb_log_buffer_size=8M
set-variable = innodb_log_buffer_size=8M
innodb_flush_log_at_trx_commit=1
innodb_flush_log_at_trx_commit=1
#.._arch_dir must be the same as .._log_group_home_dir
innodb_log_arch_dir = c:\iblogs
innodb_log_arch_dir = c:\iblogs
innodb_log_archive=0
innodb_log_archive=0
set-variable = innodb_buffer_pool_size=
8
0M
set-variable = innodb_buffer_pool_size=
7
0M
set-variable = innodb_additional_mem_pool_size=10M
set-variable = innodb_additional_mem_pool_size=10M
set-variable = innodb_file_io_threads=4
set-variable = innodb_file_io_threads=4
set-variable = innodb_lock_wait_timeout=50
set-variable = innodb_lock_wait_timeout=50
@end example
@end example
Note that data files must be < 4G, and < 2G on
Note that some operating systems
some file systems! The total size of data files has
restrict file size to < 2G.
The total size of data files has
to be >= 10 MB.
to be >= 10 MB.
InnoDB does not create directories:
InnoDB does not create directories:
you have to create them yourself.
you have to create them yourself.
Check that the MySQL server
has the rights to create files in the directories you specify.
When you the first time create an InnoDB database, it
is best that you start the MySQL server from the command
prompt. Then InnoDB will print the information about the
database creation to the screen, and you see what is
happening. See below in section 3 what the printout
should look like.
For example, in Windows you can start @file{mysqld-max.exe} with:
@example
your-path-to-mysqld>mysqld-max --standalone --console
@end example
Suppose you have a Linux machine with 512 MB RAM and
Suppose you have a Linux machine with 512 MB RAM and
three 20 GB hard disks (at directory paths @file{/},
three 20 GB hard disks (at directory paths @file{/},
...
@@ -37579,6 +37622,10 @@ Below is an example of possible configuration parameters in @file{my.cnf} for
...
@@ -37579,6 +37622,10 @@ Below is an example of possible configuration parameters in @file{my.cnf} for
InnoDB:
InnoDB:
@example
@example
[mysqld]
# You can write your other MySQL server options here
# ...
#
innodb_data_file_path = ibdata/ibdata1:2000M;dr2/ibdata/ibdata2:2000M
innodb_data_file_path = ibdata/ibdata1:2000M;dr2/ibdata/ibdata2:2000M
innodb_data_home_dir = /
innodb_data_home_dir = /
set-variable = innodb_mirrored_log_groups=1
set-variable = innodb_mirrored_log_groups=1
...
@@ -37587,9 +37634,10 @@ set-variable = innodb_log_files_in_group=3
...
@@ -37587,9 +37634,10 @@ set-variable = innodb_log_files_in_group=3
set-variable = innodb_log_file_size=50M
set-variable = innodb_log_file_size=50M
set-variable = innodb_log_buffer_size=8M
set-variable = innodb_log_buffer_size=8M
innodb_flush_log_at_trx_commit=1
innodb_flush_log_at_trx_commit=1
#.._arch_dir must be the same as .._log_group_home_dir
innodb_log_arch_dir = /dr3/iblogs
innodb_log_arch_dir = /dr3/iblogs
innodb_log_archive=0
innodb_log_archive=0
set-variable = innodb_buffer_pool_size=
40
0M
set-variable = innodb_buffer_pool_size=
35
0M
set-variable = innodb_additional_mem_pool_size=20M
set-variable = innodb_additional_mem_pool_size=20M
set-variable = innodb_file_io_threads=4
set-variable = innodb_file_io_threads=4
set-variable = innodb_lock_wait_timeout=50
set-variable = innodb_lock_wait_timeout=50
...
@@ -37615,9 +37663,12 @@ The common part of the directory path for all InnoDB data files.
...
@@ -37615,9 +37663,12 @@ The common part of the directory path for all InnoDB data files.
Paths to individual data files and their sizes. The full directory path
Paths to individual data files and their sizes. The full directory path
to each data file is acquired by concatenating innodb_data_home_dir to
to each data file is acquired by concatenating innodb_data_home_dir to
the paths specified here. The file sizes are specified in megabytes,
the paths specified here. The file sizes are specified in megabytes,
hence the 'M' after the size specification above. Do not set a file size
hence the 'M' after the size specification above.
bigger than 4000M, and on most operating systems not bigger than 2000M.
InnoDB also understands the abbreviation 'G', 1G meaning 1024M.
InnoDB also understands the abbreviation 'G', 1G meaning 1024M.
Starting from
3.23.44 you can set the file size bigger than 4 GB on those
operating systems which support big files.
On some operating systems files must be < 2 GB.
The sum of the sizes of the files must be at least 10 MB.
The sum of the sizes of the files must be at least 10 MB.
@item @code{innodb_mirrored_log_groups} @tab
@item @code{innodb_mirrored_log_groups} @tab
Number of identical copies of log groups we
Number of identical copies of log groups we
...
@@ -37632,7 +37683,8 @@ Size of each log file in a log group in megabytes. Sensible values range
...
@@ -37632,7 +37683,8 @@ Size of each log file in a log group in megabytes. Sensible values range
from 1M to the size of the buffer pool specified below. The bigger the
from 1M to the size of the buffer pool specified below. The bigger the
value, the less checkpoint flush activity is needed in the buffer pool,
value, the less checkpoint flush activity is needed in the buffer pool,
saving disk i/o. But bigger log files also mean that recovery will be
saving disk i/o. But bigger log files also mean that recovery will be
slower in case of a crash. File size restriction as for a data file.
slower in case of a crash. The combined size of log files must
be < 4 GB on 32-bit computers.
@item @code{innodb_log_buffer_size} @tab
@item @code{innodb_log_buffer_size} @tab
The size of the buffer which InnoDB uses to write log to the log files
The size of the buffer which InnoDB uses to write log to the log files
on disk. Sensible values range from 1M to half the combined size of log
on disk. Sensible values range from 1M to half the combined size of log
...
@@ -37657,7 +37709,7 @@ archive InnoDB log files.
...
@@ -37657,7 +37709,7 @@ archive InnoDB log files.
The size of the memory buffer InnoDB uses to cache data and indexes of
The size of the memory buffer InnoDB uses to cache data and indexes of
its tables. The bigger you set this the less disk i/o is needed to
its tables. The bigger you set this the less disk i/o is needed to
access data in tables. On a dedicated database server you may set this
access data in tables. On a dedicated database server you may set this
parameter up to
9
0 % of the machine physical memory size. Do not set it
parameter up to
8
0 % of the machine physical memory size. Do not set it
too large, though, because competition of the physical memory may cause
too large, though, because competition of the physical memory may cause
paging in the operating system.
paging in the operating system.
@item @code{innodb_additional_mem_pool_size} @tab
@item @code{innodb_additional_mem_pool_size} @tab
...
@@ -37669,7 +37721,7 @@ will start to allocate memory from the operating system, and write
...
@@ -37669,7 +37721,7 @@ will start to allocate memory from the operating system, and write
warning messages to the MySQL error log.
warning messages to the MySQL error log.
@item @code{innodb_file_io_threads} @tab
@item @code{innodb_file_io_threads} @tab
Number of file i/o threads in InnoDB. Normally, this should be 4, but
Number of file i/o threads in InnoDB. Normally, this should be 4, but
on Windows
NT
disk i/o may benefit from a larger number.
on Windows disk i/o may benefit from a larger number.
@item @code{innodb_lock_wait_timeout} @tab
@item @code{innodb_lock_wait_timeout} @tab
Timeout in seconds an InnoDB transaction may wait for a lock before
Timeout in seconds an InnoDB transaction may wait for a lock before
being rolled back. InnoDB automatically detects transaction deadlocks
being rolled back. InnoDB automatically detects transaction deadlocks
...
@@ -37686,7 +37738,7 @@ Another option is @code{O_DSYNC}.
...
@@ -37686,7 +37738,7 @@ Another option is @code{O_DSYNC}.
@node InnoDB init, Using InnoDB tables, InnoDB start, InnoDB
@node InnoDB init, Using InnoDB tables, InnoDB start, InnoDB
@subsection Creating InnoDB
table
space
@subsection Creating InnoDB
Table
space
Suppose you have installed MySQL and have edited @file{my.cnf} so that
Suppose you have installed MySQL and have edited @file{my.cnf} so that
it contains the necessary InnoDB configuration parameters.
it contains the necessary InnoDB configuration parameters.
...
@@ -37752,7 +37804,7 @@ mysqld: ready for connections
...
@@ -37752,7 +37804,7 @@ mysqld: ready for connections
@node Error creating InnoDB, , InnoDB init, InnoDB init
@node Error creating InnoDB, , InnoDB init, InnoDB init
@subsubsection If
something goes wrong in database c
reation
@subsubsection If
Something Goes Wrong in Database C
reation
If something goes wrong in an InnoDB database creation, you should
If something goes wrong in an InnoDB database creation, you should
delete all files created by InnoDB. This means all data files, all log
delete all files created by InnoDB. This means all data files, all log
...
@@ -37763,7 +37815,7 @@ directories. Then you can try the InnoDB database creation again.
...
@@ -37763,7 +37815,7 @@ directories. Then you can try the InnoDB database creation again.
@node Using InnoDB tables, Adding and removing, InnoDB init, InnoDB
@node Using InnoDB tables, Adding and removing, InnoDB init, InnoDB
@subsection Creating InnoDB
t
ables
@subsection Creating InnoDB
T
ables
Suppose you have started the MySQL client with the command
Suppose you have started the MySQL client with the command
@code{mysql test}.
@code{mysql test}.
...
@@ -37797,15 +37849,7 @@ Note that the statistics @code{SHOW} gives about InnoDB tables
...
@@ -37797,15 +37849,7 @@ Note that the statistics @code{SHOW} gives about InnoDB tables
are only approximate: they are used in SQL optimisation. Table and
are only approximate: they are used in SQL optimisation. Table and
index reserved sizes in bytes are accurate, though.
index reserved sizes in bytes are accurate, though.
NOTE: @code{DROP DATABASE} does not currently work for InnoDB tables!
@subsubsection Converting MyISAM Tables to InnoDB
You must drop the tables individually. Also take care not to delete or
add @file{.frm} files to your InnoDB database manually: use
@code{CREATE TABLE} and @code{DROP TABLE} commands.
InnoDB has its own internal data dictionary, and you will get problems
if the MySQL @file{.frm} files are out of 'sync' with the InnoDB
internal data dictionary.
@subsubsection Converting MyISAM tables to InnoDB
InnoDB does not have a special optimisation for separate index creation.
InnoDB does not have a special optimisation for separate index creation.
Therefore it does not pay to export and import the table and create indexes
Therefore it does not pay to export and import the table and create indexes
...
@@ -37845,9 +37889,55 @@ it is better that you kill the database process and delete all InnoDB data
...
@@ -37845,9 +37889,55 @@ it is better that you kill the database process and delete all InnoDB data
and log files and all InnoDB table @file{.frm} files, and start
and log files and all InnoDB table @file{.frm} files, and start
your job again, rather than wait for millions of disk i/os to complete.
your job again, rather than wait for millions of disk i/os to complete.
@subsubsection Foreign Key Constraints
InnoDB version 3.23.44 features foreign key constraints. InnoDB is the
first MySQL table type which allows you to define foreign key
constraints to guard the integrity of your data.
An example:
@example
CREATE TABLE parent(id INT NOT NULL, PRIMARY KEY (id)) TYPE=INNODB;
CREATE TABLE child(id INT, parent_id INT, INDEX par_ind (parent_id),
FOREIGN KEY (parent_id) REFERENCES parent(id)) TYPE=INNODB;
@end example
Both tables have to be InnoDB type and there must be an index
where the foreign key and the referenced key are listed as the first
columns. Any @code{ALTER TABLE} currently removes all foreign key
constrainst defined for the table, but not the constraints
that reference the table. Corresponding columns in the foreign key
and the referenced key have to have similar internal data types
inside InnoDB so that they can be compared without a type
conversion. The length of string types need not be the same.
The size and the signedness of integer types has to be same.
When doing foreign key checks InnoDB sets shared row
level locks on child or parent records it has to look at.
InnoDB allows you to drop any table even though that
would break the foreign key constraints which reference
the table. When you drop a table the constraints which
were defined in its create statement are also dropped.
If you recreate a table which was dropped, it has to have
a definition which conforms to the foreign key constraints
referencing it. It must have the right column names and types,
and it must have indexes on the referenced keys, as stated above.
You can list the foreign key constraints for a table
@code{T} with
@example
SHOW TABLE STATUS FROM yourdatabasename LIKE 'T';
@end example
The foreign key constraints are listed in the table comment of
the output.
InnoDB does not yet support @code{CASCADE ON DELETE}
or other special options on the constraints.
@node Adding and removing, Backing up, Using InnoDB tables, InnoDB
@node Adding and removing, Backing up, Using InnoDB tables, InnoDB
@subsection Adding and
removing InnoDB data and log f
iles
@subsection Adding and
Removing InnoDB Data and Log F
iles
You cannot increase the size of an InnoDB data file. To add more into
You cannot increase the size of an InnoDB data file. To add more into
your tablespace you have to add a new data file. To do this you have to
your tablespace you have to add a new data file. To do this you have to
...
@@ -37856,7 +37946,7 @@ new file to @code{innodb_data_file_path}, and then start MySQL
...
@@ -37856,7 +37946,7 @@ new file to @code{innodb_data_file_path}, and then start MySQL
again.
again.
Currently you cannot remove a data file from InnoDB. To decrease the
Currently you cannot remove a data file from InnoDB. To decrease the
size of your database you have to use @
cod
e{mysqldump} to dump
size of your database you have to use @
fil
e{mysqldump} to dump
all your tables, create a new database, and import your tables to the
all your tables, create a new database, and import your tables to the
new database.
new database.
...
@@ -37870,7 +37960,7 @@ you at the startup that it is creating new log files.
...
@@ -37870,7 +37960,7 @@ you at the startup that it is creating new log files.
@node Backing up, Moving, Adding and removing, InnoDB
@node Backing up, Moving, Adding and removing, InnoDB
@subsection Backing up and
recovering an InnoDB d
atabase
@subsection Backing up and
Recovering an InnoDB D
atabase
The key to safe database management is taking regular backups.
The key to safe database management is taking regular backups.
To take a 'binary' backup of your database you have to do the following:
To take a 'binary' backup of your database you have to do the following:
...
@@ -37989,7 +38079,7 @@ because there will be more log to apply to the database.
...
@@ -37989,7 +38079,7 @@ because there will be more log to apply to the database.
@node Moving, InnoDB transaction model, Backing up, InnoDB
@node Moving, InnoDB transaction model, Backing up, InnoDB
@subsection Moving an InnoDB
database to another m
achine
@subsection Moving an InnoDB
Database to Another M
achine
InnoDB data and log files are binary-compatible on all platforms
InnoDB data and log files are binary-compatible on all platforms
if the floating point number format on the machines is the same.
if the floating point number format on the machines is the same.
...
@@ -38010,10 +38100,10 @@ a table.
...
@@ -38010,10 +38100,10 @@ a table.
@node InnoDB transaction model, Implementation, Moving, InnoDB
@node InnoDB transaction model, Implementation, Moving, InnoDB
@subsection InnoDB
transaction m
odel
@subsection InnoDB
Transaction M
odel
In the InnoDB transaction model the goal has been to combine the best
In the InnoDB transaction model the goal has been to combine the best
sid
es of a multiversioning database to traditional two-phase locking.
properti
es of a multiversioning database to traditional two-phase locking.
InnoDB does locking on row level and runs queries by default
InnoDB does locking on row level and runs queries by default
as non-locking consistent reads, in the style of Oracle.
as non-locking consistent reads, in the style of Oracle.
The lock table in InnoDB is stored so space-efficiently that lock
The lock table in InnoDB is stored so space-efficiently that lock
...
@@ -38022,7 +38112,7 @@ to lock every row in the database, or any random subset of the rows,
...
@@ -38022,7 +38112,7 @@ to lock every row in the database, or any random subset of the rows,
without InnoDB running out of memory.
without InnoDB running out of memory.
In InnoDB all user activity happens inside transactions. If the
In InnoDB all user activity happens inside transactions. If the
auto
commit mode is used in MySQL, then each SQL statement
auto
-
commit mode is used in MySQL, then each SQL statement
will form a single transaction. If the auto commit mode is
will form a single transaction. If the auto commit mode is
switched off, then we can think that a user always has a transaction
switched off, then we can think that a user always has a transaction
open. If he issues
open. If he issues
...
@@ -38036,17 +38126,17 @@ on the other hand cancels all modifications made by the current
...
@@ -38036,17 +38126,17 @@ on the other hand cancels all modifications made by the current
transaction.
transaction.
@menu
@menu
* InnoDB consistent read:: Consistent
r
ead
* InnoDB consistent read:: Consistent
R
ead
* InnoDB locking reads:: Locking
r
eads
* InnoDB locking reads:: Locking
R
eads
* InnoDB Next-key locking:: Next-key
locking: avoiding the phantom p
roblem
* InnoDB Next-key locking:: Next-key
Locking: Avoiding the Phantom P
roblem
* InnoDB Locks set:: Locks
set by different SQL s
tatements in InnoDB
* InnoDB Locks set:: Locks
Set by Different SQL S
tatements in InnoDB
* InnoDB Deadlock detection:: Deadlock
detection and r
ollback
* InnoDB Deadlock detection:: Deadlock
Detection and R
ollback
* InnoDB Consistent read example:: An
example of how the consistent read w
orks in InnoDB
* InnoDB Consistent read example:: An
Example of How the Consistent Read W
orks in InnoDB
@end menu
@end menu
@node InnoDB consistent read, InnoDB locking reads, InnoDB transaction model, InnoDB transaction model
@node InnoDB consistent read, InnoDB locking reads, InnoDB transaction model, InnoDB transaction model
@subsubsection Consistent
r
ead
@subsubsection Consistent
R
ead
A consistent read means that InnoDB uses its multiversioning to
A consistent read means that InnoDB uses its multiversioning to
present to a query a snapshot of the database at a point in time.
present to a query a snapshot of the database at a point in time.
...
@@ -38072,7 +38162,7 @@ on the table.
...
@@ -38072,7 +38162,7 @@ on the table.
@node InnoDB locking reads, InnoDB Next-key locking, InnoDB consistent read, InnoDB transaction model
@node InnoDB locking reads, InnoDB Next-key locking, InnoDB consistent read, InnoDB transaction model
@subsubsection Locking
r
eads
@subsubsection Locking
R
eads
A consistent read is not convenient in some circumstances.
A consistent read is not convenient in some circumstances.
Suppose you want to add a new row into your table @code{CHILD},
Suppose you want to add a new row into your table @code{CHILD},
...
@@ -38130,7 +38220,7 @@ on the rows.
...
@@ -38130,7 +38220,7 @@ on the rows.
@node InnoDB Next-key locking, InnoDB Locks set, InnoDB locking reads, InnoDB transaction model
@node InnoDB Next-key locking, InnoDB Locks set, InnoDB locking reads, InnoDB transaction model
@subsubsection Next-key
locking: avoiding the phantom p
roblem
@subsubsection Next-key
Locking: Avoiding the Phantom P
roblem
In row level locking InnoDB uses an algorithm called next-key locking.
In row level locking InnoDB uses an algorithm called next-key locking.
InnoDB does the row level locking so that when it searches or
InnoDB does the row level locking so that when it searches or
...
@@ -38174,7 +38264,7 @@ after the last record in the index. Just that happens in the previous
...
@@ -38174,7 +38264,7 @@ after the last record in the index. Just that happens in the previous
example: the locks set by InnoDB will prevent any insert to
example: the locks set by InnoDB will prevent any insert to
the table where @code{ID} would be bigger than 100.
the table where @code{ID} would be bigger than 100.
You can use
the
next-key locking to implement a uniqueness
You can use next-key locking to implement a uniqueness
check in your application: if you read your data in share mode
check in your application: if you read your data in share mode
and do not see a duplicate for a row you are going to insert,
and do not see a duplicate for a row you are going to insert,
then you can safely insert your row and know that the next-key
then you can safely insert your row and know that the next-key
...
@@ -38183,9 +38273,8 @@ anyone meanwhile inserting a duplicate for your row. Thus the next-key
...
@@ -38183,9 +38273,8 @@ anyone meanwhile inserting a duplicate for your row. Thus the next-key
locking allows you to 'lock' the non-existence of something in your
locking allows you to 'lock' the non-existence of something in your
table.
table.
@node InnoDB Locks set, InnoDB Deadlock detection, InnoDB Next-key locking, InnoDB transaction model
@node InnoDB Locks set, InnoDB Deadlock detection, InnoDB Next-key locking, InnoDB transaction model
@subsubsection Locks
set by different SQL s
tatements in InnoDB
@subsubsection Locks
Set by Different SQL S
tatements in InnoDB
@itemize @bullet
@itemize @bullet
@item
@item
...
@@ -38226,6 +38315,12 @@ lock on every record the search encounters.
...
@@ -38226,6 +38315,12 @@ lock on every record the search encounters.
@code{DELETE FROM ... WHERE ...} : sets an exclusive next-key
@code{DELETE FROM ... WHERE ...} : sets an exclusive next-key
lock on every record the search encounters.
lock on every record the search encounters.
@item
@item
If a @code{FOREIGN KEY} constraint is defined on a table,
any insert, update, or delete which requires checking of the constraint
condition sets shared record level locks on the records it
looks at to check the constraint. Also in the case where the
constraint fails, InnoDB sets these locks.
@item
@code{LOCK TABLES ... } : sets table locks. In the implementation
@code{LOCK TABLES ... } : sets table locks. In the implementation
the MySQL layer of code sets these locks. The automatic deadlock detection
the MySQL layer of code sets these locks. The automatic deadlock detection
of InnoDB cannot detect deadlocks where such table locks are involved:
of InnoDB cannot detect deadlocks where such table locks are involved:
...
@@ -38238,7 +38333,7 @@ locks. But that does not put transaction integerity into danger.
...
@@ -38238,7 +38333,7 @@ locks. But that does not put transaction integerity into danger.
@node InnoDB Deadlock detection, InnoDB Consistent read example, InnoDB Locks set, InnoDB transaction model
@node InnoDB Deadlock detection, InnoDB Consistent read example, InnoDB Locks set, InnoDB transaction model
@subsubsection Deadlock
detection and r
ollback
@subsubsection Deadlock
Detection and R
ollback
InnoDB automatically detects a deadlock of transactions and rolls
InnoDB automatically detects a deadlock of transactions and rolls
back the transaction whose lock request was the last one to build
back the transaction whose lock request was the last one to build
...
@@ -38257,7 +38352,7 @@ stores row locks in a format where it cannot afterwards know which was
...
@@ -38257,7 +38352,7 @@ stores row locks in a format where it cannot afterwards know which was
set by which SQL statement.
set by which SQL statement.
@node InnoDB Consistent read example, , InnoDB Deadlock detection, InnoDB transaction model
@node InnoDB Consistent read example, , InnoDB Deadlock detection, InnoDB transaction model
@subsubsection An
example of how the consistent read w
orks in InnoDB
@subsubsection An
Example of How the Consistent Read W
orks in InnoDB
When you issue a consistent read, that is, an ordinary @code{SELECT}
When you issue a consistent read, that is, an ordinary @code{SELECT}
statement, InnoDB will give your transaction a timepoint according
statement, InnoDB will give your transaction a timepoint according
...
@@ -38289,9 +38384,9 @@ v SELECT * FROM t;
...
@@ -38289,9 +38384,9 @@ v SELECT * FROM t;
COMMIT;
COMMIT;
SELECT * FROM t;
SELECT * FROM t;
---------------------
-
---------------------
|
1 | 2
|
|
1 | 2
|
---------------------
-
---------------------
@end example
@end example
Thus user A sees the row inserted by B only when B has committed the
Thus user A sees the row inserted by B only when B has committed the
...
@@ -38306,7 +38401,7 @@ SELECT * FROM t LOCK IN SHARE MODE;
...
@@ -38306,7 +38401,7 @@ SELECT * FROM t LOCK IN SHARE MODE;
@end example
@end example
@subsection Performance
tuning t
ips
@subsection Performance
Tuning T
ips
@strong{1.}
@strong{1.}
If the Unix @file{top} or the Windows @file{Task Manager} shows that
If the Unix @file{top} or the Windows @file{Task Manager} shows that
...
@@ -38398,15 +38493,24 @@ This tip is of course valid for inserts into any table type, not just InnoDB.
...
@@ -38398,15 +38493,24 @@ This tip is of course valid for inserts into any table type, not just InnoDB.
Starting from version 3.23.41 InnoDB includes the InnoDB
Starting from version 3.23.41 InnoDB includes the InnoDB
Monitor which prints information on the InnoDB internal state.
Monitor which prints information on the InnoDB internal state.
When swithed on, InnoDB Monitor
When swithed on, InnoDB Monitor
will make the MySQL server to print data to the standard
will make the MySQL server @file{mysqld} to print data
output about once every 10 seconds. This data is useful in
(note: the MySQL client will not print anything)
to the standard
output about once every 15 seconds. This data is useful in
performance tuning.
performance tuning.
On Windows you must start @code{mysqld-max}
from a MS-DOS prompt
with the @code{--standalone --console}
options to direct the output to the MS-DOS prompt
window.
There is a separate @code{innodb_lock_monitor} which
prints the same information as @code{innodb_monitor}
plus information on locks set by each transaction.
The printed information includes data on:
The printed information includes data on:
@itemize @bullet
@itemize @bullet
@item
@item
table and record locks held by each active transaction,
@item
lock waits of a transactions,
lock waits of a transactions,
@item
@item
semaphore waits of threads,
semaphore waits of threads,
...
@@ -38519,8 +38623,8 @@ may have lock contention. The output can also help to
...
@@ -38519,8 +38623,8 @@ may have lock contention. The output can also help to
trace reasons for transaction deadlocks.
trace reasons for transaction deadlocks.
@item
@item
Section SYNC INFO will report reserved semaphores
Section SYNC INFO will report reserved semaphores
if you compile InnoDB with
<code>UNIV_SYNC_DEBUG</code>
if you compile InnoDB with
@code{UNIV_SYNC_DEBUG}
defined in
<tt>univ.i</tt>
.
defined in
@file{univ.i}
.
@item
@item
Section SYNC ARRAY INFO reports threads waiting
Section SYNC ARRAY INFO reports threads waiting
for a semaphore and statistics on how many times
for a semaphore and statistics on how many times
...
@@ -38542,7 +38646,7 @@ currently doing.
...
@@ -38542,7 +38646,7 @@ currently doing.
@end itemize
@end itemize
@node Implementation, Table and index, InnoDB transaction model, InnoDB
@node Implementation, Table and index, InnoDB transaction model, InnoDB
@subsection Implementation of
m
ultiversioning
@subsection Implementation of
M
ultiversioning
Since InnoDB is a multiversioned database, it must keep information
Since InnoDB is a multiversioned database, it must keep information
of old versions of rows in the tablespace. This information is stored
of old versions of rows in the tablespace. This information is stored
...
@@ -38573,7 +38677,9 @@ a snapshot that in a consistent read could need the information
...
@@ -38573,7 +38677,9 @@ a snapshot that in a consistent read could need the information
in the update undo log to build an earlier version of a database
in the update undo log to build an earlier version of a database
row.
row.
You must remember to commit your transactions regularly. Otherwise
You must remember to commit your transactions regularly,
also those transactions which only issue consistent reads.
Otherwise
InnoDB cannot discard data from the update undo logs, and the
InnoDB cannot discard data from the update undo logs, and the
rollback segment may grow too big, filling up your tablespace.
rollback segment may grow too big, filling up your tablespace.
...
@@ -38592,7 +38698,19 @@ time as the SQL statement which did the deletion.
...
@@ -38592,7 +38698,19 @@ time as the SQL statement which did the deletion.
@node Table and index, File space management, Implementation, InnoDB
@node Table and index, File space management, Implementation, InnoDB
@subsection Table and index structures
@subsection Table and Index Structures
MySQL stores its data dictionary information of tables
in @file{.frm}
files in database directories. But every InnoDB type table
also has its own entry in InnoDB internal data dictionaries
inside the tablespace. When MySQL drops a table or a database,
it has to delete both a @file{.frm} file or files, and
the corresponding entries inside the InnoDB data dictionary.
This is the reason why you cannot move InnoDB tables between
databases simply by moving the @file{.frm} files, and why
@code{DROP DATABASE} did not work for InnoDB type tables
in MySQL versions <= 3.23.43.
Every InnoDB table has a special index called the clustered index
Every InnoDB table has a special index called the clustered index
where the data of the rows is stored. If you define a
where the data of the rows is stored. If you define a
...
@@ -38620,15 +38738,15 @@ index. Note that if the primary key is long, the secondary indexes
...
@@ -38620,15 +38738,15 @@ index. Note that if the primary key is long, the secondary indexes
will use more space.
will use more space.
@menu
@menu
* InnoDB physical structure:: Physical
structure of an i
ndex
* InnoDB physical structure:: Physical
Structure of an I
ndex
* InnoDB Insert buffering:: Insert
b
uffering
* InnoDB Insert buffering:: Insert
B
uffering
* InnoDB Adaptive hash:: Adaptive
hash i
ndexes
* InnoDB Adaptive hash:: Adaptive
Hash I
ndexes
* InnoDB Physical record:: Physical
record s
tructure
* InnoDB Physical record:: Physical
Record S
tructure
@end menu
@end menu
@node InnoDB physical structure, InnoDB Insert buffering, Table and index, Table and index
@node InnoDB physical structure, InnoDB Insert buffering, Table and index, Table and index
@subsubsection Physical
structure of an i
ndex
@subsubsection Physical
Structure of an I
ndex
All indexes in InnoDB are B-trees where the index records are
All indexes in InnoDB are B-trees where the index records are
stored in the leaf pages of the tree. The default size of an index
stored in the leaf pages of the tree. The default size of an index
...
@@ -38644,7 +38762,7 @@ InnoDB will try to contract the index tree to free the page.
...
@@ -38644,7 +38762,7 @@ InnoDB will try to contract the index tree to free the page.
@node InnoDB Insert buffering, InnoDB Adaptive hash, InnoDB physical structure, Table and index
@node InnoDB Insert buffering, InnoDB Adaptive hash, InnoDB physical structure, Table and index
@subsubsection Insert
b
uffering
@subsubsection Insert
B
uffering
It is a common situation in a database application that the
It is a common situation in a database application that the
primary key is a unique identifier and new rows are inserted in the
primary key is a unique identifier and new rows are inserted in the
...
@@ -38672,7 +38790,7 @@ to a table up to 15 times.
...
@@ -38672,7 +38790,7 @@ to a table up to 15 times.
@node InnoDB Adaptive hash, InnoDB Physical record, InnoDB Insert buffering, Table and index
@node InnoDB Adaptive hash, InnoDB Physical record, InnoDB Insert buffering, Table and index
@subsubsection Adaptive
hash i
ndexes
@subsubsection Adaptive
Hash I
ndexes
If a database fits almost entirely in main memory, then the fastest way
If a database fits almost entirely in main memory, then the fastest way
to perform queries on it is to use hash indexes. InnoDB has an
to perform queries on it is to use hash indexes. InnoDB has an
...
@@ -38696,7 +38814,7 @@ databases.
...
@@ -38696,7 +38814,7 @@ databases.
@node InnoDB Physical record, , InnoDB Adaptive hash, Table and index
@node InnoDB Physical record, , InnoDB Adaptive hash, Table and index
@subsubsection Physical
record s
tructure
@subsubsection Physical
Record S
tructure
@itemize @bullet
@itemize @bullet
@item
@item
...
@@ -38719,7 +38837,7 @@ If the total length of the fields in a record is < 128 bytes, then
...
@@ -38719,7 +38837,7 @@ If the total length of the fields in a record is < 128 bytes, then
the pointer is 1 byte, else 2 bytes.
the pointer is 1 byte, else 2 bytes.
@end itemize
@end itemize
@subsubsection How an
auto-increment column w
orks in InnoDB
@subsubsection How an
Auto-increment Column W
orks in InnoDB
After a database startup, when a user first does an insert to a
After a database startup, when a user first does an insert to a
table @code{T}
table @code{T}
...
@@ -38728,16 +38846,16 @@ an explicit value for the column, then InnoDB executes @code{SELECT
...
@@ -38728,16 +38846,16 @@ an explicit value for the column, then InnoDB executes @code{SELECT
MAX(auto-inc-column) FROM T}, and assigns that value incremented
MAX(auto-inc-column) FROM T}, and assigns that value incremented
by one to the the column and the auto-increment counter of the table.
by one to the the column and the auto-increment counter of the table.
We say that
We say that
the auto-increment counter for table @code{T} has been initiali
s
ed.
the auto-increment counter for table @code{T} has been initiali
z
ed.
InnoDB follows the same procedure in initiali
s
ing the auto-increment counter
InnoDB follows the same procedure in initiali
z
ing the auto-increment counter
for a freshly created table.
for a freshly created table.
Note that if the user specifies in an insert the value 0 to the auto-increment
Note that if the user specifies in an insert the value 0 to the auto-increment
column, then InnoDB treats the row like the value would not have been
column, then InnoDB treats the row like the value would not have been
specified.
specified.
After the auto-increment counter has been initiali
s
ed, if a user inserts
After the auto-increment counter has been initiali
z
ed, if a user inserts
a row where he explicitly specifies the column value, and the value is bigger
a row where he explicitly specifies the column value, and the value is bigger
than the current counter value, then the counter is set to the specified
than the current counter value, then the counter is set to the specified
column value. If the user does not explicitly specify a value, then InnoDB
column value. If the user does not explicitly specify a value, then InnoDB
...
@@ -38754,12 +38872,12 @@ integer that can be stored in the specified integer type.
...
@@ -38754,12 +38872,12 @@ integer that can be stored in the specified integer type.
@node File space management, Error handling, Table and index, InnoDB
@node File space management, Error handling, Table and index, InnoDB
@subsection File
space management and d
isk i/o
@subsection File
Space Management and D
isk i/o
@menu
@menu
* InnoDB Disk i/o:: Disk i/o
* InnoDB Disk i/o:: Disk i/o
* InnoDB File space:: File
space m
anagement
* InnoDB File space:: File
Space M
anagement
* InnoDB File Defragmenting:: Defragmenting a
t
able
* InnoDB File Defragmenting:: Defragmenting a
T
able
@end menu
@end menu
...
@@ -38802,7 +38920,7 @@ file size in @code{innodb_data_file_path}. The partition must be
...
@@ -38802,7 +38920,7 @@ file size in @code{innodb_data_file_path}. The partition must be
1000 000 bytes.
1000 000 bytes.
@example
@example
innodb_data_file_path=hdd1:
3
Gnewraw;hdd2:2Gnewraw
innodb_data_file_path=hdd1:
5
Gnewraw;hdd2:2Gnewraw
@end example
@end example
When you start the database again you MUST change the keyword
When you start the database again you MUST change the keyword
...
@@ -38810,10 +38928,10 @@ to @code{raw}. Otherwise InnoDB will write over your
...
@@ -38810,10 +38928,10 @@ to @code{raw}. Otherwise InnoDB will write over your
partition!
partition!
@example
@example
innodb_data_file_path=hdd1:
3
Graw;hdd2:2Graw
innodb_data_file_path=hdd1:
5
Graw;hdd2:2Graw
@end example
@end example
Using a raw disk you can on some Unixes perform non-
buffered i/o.
By using a raw disk you can on some Unixes perform un
buffered i/o.
There are two read-ahead heuristics in InnoDB: sequential read-ahead
There are two read-ahead heuristics in InnoDB: sequential read-ahead
and random read-ahead. In sequential read-ahead InnoDB notices that
and random read-ahead. In sequential read-ahead InnoDB notices that
...
@@ -38826,7 +38944,7 @@ reads to the i/o system.
...
@@ -38826,7 +38944,7 @@ reads to the i/o system.
@node InnoDB File space, InnoDB File Defragmenting, InnoDB Disk i/o, File space management
@node InnoDB File space, InnoDB File Defragmenting, InnoDB Disk i/o, File space management
@subsubsection File
space m
anagement
@subsubsection File
Space M
anagement
The data files you define in the configuration file form the tablespace
The data files you define in the configuration file form the tablespace
of InnoDB. The files are simply catenated to form the tablespace,
of InnoDB. The files are simply catenated to form the tablespace,
...
@@ -38874,7 +38992,7 @@ consistent read.
...
@@ -38874,7 +38992,7 @@ consistent read.
@node InnoDB File Defragmenting, , InnoDB File space, File space management
@node InnoDB File Defragmenting, , InnoDB File space, File space management
@subsubsection Defragmenting a
t
able
@subsubsection Defragmenting a
T
able
If there are random insertions or deletions
If there are random insertions or deletions
in the indexes of a table, the indexes
in the indexes of a table, the indexes
...
@@ -38898,13 +39016,13 @@ not occur.
...
@@ -38898,13 +39016,13 @@ not occur.
@node Error handling, InnoDB restrictions, File space management, InnoDB
@node Error handling, InnoDB restrictions, File space management, InnoDB
@subsection Error
h
andling
@subsection Error
H
andling
The error handling in InnoDB is not always the same as
The error handling in InnoDB is not always the same as
specified in the ANSI SQL standards. According to the ANSI
specified in the ANSI SQL standards. According to the ANSI
standard, any error during an SQL statement should cause the
standard, any error during an SQL statement should cause the
rollback of that statement. InnoDB sometimes rolls back only
rollback of that statement. InnoDB sometimes rolls back only
part of the statement.
part of the statement
, or the whole transaction
.
The following list specifies the error handling of InnoDB.
The following list specifies the error handling of InnoDB.
@itemize @bullet
@itemize @bullet
...
@@ -38913,9 +39031,9 @@ If you run out of file space in the tablespace,
...
@@ -38913,9 +39031,9 @@ If you run out of file space in the tablespace,
you will get the MySQL @code{'Table is full'} error
you will get the MySQL @code{'Table is full'} error
and InnoDB rolls back the SQL statement.
and InnoDB rolls back the SQL statement.
@item
@item
A transaction deadlock or a timeout in a lock wait
will give
A transaction deadlock or a timeout in a lock wait
make InnoDB
@code{'Table handler error 1000000'} and InnoDB rolls
back
to roll
back
the
SQL statement
.
the
whole transaction
.
@item
@item
A duplicate key error only rolls back the insert of that particular row,
A duplicate key error only rolls back the insert of that particular row,
even in a statement like @code{INSERT INTO ... SELECT ...}.
even in a statement like @code{INSERT INTO ... SELECT ...}.
...
@@ -38931,7 +39049,7 @@ they roll back the corresponding SQL statement.
...
@@ -38931,7 +39049,7 @@ they roll back the corresponding SQL statement.
@node InnoDB restrictions, InnoDB contact information, Error handling, InnoDB
@node InnoDB restrictions, InnoDB contact information, Error handling, InnoDB
@subsection Restrictions on InnoDB
t
ables
@subsection Restrictions on InnoDB
T
ables
@itemize @bullet
@itemize @bullet
...
@@ -38947,7 +39065,7 @@ error:
...
@@ -38947,7 +39065,7 @@ error:
CREATE TABLE T (A CHAR(20), B INT, UNIQUE (A(5))) TYPE = InnoDB;
CREATE TABLE T (A CHAR(20), B INT, UNIQUE (A(5))) TYPE = InnoDB;
@end example
@end example
If you create a non
unique index on a prefix of a column, InnoDB will
If you create a non
-
unique index on a prefix of a column, InnoDB will
create an index over the whole column.
create an index over the whole column.
@item
@item
@code{INSERT DELAYED} is not supported for InnoDB tables.
@code{INSERT DELAYED} is not supported for InnoDB tables.
...
@@ -38971,23 +39089,19 @@ A table cannot contain more than 1000 columns.
...
@@ -38971,23 +39089,19 @@ A table cannot contain more than 1000 columns.
deletes all rows, one by one, which is not that fast. In future versions
deletes all rows, one by one, which is not that fast. In future versions
of MySQL you can use @code{TRUNCATE} which is fast.
of MySQL you can use @code{TRUNCATE} which is fast.
@item
@item
Before dropping a database with InnoDB tables one has to drop
the individual InnoDB tables first.
@item
The default database page size in InnoDB is 16 kB. By recompiling the
The default database page size in InnoDB is 16 kB. By recompiling the
code one can set it from 8 kB to 64 kB.
code one can set it from 8 kB to 64 kB.
The maximun row length is slightly less than half of a database page
The maximun row length is slightly less than half of a database page
in versions <= 3.23.40 of InnoDB. Starting from source
in versions <= 3.23.40 of InnoDB. Starting from source
release 3.23.41 BLOB and
release 3.23.41 BLOB and
TEXT columns are allowed to be < 4 GB, the total row length must also be
TEXT columns are allowed to be < 4 GB, the total row length must also be
< 4 GB. InnoDB does not store fields whose size is <=
30
bytes on separate
< 4 GB. InnoDB does not store fields whose size is <=
128
bytes on separate
pages. After InnoDB has modified the row by storing long fields on
pages. After InnoDB has modified the row by storing long fields on
separate pages, the remaining length of the row must be
slightly
less
separate pages, the remaining length of the row must be less
than half a database page.
than half a database page.
The maximun key length is 7000 bytes.
@item
@item
The maximum data or log file size is 2 GB or 4 GB depending on how large
On some operating systems data files must be < 2 GB. The combined
files your operating system supports. Support for > 4 GB files will
size of log files must be < 4 GB on 32-bit computers.
be added to InnoDB in a future version.
@item
@item
The maximum tablespace size is 4 billion database pages. This is also
The maximum tablespace size is 4 billion database pages. This is also
the maximum size for a table. The minimum tablespace size is 10 MB.
the maximum size for a table. The minimum tablespace size is 10 MB.
...
@@ -38995,7 +39109,7 @@ the maximum size for a table. The minimum tablespace size is 10 MB.
...
@@ -38995,7 +39109,7 @@ the maximum size for a table. The minimum tablespace size is 10 MB.
@node InnoDB contact information, , InnoDB restrictions, InnoDB
@node InnoDB contact information, , InnoDB restrictions, InnoDB
@subsection InnoDB
contact i
nformation
@subsection InnoDB
Contact I
nformation
Contact information of Innobase Oy, producer of the InnoDB engine.
Contact information of Innobase Oy, producer of the InnoDB engine.
Website: @uref{http://www.innodb.com}. Email:
Website: @uref{http://www.innodb.com}. Email:
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment