首先我们了解下Mysql的逻辑架构 连接层->服务层->引擎层->存储层
存储引擎分配查看Mysql支持的引擎
show ENGINE
engine | supper | Comment | Transactions | XA | Savepoints |
---|---|---|---|---|---|
InnoDB | DEFAULT | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
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 |
CSV | YES | CSV storage engine | NO | NO | NO |
ARCHIVE | YES | Archive storage engine | NO | NO | NO |
查看默认的存储引擎和当前的存储引擎
show variables like '%storage_engine%'
Variable_name | Value |
---|---|
default_storage_engine | InnoDB |
default_tmp_storage_engine | InnoDB |
disabled_storage_engines | |
internal_tmp_disk_storage_engine | InnoDB |
对比项 | MyISAM | InnoDB |
---|---|---|
主外键 | 不支持 | 支持 |
事务 | 不支持 | 支持 |
行表锁 | 表锁 | 行锁 |
缓存 | 只存储缓存,不存储真实数据 | 不仅存储缓存索引,还要存储缓存和真实数据,对内存要求比较高,而且内存大小能决定效率 |
表空间 | 小 | 大 |
关注点 | 性能 | 事务 |
因为InnoDB的行表锁和缓存的解决方案所以InnoDb适合高并发 *** 作
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)