本篇文章主要介绍了" mysql 性能优化索引、缓存、分表、分布式实现方式。",主要涉及到方面的内容,对于MySql感兴趣的同学可以参考一下: 系统针对5000台终端测试结果索引目标:优化查询速度3秒以内 需要优化。尽量避免使用select * 来查询对象。使用到哪些属性就查询出哪些使用即可首页页面:设...
系统针对5000台终端测试结果
索引
目标:优化查询速度3秒以内 需要优化。尽量避免使用select * 来查询对象。使用到哪些属性值就查询出哪些使用即可
首页页面:
设备-组织查询 优化 避免使用select * 来查询device对象 优化前耗时 200毫秒 优化后耗时19毫秒
设备-在线 优化 避免使用select * 来查询device对象 优化前耗时 210毫秒 优化后耗时11毫秒
设备-版本 优化 避免使用select * 来查询device对象 优化前耗时 230毫秒 优化后耗时10毫秒
终端检查报告页面:
查看报告详细报告 优化前耗时3603毫秒 优化后耗1103毫秒
优化方式:
1:ccp_infraction 建立联合索引 checkItemId和reportId
create index ccp_infraction_index on ccp_infraction (reportId,checkItemId) ;
查看报告所有结果和人工判定 优化前耗时10300毫秒 优化后耗时1973毫秒
优化方式:添加联系索引
create index idx_1 on ccp_artificial (reportId,isInfraction);
create index idx_2 on ccp_terminalinfo(reportId);
create index idx_3 on ccp_currenttimerep(reportId);
create index idx_4 on ccp_hostrep (reportId);
create index idx_5 on ccp_currentaccountrep(reportId);
create index idx_6 on ccp_accountrep(reportId,isInfraction);
create index idx_7 on ccp_hardwarerep(reportId,isInfraction);
create index idx_8 on ccp_networkrep (reportId);
create index idx_9 on ccp_softwarerep(reportId,isInfraction);
create index idx_10 on ccp_diskrep (reportId,isInfraction);
create index idx_11 on ccp_partitioninforep(reportId);
create index idx_12 on ccp_oneKeyInforep(reportId,isInfraction);
create index idx_13 on ccp_usbinforep(reportId,isInfraction);