mysql存储引擎

Posted jabbok

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql存储引擎相关的知识,希望对你有一定的参考价值。

查看当前支持的引擎

mariadb> show engines;
+--------------------+---------+----------------------------------------------------------------------------+--------------+-----+------------+
| Engine             | Support | Comment                                                                    | Transactions | XA  | Savepoints |
+--------------------+---------+----------------------------------------------------------------------------+--------------+-----+------------+
| CSV                | YES     | CSV storage engine                                                         | NO           | NO  | NO         |
| MRG_MYISAM         | YES     | Collection of identical MyISAM tables                                      | NO           | NO  | NO         |
| MEMORY             | YES     | Hash based, stored in memory, useful for temporary tables                  | NO           | NO  | NO         |
| BLACKHOLE          | YES     | /dev/null storage engine (anything you write to it disappears)             | NO           | NO  | NO         |
| MyISAM             | YES     | MyISAM storage engine                                                      | NO           | NO  | NO         |
| InnoDB             | DEFAULT | Percona-XtraDB, Supports transactions, row-level locking, and foreign keys | YES          | YES | YES        |
| ARCHIVE            | YES     | Archive storage engine                                                     | NO           | NO  | NO         |
| FEDERATED          | YES     | FederatedX pluggable storage engine                                        | YES          | NO  | YES        |
| PERFORMANCE_SCHEMA | YES     | Performance Schema                                                         | NO           | NO  | NO         |
| Aria               | YES     | Crash-safe tables with MyISAM heritage                                     | NO           | NO  | NO         |
+--------------------+---------+----------------------------------------------------------------------------+--------------+-----+------------+
10 rows in set
#最常用的是innodb和MyISAM
#可见,默认引擎是innodb

  

查看表引擎

引擎是表级别的,在创建表的时候,可以设定engine=innodb或者其他引擎。如果不设定,就按服务的默认引擎来。

mariadb> show create table history;
+---------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table   | Create Table                                                                                                                                                                                                                                                         |
+---------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| history | CREATE TABLE `history` (
  `itemid` bigint(20) unsigned NOT NULL,
  `clock` int(11) NOT NULL DEFAULT ‘0‘,
  `value` double(16,4) NOT NULL DEFAULT ‘0.0000‘,
  `ns` int(11) NOT NULL DEFAULT ‘0‘,
  KEY `history_1` (`itemid`,`clock`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
+---------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set

  

 

以上是关于mysql存储引擎的主要内容,如果未能解决你的问题,请参考以下文章

使用Merge存储引擎实现MySQL分表

使用Merge存储引擎实现MySQL分表

MySQL中innodb引擎分析(初始化)

MySQL视图存储过程与存储引擎

(转)Mysql存储引擎__笔记

查看和修改MySQL数据库表存储引擎