How to find the type of storage engine a MySQL tables uses
What type of storage engine a MySQL tables uses?
MySQL supports several storage engines such as InnoDB, MyISAM, BLACKHOLE, CSV. Depending on your use case, you might configure your MySQL table to use certain storage engine. To see the list of storage engines MySQL supports, simply run “SHOW ENGINES\G” under a mysql prompt.
To find out the particular storage engine used by a table, run the ‘show table status’ command for the named table as below. The first example is the mysql user table, which uses InnoDB –
mysql> use mysql; mysql> show table status like 'user' \G *************************** 1. row *************************** Name: user Engine: InnoDB Version: 10 Row_format: Compact Rows: 1 Avg_row_length: 16384 Data_length: 16384 Max_data_length: 0 Index_length: 49152 Data_free: 10485760 Auto_increment: 2 Create_time: 2013-08-26 22:52:09 Update_time: NULL Check_time: NULL Collation: binary Checksum: NULL Create_options: Comment: 1 row in set (0.00 sec)
A sample table which uses MyISAM storage engine –
mysql> show table status like 'servers' \G *************************** 1. row *************************** Name: servers Engine: MyISAM Version: 10 Row_format: Fixed Rows: 0 Avg_row_length: 0 Data_length: 0 Max_data_length: 433752939111120895 Index_length: 1024 Data_free: 0 Auto_increment: NULL Create_time: 2013-08-24 01:42:15 Update_time: 2013-08-24 01:42:15 Check_time: NULL Collation: utf8_general_ci Checksum: NULL Create_options: Comment: MySQL Foreign Servers table 1 row in set (0.00 sec)
A table for logging slow queries is stored in a CSV storage engine –
mysql> show table status like 'slow_log' \G *************************** 1. row *************************** Name: slow_log Engine: CSV Version: 10 Row_format: Dynamic Rows: 2 Avg_row_length: 0 Data_length: 0 Max_data_length: 0 Index_length: 0 Data_free: 0 Auto_increment: NULL Create_time: NULL Update_time: NULL Check_time: NULL Collation: utf8_general_ci Checksum: NULL Create_options: Comment: Slow log 1 row in set (0.00 sec)
Features of some of the storage engines –
InnoDB
: is a transaction-safe (ACID compliant) storage engine for MySQL that has commit, rollback, and crash-recovery capabilities to protect user data.MyISAM
: These tables have a small footprint. Table-level locking limits the performance in read/write workloads, so it is often used in read-only or read-mostly workloads in Web and data warehousing configurations.Memory
: Stores all data in RAM, for fast access in environments that require quick lookups of non-critical data.CSV
: Its tables are really text files with comma-separated values. CSV tables let you import or dump data in CSV format, to exchange data with scripts and applications that read and write that same format.Archive
: These compact, unindexed tables are intended for storing and retrieving large amounts of seldom-referenced historical, archived, or security audit information.Blackhole
: The Blackhole storage engine accepts but does not store data, similar to the Unix/dev/null
device. Queries always return an empty set.
References –
https://dev.mysql.com/doc/refman/8.0/en/storage-engines.html