免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
123
最近访问板块 发新帖
楼主: zfol_510
打印 上一主题 下一主题

MySQL交叉查询难以置信的慢, 请教高人 [复制链接]

论坛徽章:
0
21 [报告]
发表于 2011-04-16 18:41 |只看该作者
  1. SELECT SQL_NO_CACHE distinct tsl.TestSuiteID, tsl.TestSuiteName, tsl.TPrefix,
  2. tps.ID, tcp.TestCaseID, tpl.Name, tpl.Version,
  3. tps.Name AS ScriptName, tps.Version AS ScriptVersion
  4. FROM test_case_procedure  tcp
  5.         left join test_procedure_label tpl on tpl.ID = tcp.TestProcedureLabelID
  6.         left join  test_procedure_script tps  on  tcp.ID = tps.TestCaseProcedureID
  7.         left join event_script es on es.TestProcedureScriptID = tps.ID                       
  8.         left join test_event te on te.TestEventID = es.TestEventID
  9.         left join test_case tc on tc.TestCaseID = tcp.TestCaseID
  10.         left join test_suite_list tsl on tsl.TestSuiteID = tc.TestSuiteID
  11.         left join project p on te.ProjID = p.ProjectID
  12. where p.CoreID=11
  13. ORDER BY tcp.TestCaseID, tpl.Name, tpl.Version DESC,tps.Name, tps.Version
  14.                            

  15. alter table project add index prj_idx(CoreID);
  16. alter table test_case_procedure add index tcp_idx(ID);
  17. alter table test_case add index tc_idx(TestCaseID,TestSuiteID);
  18. alter table event_script add index es_idx(TestProcedureScriptID);
  19. alter table test_procedure_label add index tpl_idx(ID);
  20. alter table test_suite_list add index tsl_idx(TestSuiteID);
复制代码
加上索引啦
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP