MySQL Table Types

Table of Contents

106. MyISAM Tables
Space Needed for Keys
MyISAM Table Formats
Static (Fixed-length) Table Characteristics
Dynamic Table Characteristics
Compressed Table Characteristics
MyISAM Table Problems
Corrupted MyISAM Tables
Clients is using or hasn't closed the table properly
107. MERGE Tables
MERGE Table Problems
108. HEAP Tables
109. InnoDB Tables
InnoDB Tables Overview
InnoDB in MySQL Version 3.23
InnoDB Startup Options
Creating InnoDB Tablespace
If Something Goes Wrong in Database Creation
Creating InnoDB Tables
Converting MyISAM Tables to InnoDB
FOREIGN KEY Constraints
Multiple tablespaces - putting each table into its own .ibd file
Adding and Removing InnoDB Data and Log Files
Backing up and Recovering an InnoDB Database
Forcing recovery
Checkpoints
Moving an InnoDB Database to Another Machine
InnoDB Transaction Model and Locking
InnoDB and SET ... TRANSACTION ISOLATION LEVEL ...
Consistent Non-Locking Read
Locking Reads SELECT ... FOR UPDATE and SELECT ... LOCK IN SHARE MODE
Next-key Locking: Avoiding the Phantom Problem
Locks Set by Different SQL Statements in InnoDB
Deadlock Detection and Rollback
An Example of How the Consistent Read Works in InnoDB
How to Cope With Deadlocks
Performance Tuning Tips
SHOW INNODB STATUS and the InnoDB Monitors
Implementation of Multi-versioning
Table and Index Structures
Physical Structure of an Index
Insert Buffering
Adaptive Hash Indexes
Physical Record Structure
How an AUTO_INCREMENT Column Works in InnoDB
File Space Management and Disk I/O
Disk I/O
File Space Management
Defragmenting a Table
Error Handling in MySQL
Restrictions on InnoDB Tables
InnoDB Change History
MySQL/InnoDB-5.0.0, December 24, 2003
MySQL/InnoDB-4.0.17, December 17, 2003
MySQL/InnoDB-4.1.1, December 4, 2003
MySQL/InnoDB-4.0.16, October 22, 2003
MySQL/InnoDB-3.23.58, September 15, 2003
MySQL/InnoDB-4.0.15, September 10, 2003
MySQL/InnoDB-4.0.14, July 22, 2003
MySQL/InnoDB-3.23.57, June 20, 2003
MySQL/InnoDB-4.0.13, May 20, 2003
MySQL/InnoDB-4.1.0, April 3, 2003
MySQL/InnoDB-3.23.56, March 17, 2003
MySQL/InnoDB-4.0.12, March 18, 2003
MySQL/InnoDB-4.0.11, February 25, 2003
MySQL/InnoDB-4.0.10, February 4, 2003
MySQL/InnoDB-3.23.55, January 24, 2003
MySQL/InnoDB-4.0.9, January 14, 2003
MySQL/InnoDB-4.0.8, January 7, 2003
MySQL/InnoDB-4.0.7, December 26, 2002
MySQL/InnoDB-4.0.6, December 19, 2002
MySQL/InnoDB-3.23.54, December 12, 2002
MySQL/InnoDB-4.0.5, November 18, 2002
MySQL/InnoDB-3.23.53, October 9, 2002
MySQL/InnoDB-4.0.4, October 2, 2002
MySQL/InnoDB-4.0.3, August 28, 2002
MySQL/InnoDB-3.23.52, August 16, 2002
MySQL/InnoDB-4.0.2, July 10, 2002
MySQL/InnoDB-3.23.51, June 12, 2002
MySQL/InnoDB-3.23.50, April 23, 2002
MySQL/InnoDB-3.23.49, February 17, 2002
MySQL/InnoDB-3.23.48, February 9, 2002
MySQL/InnoDB-3.23.47, December 28, 2001
MySQL/InnoDB-4.0.1, December 23, 2001
MySQL/InnoDB-3.23.46, November 30, 2001
MySQL/InnoDB-3.23.45, November 23, 2001
MySQL/InnoDB-3.23.44, November 2, 2001
MySQL/InnoDB-3.23.43, October 4, 2001
MySQL/InnoDB-3.23.42, September 9, 2001
MySQL/InnoDB-3.23.41, August 13, 2001
MySQL/InnoDB-3.23.40, July 16, 2001
MySQL/InnoDB-3.23.39, June 13, 2001
MySQL/InnoDB-3.23.38, May 12, 2001
InnoDB Contact Information
111. BDB or BerkeleyDB Tables
Overview of BDB Tables
Installing BDB
BDB Startup Options
Characteristics of BDB Tables
Things We Need to Fix for BDB in the Near Future
Operating Systems Supported by BDB
Restrictions on BDB Tables
Errors That May Occur When Using BDB Tables
112. ISAM Tables

As of MySQL Version 3.23.6, you can choose between three basic table formats (ISAM, HEAP and MyISAM). Newer versions of MySQL support additional table types (InnoDB, or BDB), depending on how you compile it. A database may contain tables of different types.

When you create a new table, you can tell MySQL what type of table to create. The default table type is usually MyISAM.

MySQL will always create a .frm file to hold the table and column definitions. The table's index and data will be stored in one or more other files, depending on the table type.

If you try to use a table type that is not compiled-in or activated, MySQL will instead create a table of type MyISAM. This behavior is convenient when you want to copy tables between MySQL servers that support different table types. (Perhaps your master server supports transactional storage engines for increased safety, while the slave servers use only non-transactional storage engines for greater speed.)

This automatic change of table types can be confusing for new MySQL users. We plan to fix this by introducing warnings in the new client/server protocol in version 4.1 and generating a warning when a table type is automatically changed.

You can convert tables between different types with the ALTER TABLE statement. See ALTER TABLE.

Note that MySQL supports two different kinds of tables: transaction-safe tables (InnoDB and BDB) and not transaction-safe tables (HEAP, ISAM, MERGE, and MyISAM).

Advantages of transaction-safe tables (TST):

Note that to use InnoDB tables you have to use at least the innodb_data_file_path startup option. See InnoDB start.

Advantages of not transaction-safe tables (NTST):

You can combine TST and NTST tables in the same statements to get the best of both worlds.