14.2.5.2 Clustered and Secondary Indexes
14.2.5.2 Clustered and Secondary Indexes : 每个InnoDB 表 有一个特别的索引称为clustered index 行数据存储的地方。 典型的,clustered index是主键的同义词,得到最好的查询,插入性能,和其他数据库操作, 你必须了解InnoDB 使用clustered index 来优化最常见的查询和DML操作在每个表上。 当你定义一个PRIMARY KEY 在你的表上,InnoDB 使用它作为一个 clustered index. 定义一个主键对于每个表在你创建的时候。 如果没有逻辑的唯一和no-null列或者列的组合,增加一个自增列,它的值是自动填充的。 如果你没有定义一个主键为你的表,MySQL 定位第一个UNIQUE index ,所有的key 列是NOT NULL的 , InnoDB 使用它作为clustered index. mysql> show create table AssignClientManager\G;
*************************** 1. row ***************************
Table: AssignClientManager
Create Table: CREATE TABLE `AssignClientManager` (
`sn` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键(自增字段)',
`clientSn` int(11) NOT NULL COMMENT 'clientSn 映射',
`clientManagerSn` int(11) NOT NULL COMMENT 'clientManagerSn 映射',
`status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '分配的客户经理记录状态 1-生效,2-失效',
`createdTime` datetime NOT NULL COMMENT '创建时间',
`updatedTime` datetime DEFAULT NULL COMMENT '修改时间',
PRIMARY KEY (`sn`),
KEY `AssignClientManager_idx1` (`clientSn`)
) ENGINE=InnoDB AUTO_INCREMENT=4919 DEFAULT CHARSET=utf8 COMMENT='客户经理分配表'
1 row in set (0.00 sec) 如果表没有主键或者合适的 UNIQUE index,InnoDB 内部产生一个隐藏的clustered index在虚构的列 包含了row ID值。 记录是按ID 排序 InnoDB 分配给记录。 How the Clustered Index Speeds Up Queries :Clustered Index 如何加速查询; 通过clustered index 访问记录 是快速的 因为 Index 搜索直接指向所有的数据行。 如果表是大的,clustered index 结构通常会接收磁盘I/O 操作当与使用一个不同的Page 比较存储组织的时候 (比如,MyISAM 使用一个文件用于数据记录和其他的索引记录) How Secondary Indexes Relate to the Clustered Index Secondary Indexes和 Clustered Index的关系: 所有的索引除了clustered index 都被称为secondary indexes. 在InnoDB,每个记录在一个secondary index 包含 主键列 对于记录, 以及列指定的用于secondary index. InnoDB使用主键列值来搜索 clustered index.中的记录 如果主键列是长的, secondary indexes 会使用更多的空间,所以一个短的主键是有利的。
14.2.5.2 Clustered and Secondary Indexes的更多相关文章
- 14.8.9 Clustered and Secondary Indexes
14.8.9 Clustered and Secondary Indexes 每个InnoDB 表有一个特殊的索引称为 clustered index 用于存储数据. 通常, clustered in ...
- Clustered and Secondary Indexes
Clustered and Secondary Indexes secondary index A type of InnoDB index that represents a subset of t ...
- 在InnoDB,记录在 non-clustered indexes(也被称为secondary indexes) 包含了主键值
In InnoDB, the records in non-clustered indexes (also called secondary indexes) contain the primary ...
- Clustered和Nonclustered Indexes 各自得特点和区别及长短处
1 簇索引 簇索引对表的物理数据页中的数据按列进行排序然后再重新存储到磁盘上即簇索 引与数据是混为一体的它的叶节点中存储的是实际的数据由于簇索引对表中的数据一 一进行了排序因此用簇索引查找数据很快但由 ...
- 转 MYSQL InnoDB Record, Gap, and Next-Key Locks
http://dev.mysql.com/doc/refman/5.0/en/innodb-record-level-locks.html InnoDB has several types of re ...
- 转 mysql Next-Key Locking
原文:http://dev.mysql.com/doc/refman/5.5/en/innodb-next-key-locking.html 14.5.2.5 Avoiding the Phantom ...
- mysql 锁2
官网地址 https://dev.mysql.com/doc/refman/5.5/en/innodb-transaction-isolation-levels.html 这里主要是说事务隔离级别,以 ...
- innodb_locks_unsafe_for_binlog分析
mysql数据库中默认的隔离级别为repeat-read. innodb默认使用了next-gap算法,这种算法结合了index-row锁和gap锁.正因为这样的锁算法,innodb在可重复读这样的默 ...
- MySQL 5.6 Reference Manual-14.3 InnoDB Transaction Model and Locking
14.3 InnoDB Transaction Model and Locking 14.3.1 InnoDB Lock Modes 14.3.2 InnoDB Record, Gap, and Ne ...
随机推荐
- windows下各个浏览器用html5进行h.264大视频播放的性能对比说明
最近在调查windows下哪种浏览器进行大视频播放时候稳定性比较高. 举h.264的4g的视频为例. 选用的浏览器有ie10,firefox,chrome.(因为opera不支持h.264所以没有考虑 ...
- TCP三次握手和四次挥手具体解释
三次握手:建立TCP须要三次握手才干建立, 先Client端发送连接请求报文,Server段接受连接后回复ACK报文,并为这次连接分配资源.Client端接收到ACK报文后也向Server段发生ACK ...
- 解决win7 中source insight没有courier new字节的问题
解决win7 中source insight没有courier new字节的问题 http://blog.csdn.net/season_hangzhou/article/details/18665 ...
- 网页制作之html基础学习6-CSS浏览器兼容问题
初学html和css时,每天切图,总会遇到很多浏览器兼容性问题.最近一直关注移动平台开发,就html和css来说,不用考虑那么多浏览器兼容性问题.到现在,以至于很多浏览器兼容性几乎忘光了.今天把以前总 ...
- 运行复制的ZooKeeper 部署
运行复制的ZooKeeper 运行ZooKeeper 在一个独立模式下是方便评估的, 一些开发,和测试. 但是在生产,你应该运行ZooKeeper 在复制模式.一个复制的servers group 在 ...
- c++ 静态成员遇到的坑总结
新标签页http://74.55.154.136/ c++ 静态成员遇到的坑总结 - linuxfloat - 博客园 c++ 静态成员遇到的坑总结 1.对于类静态变量的初始化,用下面方法. // ...
- Python IDLE 运行错误:IDLE's subprocess didn't make connection. --已解决(原创)!
Python IDLE 错误描述: Subprocess Startup ErrorIDLE's subprocess didn't make connection. Either IDLE can' ...
- HDU 3790 最短路径问题 (SPFA)
转载请注明出处:http://blog.csdn.net/a1dark 分析:比一般最短路多了一个花费.多加一个判断即可.用的SPFA.这道题让我搞清楚了以前定义INF为啥爆的问题.受益颇多. #in ...
- ios上禁止输入表情
ios上禁止输入表情 + (BOOL)isContainsEmoji:(NSString *)string { __block BOOL isEomji = NO; [string enumerate ...
- Ch02 从零开始实例学习5
演练:添加模型 原文链接:http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/adding-a-model ...