Mysql 文件结构 & innodb体系结构
2021-01-23 15:56:42 0 举报
登录查看完整内容
Mysql Innodb 文件及体系结构
作者其他创作
大纲/内容
MYSQL
管理连接,权限验证
Sys
物理系统<Mini-transaction>
general.log
分析器
查询缓存
t2.frm
Handle API<MySQL Server>
存储引擎
Mysql
簇extent
performance_schema
操作系统最小的单元是块<block>最小的单位是:4k
B树
页面1page
物理锁
执行计划生成,索引选择
ibdata
优化器
存储数据,提供读写接口
存储系统信息:表名、列名、列属性等
页面64page
表
Log file1
slow.log慢查询
所有的存储都是有最小的存储单元:在磁盘上最小的单元是扇区
数据字典
t1.ibd表数据
一个扇区:512字节(0.5k)
首先我们知道,在逻辑处理和磁盘文件之间,都是有一层缓存的,这里主要是日志缓冲区和innodb_buffer_pool。和其他大家常用的kafka、elasticsearch、rocksDB等等一样,要保持性能,必然都遵循相同或类似的规则,那就是写pageCache、顺序写磁盘,这是决定任何一个带存储功能的性能的关键点。请务必记着innodb_buffer_pool,未来能对性能起决定性作用的一个重要因子。要明白,任何时候,决定读写速度的都是内存,只要你要读的数据在内存里,它就比在磁盘上快。redis就是靠内存,mysql的数据缓存,就取决于innodb_buffer_pool。缓冲层提供了高效的读写性能,再下面就是物理文件层了,是落到磁盘上的。磁盘上重要的地方有REDO日志,和表数据(页)
Log file2
innodb_file_per_table :设置多个表公用一个数据文件
客户端
innodb_file_per_table=0Data segment 表数据存储空间
决定了b+tree在某个高度下,能存放的数据量 2w 和1500w 查询速度是一样
t1.frm表结构
Insert buffer
My.confmysql 配置
操作引擎,返回结果
事务系统<MVCC>
Table1.ibd
userdb
Mysql 文件结构
Table2.ibd
执行器
连接器
命中则直接返回结果
每个访问都会产生事务,事务处理会产生锁(表锁、行锁),操作对象是表、索引、b+ tree。对数据页面的访问需要物理事务,为了读写一致性,需要读写锁(物理锁)。为了高效定位和管理“页”,需要用到文件管理系统
Table3.ibd
叶子段segment
默认的日志文件
error.log记录错误和警告
information_schema
data
索引index
事务锁系统
索引
t3.frm
词法分析,语法分析
Mysql Innodb体系结构
Double Write Buffer
内节点段segment
ib_logfile1
记录所有在数据库上执行的语句,可以用来追踪问题,文件增长很快,也很大,一般不会打开,偶尔要调试时可以打开。
Handler API是供mysql server层调用的,server层定义了一些接口,譬如insert、delete,具体怎么实现,是由每个存储引擎自己实现的
数据页面及日志刷盘 文件数据页面载入
InnoDb最小存储单元是页<page>:16k
mysql的一些配置信息,如编码、排序的信息
Rollback Segment
ib_logfile0
文件管理系统
Server层
Innodb API<XXXX>
db.opt
0 条评论
回复 删除
下一页