CREATE TABLE
Syntax
1035
the column specification. MySQL accepts
REFERENCES
clauses only when
specified as part of a separate
FOREIGN KEY
specification.
• There is a hard limit of 4096 columns per table, but the effective maximum may be less for a given
table and depends on the factors discussed in
Section E.7.4, “Limits on Table Column Count and
Row Size”
.
Storage Engines
The
ENGINE
table option specifies the storage engine for the table.
TYPE
is a synonym, but
ENGINE
is
the preferred option name.
The
ENGINE
table option specifies the storage engine for the table, using one of the names shown in
the following table. The engine name can be unquoted or quoted. The quoted name
'DEFAULT'
is
equivalent to specifying the default storage engine name.
Storage Engine
Description
ARCHIVE
The archiving storage engine. See
Section 14.8, “The
ARCHIVE
Storage
Engine”
.
BDB
Transaction-safe tables with page locking. Also known as
BerkeleyDB
.
See
Section 14.5, “The
BDB
(
BerkeleyDB
) Storage Engine”
.
CSV
Tables that store rows in comma-separated values format. See
Section 14.9, “The
CSV
Storage Engine”
.
EXAMPLE
An example engine. See
Section 14.6, “The
EXAMPLE
Storage Engine”
.
FEDERATED
Storage engine that accesses remote tables. See
Section 14.7, “The
FEDERATED
Storage Engine”
.
HEAP
This is a synonym for
MEMORY
.
ISAM
(OBSOLETE)
Not available in MySQL 5.0. If you are upgrading to MySQL 5.0 from a
previous version, you should convert any existing
ISAM
tables to
MyISAM
before performing the upgrade.
InnoDB
Transaction-safe tables with row locking and foreign keys. See
Section 14.2, “The
InnoDB
Storage Engine”
.
MEMORY
The data for this storage engine is stored only in memory. See
Section 14.4, “The
MEMORY
(
HEAP
) Storage Engine”
.
MERGE
A collection of
MyISAM
tables used as one table. Also known as
MRG_MyISAM
. See
Section 14.3, “The
MERGE
Storage Engine”
.
MyISAM
The binary portable storage engine that is the default storage engine used
by MySQL. See
Section 14.1, “The
MyISAM
Storage Engine”
.
NDBCLUSTER
Clustered, fault-tolerant, memory-based tables. Also known as
NDB
. See
Chapter 17, MySQL Cluster
.
If a storage engine is specified that is not available, MySQL uses the default engine instead. Normally,
this is
MyISAM
. For example, if a table definition includes the
ENGINE=BDB
option but the MySQL
server does not support
BDB
tables, the table is created as a
MyISAM
table. This makes it possible to
have a replication setup where you have transactional tables on the master but tables created on the
slave are nontransactional (to get more speed). In MySQL 5.0, a warning occurs if the storage engine
specification is not honored.
Engine substitution can be controlled by the setting of the
NO_ENGINE_SUBSTITUTION
[537]
SQL
mode, as described in
Section 5.1.7, “Server SQL Modes”
.
Optimizing Performance
The other table options are used to optimize the behavior of the table. In most cases, you do not have
to specify any of them. These options apply to all storage engines unless otherwise indicated. Options
Summary of Contents for 5.0
Page 1: ...MySQL 5 0 Reference Manual ...
Page 18: ...xviii ...
Page 60: ...40 ...
Page 396: ...376 ...
Page 578: ...558 ...
Page 636: ...616 ...
Page 844: ...824 ...
Page 1234: ...1214 ...
Page 1427: ...MySQL Proxy Scripting 1407 ...
Page 1734: ...1714 ...
Page 1752: ...1732 ...
Page 1783: ...Configuring Connector ODBC 1763 ...
Page 1793: ...Connector ODBC Examples 1773 ...
Page 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Page 2850: ...2830 ...
Page 2854: ...2834 ...
Page 2928: ...2908 ...
Page 3000: ...2980 ...
Page 3122: ...3102 ...
Page 3126: ...3106 ...
Page 3174: ...3154 ...
Page 3232: ...3212 ...