mysql的索引按照页来存储, 目前大多数操作系统,一个页的大小为16KB。
拿主键索引树举例,
如果主键为int
占4个字节, 一个指针(64位系统)占8个字节, 则根结点可存储16KB/(4+8) 约等于1300, 此时分叉数约为1300
当树高为3时, 可存储数据条数 1300^3 =2197000000
如果主键为bigint
占8个字节, 一个指针(64位系统)占8个字节, 则根结点可存储16KB/(8+8) 约等于1000, 此时分叉数约为1000
当树高为3时, 可存储数据条数 1000^3 =1000000000 ,即为10亿条
所以可以看出, 通常innodb 遍历索引树,最多遍历2~3层索引树,即可得到结果。
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
Quick Start
Create a new post
1 | $ hexo new "My New Post" |
More info: Writing
Run server
1 | $ hexo server |
More info: Server
Generate static files
1 | $ hexo generate |
More info: Generating
Deploy to remote sites
1 | $ hexo deploy |
More info: Deployment