存储引擎
1、簡介
相當于Linux文件系統,只不過比文件系統功能強大
2、功能了解
數據讀寫
數據安全和一致性(在宕機情況下也會保證數據不丟失)
提高性能
熱備份
自動故障恢復
高可能方面支持
3、存儲引擎種類介紹
查看數據庫支持的引擎:show engines;
查看當前默認的引擎: select @@delfault_storage_engine;
查看表所使用的引擎: show create table test;
show table status like 'test'G;
select table_name,engine from information_schema.tables where table_name='test';
Innodb存儲引擎核心特性
1、修改存儲引擎,該命令也可整理碎片
alter table tablename engine=innodb;
2、批量修改存儲引擎
selectconcat("alter table ",table_schema,".",table_name," engine='tokudb' ")from information_schema.tables where table_schema='stu';
文件存儲
------------------------------------------------------------------------------
ibdata1: 存儲undo,表統計信息(元數據)
ibtmp1: 臨時表,在做join union操作產生臨時數據,用完就自動清理
redo log: ib_logfile0 iblogfile1 重做日志
undo log: ibdata1 ibdata2(存儲在共享表空間中),回滾日志
------------------------------------------------------------------------------
Innodb
ibd 數據行,索引
frm 表結構、列屬性
ibdata1 存儲undo和表統計信息(元數據)
最終結論:
一張Innodb表 = frm + ibd + ibdata1
------------------------------------------------------------------------------
mysiam
myisam引擎文件
frm 存表結構的,列的屬性
myd 數據行
myi 索引
------------------------------------------------------------------------------
總結
- 上一篇: 子序列问题
- 下一篇: 如何删除最近的搜索怎么删除最近搜索记录