show full processlist;
show status ; mysql
Data Export sql
Data Importsession
Mysql Utilities性能
InnoDB 存儲方式spa
1.刪除text 和blob後空洞並不會處理,須要3d
OPTIMIZE TABLE movie;code
回收表空間;orm
2.合成(Synthetic )索引,提升大文本字段(text 和blob)的查詢性能blog
只針對精準查詢,使用MD5(),SHA1(),CRC32()等生成列散值,索引
create table t(id varchar(100), context blob,hash_value varchar(40)); insert into t values(1,repeat('beijing',2),md5(context)); insert into t values(2,repeat('beijing',2),md5(context)); insert into t values(3,repeat('beijing 2008',2),md5(context)); select*from t where hash_value=md5(repeat('beijing 2008',2));
也能夠添加模糊索引
create index idx_blob on t(context(100)); select*from t where context like 'beijing%'
3.沒必要要就不要檢索blob和text;
如:select*from...
4.把blob和test分析到單獨的表
減小主表的碎片也不會再主數表運行select*from查詢大量的blob和text;
select concat('KILL ',id,';') from information_schema.processlist where command ='Sleep' and TIME > 100
客戶端裏面運行這個
打開cmd
cd 到mysql 位置
mysq - u admin -p
登錄mysql
而後複製上面的結果到cmd
或者導出文件
select concat('KILL ',id,';') from information_schema.processlist where command ='Sleep' and TIME > 100 into outfile 'd:/MySQL/Temporary File/a.txt';
source d:/MySQL/Temporary File/a.sql;