Storage Engines
MySQL® for Developers | © MySQL AB 2009
Storage Engines
MySQL
Database Management Level
Storage engines are MySQL
Parse Optimize
Retrieve components that handle the SQL
Store
MySQL Server uses a pluggable
storage engine architecture that
Pluggable Storage Engines
enables storage engines to be
loaded into and unloaded from a
MyISAM InnoDB MySQL Memory Other ... running MySQL server.
Cluster
Storage Engines 20.2 SQL Parser and Storage Engines
558
MySQL® for Developers | © MySQL AB 2009
Storage Engines and MySQL
• Can choose specific storage engine when creating a table
• Best fit for your application
• Each have different characteristics and implications
Storage Engines 20.3 Storage Engines and MySQL
562
MySQL® for Developers | © MySQL AB 2009
Setting the Storage Engine
• Specify engine using CREATE TABLE
- MySQL uses system default engine if not specified
• Change engine for existing table with
ALTER TABLE
• Examples
CREATE TABLE t (i INT) ENGINE = InnoDB;
ALTER TABLE t ENGINE = InnoDB;
Storage Engines 20.3 Storage Engines and MySQL
MYISAM
Advantages:
• Storage up to 256 TB (Useful in archiving)
• Fast
• Support Full Text Search (Useful for Articles if table is not related to any other table)
• High Performance
Disadvantages:
• No caching for data
• No support for Foreign Key
• No support for Relational Database
• No Transactions for related tables
InnoDB
Advantages:
• Accept Foreign Key
• Support Full Text Search (starting from5.6.4)
• Accept updates in transactions between related tables
• Accept Cash
• Default Engine
Disadvantages:
• Storage 64 TB
561
MySQL® for Developers | © MySQL AB 2009
Storage Engines Available on Server
• View available storage engines…
SHOW ENGINES\G
************************ 1. row ***************************
Engine: MyISAM
Support: DEFAULT
Comment: Default engine as of MySQL 3.23 with great
performance
************************* 2. row ***************************
Engine: InnoDB
Support: YES
Comment: Supports transactions, row-level locking, foreign
keys
Storage Engines 20.3 Storage Engines and MySQL