扫码下面二维码关注公众号并回复100003获取下载资源
本书目录结构如下:
第1章 mysql体系结构和存储引擎.......................1
1.1 定义数据库和实例..............................1
1.2 mysql体系结构.................................3
1.3 mysql存储引擎.................................5
1.3.1 InnoDB存储引擎........................6
1.3.2 MyISAM存储引擎........................7
1.3.3 NDB存储引擎...........................7
1.3.4 Memory存储引擎........................8
1.3.5 Archive存储引擎.......................9
1.3.6 Federated.............................9
1.3.7 Maria存储引擎.........................9
1.3.8 其他存储引擎..........................9
1.4 各存储引擎之间的比较..........................10
1.5 连接MySQL.....................................13
1.5.1 TCP/IP................................13
1.5.2 命名管道和共享内存....................15
1.5.3 UNIX域套接字..........................15
1.6 小结..........................................15
第2章 InnoDB存储引擎................................17
2.1 InnoDB存储引擎概述............................17
2.2 InnoDB存储引擎的版本..........................18
2.3 InnoDB体系结构................................19
2.3.1 后台线程..............................19
2.3.2 内存..................................22
2.4 Chekpoint技术.................................32
2.5 Master Thread工作方式.........................36
2.5.1 InnoDB1.0.x版本之前的Master Thread....36
2.5.2 InnoDB1.2.x版本之前的Master Thread....41
2.5.3 InnoDB1.2.x版本的Master Thread........45
2.6 InnoDB关键特性................................45
2.6.1 插入缓冲..............................46
2.6.2 两次写................................53
2.6.3 自适应哈希索引........................55
2.6.4 异步IO................................57
2.6.5 刷新邻接页............................58
2.7 启动关闭与恢复................................58
2.8 小结..........................................61
第3章 文件
3.1 参数文件......................................62
3.1.1 什么是参数............................63
3.1.2 参数类型..............................64
3.2 日志文件......................................65
3.2.1 错误日志..............................66
3.2.2 慢查询日志............................67
3.2.3 查询日志..............................72
3.2.4 二进制日志............................73
3.3 套接字文件....................................83
3.4 pid文件.......................................83
3.5 表结构定义文件................................84
3.6 InnoDB存储引擎文件............................84
3.6.1 表空间文件............................85
3.6.2 重做日志文件..........................86
3.7 小结..........................................90
第4章 表............................................91
4.1 索引组织表....................................91
4.2 InnoDB逻辑存储结构............................93
4.2.1 表空间................................93
4.2.2 段....................................95
4.2.3 区....................................95
4.2.4 页....................................101
4.2.5 行....................................101
4.3 InnoDB行记录格式..............................102
4.3.1 Compact行记录格式.....................103
4.3.2 Redundant行记录格式...................106
4.3.3 行溢出数据............................110
4.3.4 Compressed和Dynamic行记录格式.........117
4.3.5 CHAR的行结构存储......................117
4.4 InnoDB数据页结构..............................120
4.4.1 File Header...........................121
4.4.2 Page Header...........................122
4.4.3 Infimum和Supremum Records.............123
4.4.4 User Records和Free Records............123
4.4.5 Page Directory........................124
4.4.6 File Trailer..........................124
4.4.7 InnoDB数据页结构示例分析..............125
4.5 Named File Formats机制........................132
4.6 约束..........................................134
4.6.1 数据完整性............................134
4.6.2 约束的创建和查找......................135
4.6.3 约束和索引的区别......................137
4.6.4 对错误数据的约束......................137
4.6.5 ENUM和SET约束.........................139
4.6.6 触发器与约束..........................139
4.6.7 外键约束..............................142
4.7 视图..........................................144
4.7.1 视图的作用............................144
4.7.2 物化视图..............................147
4.8 分区表........................................152
4.8.1 分区概述..............................152
4.8.2 分区类型..............................155
4.8.3 子分区................................168
4.8.4 分区中的NULL值........................172
4.8.5 分区和性能............................176
4.8.6 在表和分区间交换数据..................180
4.9 小结..........................................182
第5章 索引和算法....................................183
5.1 InnoDB存储引擎索引概述........................183
5.2 数据结构与算法................................184
5.2.1 二分查找法............................184
5.2.2 二叉查找树和平衡二叉树................185
5.3 B+树..........................................187
5.3.1 B+树的插入操作........................187
5.3.2 B+树的删除操作........................190
5.4 B+树索引......................................191
5.4.1 聚集索引..............................192
5.4.2 辅助索引..............................196
5.4.3 B+树索引的分裂........................200
5.4.4 B+树索引的管理........................202
5.5 Cardinality值.................................210
5.5.1 什么是Cardinality.....................210
5.5.2 InnoDB存储引擎的Cardinality统计.......212
5.6 B+树索引的使用................................215
5.6.1 不同应用中B+树索引的使用..............215
5.6.2 联合索引..............................215
5.6.3 覆盖索引..............................218
5.6.4 优化器选择不使用索引的情况............219
5.6.5 索引提示..............................221
5.6.6 Multi-Range Read优化..................223
5.6.7 Index Condition Pushdown(ICP)优化.....226
5.7 哈希算法......................................227
5.7.1 哈希表................................228
5.7.2 InnoDB存储引擎中的哈希算法............229
5.7.3 自适应哈希索引........................230
5.8 全文索引......................................231
5.8.1 概述..................................231
5.8.2 倒排索引..............................232
5.8.3 InnoDB全文索引........................233
5.8.4 全文索引..............................240
5.9 小结..........................................248
第6章 锁............................................249
6.1 什么是锁......................................249
6.2 lock与latch...................................250
6.3 InnoDB存储引擎中的锁..........................252
6.3.1 锁的类型..............................252
6.3.2 一致性非锁定读........................258
6.3.3 一致性锁定读..........................261
6.3.4 自增长与锁............................262
6.3.5 外键和锁..............................264
6.4 锁的算法......................................265
6.4.1 行锁的3种算法.........................265
6.4.2 解决Phantom Problem...................269
6.5 锁问题........................................271
6.5.1 脏读..................................271
6.5.2 不可重复读............................273
6.5.3 丢失更新..............................274
6.6 阻塞..........................................276
6.7 死锁..........................................278
6.7.1 死锁的概念............................278
6.7.2 死锁概率..............................280
6.7.3 死锁的示例............................281
6.8 锁升级........................................283
6.9 小结..........................................284
第7章 事务..........................................285
7.1 认识事务......................................285
7.1.1 概述..................................285
7.1.2 分类..................................287
7.2 事务的实现....................................294
7.2.1 redo..................................294
7.2.2 undo..................................305
7.2.3 purge.................................317
7.2.4 group commit..........................319
7.3 事务控制语句..................................323
7.4 隐式提交的sql语句.............................328
7.5 对于事务操作的的统计..........................329
7.6 事务的隔离级别................................330
7.7 分布式事务....................................335
7.7.1 mysql数据库分布式事务.................335
7.7.2 内部XA事务............................340
7.8 不好的事务习惯................................341
7.8.1 在循环中提交..........................341
7.8.2 使用自动提交..........................343
7.8.3 使用自动回滚..........................344
7.9 长事务........................................347
7.10 小结......................................349
第8章 备份与恢复....................................350
8.1 备份与恢复概述................................350
8.2 冷备..........................................352
8.3 逻辑备份......................................353
8.3.1 mysqldump.............................353
8.3.2 SELECT...INTO OUTFILE.................360
8.3.3 逻辑备份与恢复........................362
8.3.4 LOAD DATA INFILE......................362
8.3.5 mysqllimport..........................364
8.4 二进制日志备份与恢复..........................366
8.5 热备..........................................367
8.5.1 ibbackup..............................367
8.5.2 XtraBackup............................368
8.5.3 XtraBackup实现增量备份................370
8.6 快照备份......................................372
8.7 复制..........................................376
8.7.1 复制的工作原理........................376
8.7.2 快照+复制的备份架构...................380
8.8 小结..........................................382
第9章 性能调优......................................383
9.1 选择合适的CPU.................................383
9.2 内存的重要性..................................384
9.3 硬盘对数据库性能的影响........................387
9.3.1 传统机械硬盘..........................387
9.3.2 固态硬盘..............................387
9.4 合理的设置RAID................................389
9.4.1 RAID类型..............................389
9.4.2 RAID Write Back功能...................392
9.4.3 RAID配置工具..........................394
9.5 操作系统的选择................................397
9.6 不同的文件系统对数据库性能的影响..............398
9.7 选择合适的基准测试工具........................399
9.7.1 sysbench..............................399
9.7.2 mysql-tpcc............................405
9.8 小结..........................................410
第10章 InnoDB存储引擎源代码的编译和调试..............411
10.1 获取InnoDB存储引擎源代码..................411
10.2 InnoDB源代码结构..........................413
10.3 MYSQL5.1版本编译和调试InnoDB源代码........415
10.3.1 windows下的调试.......................415
10.3.2 limux下的调试.........................418
10.4 cmake方式编译和调试InnoDB存储引擎.........423
10.5 小结......................................424