Mysql 深入优化
dba&qa
Mysql
深入优化
本文档部分基于
jay pipes
jay pipes
jay pipes
jay pipes
的演讲稿:
Performance coding for mysql
Performance coding for mysql
Performance coding for mysql
Performance coding for mysql
mysql
mysql
mysql
mysql
的系统架构
的系统架构
的系统架构
的系统架构
•
高度耦合的子系统
•
基于链接的内存分配
(相对于全局内存模块)
•
各种等级的
cache
•
基于代价的优化器
•
模块化的存储引擎
schema
设计的基本原则
•
关系应用性能的基础构件
•
先设计基本系统,在设计特殊系统
•
尽可能的小(表,字段,数据类型)
--abc
原则
•
分而治之
•
清楚各种存储引擎的优缺点
基础搞不好,建不起高楼
the more records you can fit into a page in memory /disk
the faster performance you can do
•
是不是真的需要一个
bigint
的类型的主键?
innodb
引擎主键越小越好
•
使用
int unsigned not null
来处理
ip
地址
•
谨慎的使用
varchar
数据类型
myisam
用
char
innodb
用
varchar
临时表用
char
代替
varchar
•
尽量少的使用
text
类型
如果有必要,还是考虑分表吧
•
坚决抵制使用
blob
数据类型
如有必要,还是尽量用文件系统的文件来存储吧。
smaller ,smaller ,smaller
smaller ,smaller ,smaller
smaller ,smaller ,smaller
smaller ,smaller ,smaller
以小定天下