美团点评开源 SQL 优化工具 SQLAdvisor 测试报告
2017-03-14 12:30:51 1923 第1步: 对SQL解析优化之后得到的SQL:\select `*` AS `*` from `databaseA`.`tableA` where (`LID` = 'xxxx') \order by `GT` desc2017-03-14 12:30:51 1923 第2步:开始解析where中的条件:(`LID` = 'xxxx')2017-03-14 12:30:51 1923 show index from tableA
2017-03-14 12:30:51 1923 show table ST like 'tableA'2017-03-14 12:30:51 1923 select count(*) from ( select `LID` from `tableA` \
FORCE INDEX( i_E_ID ) order by E_ID DESC limit 10000) `tableA` \
where (`LID` = 'xxxx')2017-03-14 12:30:51 1923 第3步:表tableA的行数:122879,limit行数:10000,\得到where条件中(`LID` = 'xxxx')的选择度:10000
2017-03-14 12:30:51 1923 第4步:开始解析order by 条件
2017-03-14 12:30:51 1923 第5步:开始验证 字段GT是不是主键。表名:tableA
2017-03-14 12:30:51 1923 show index from tableA where Key_name = 'PRIMARY' \and Column_name ='GT' and Seq_in_index = 1
2017-03-14 12:30:51 1923 第6步:字段GT不是主键。表名:tableA
2017-03-14 12:30:51 1923 第7步:开始添加order by 字段
2017-03-14 12:30:51 1923 第8步:开始验证 字段GT是不是主键。表名:tableA
2017-03-14 12:30:51 1923 show index from tableA where Key_name = 'PRIMARY' \and Column_name ='GT' and Seq_in_index = 1
2017-03-14 12:30:51 1923 第9步:字段GT不是主键。表名:tableA
2017-03-14 12:30:51 1923 第10步:开始验证 字段LID是不是主键。表名:tableA
2017-03-14 12:30:51 1923 show index from tableA where Key_name = 'PRIMARY' \and Column_name ='LID' and Seq_in_index = 1
2017-03-14 12:30:51 1923 第11步:字段LID不是主键。表名:tableA
2017-03-14 12:30:51 1923 第12步:开始验证 字段LID是不是主键。表名:tableA
2017-03-14 12:30:51 1923 show index from tableA where Key_name = 'PRIMARY' \and Column_name ='LID' and Seq_in_index = 1
2017-03-14 12:30:51 1923 第13步:字段LID不是主键。表名:tableA
2017-03-14 12:30:51 1923 第14步:开始验证表中是否已存在相关索引。表名:tableA, \字段名:LID, 在索引中的位置:1
2017-03-14 12:30:51 1923 show index from tableA where Column_name ='LID' \and Seq_in_index =1
2017-03-14 12:30:51 1923 第15步:开始验证 字段GT是不是主键。表名:tableA
2017-03-14 12:30:51 1923 show index from tableA where Key_name = 'PRIMARY' \and Column_name ='GT' and Seq_in_index = 1
2017-03-14 12:30:51 1923 第16步:字段GT不是主键。表名:tableA
2017-03-14 12:30:51 1923 第17步:开始验证表中是否已存在相关索引。\表名:tableA, 字段名:GT, 在索引中的位置:2
2017-03-14 12:30:51 1923 show index from tableA where \Column_name ='GT' and Seq_in_index =2
2017-03-14 12:30:52 1923 第18步:开始输出表tableA索引优化建议:
2017-03-14 12:30:52 1923 Create_Index_SQL:alter table tableA add index \idx_LID_GT(LID,GT)2017-03-14 12:30:52 1923 第19步: SQLAdvisor结束!
页:
[1]