douguangxiang0363 2017-01-23 08:03
浏览 28

在php mysql查询中我加入了8个表,结果是处理时间很长。 给我任何解决方案

SELECT o.*, GROUP_CONCAT(DISTINCT ot.name) organisationTypeName FROM 
recruitment as re, ahig_services as ahs, salary_options as so, pay_roll as pr,
resource_legal as rl, training as tr, organisation as o INNER JOIN 
organization_type ot ON FIND_IN_SET(ot.id, o.organisationType) > 0 where 
re.organisationId=o.id AND ahs.organisationId=o.id AND so.organisationId=o.id 
AND pr.organisationId=o.id AND rl.organisationId=o.id AND 
tr.organisationId=o.id GROUP BY o.id,o.organisationType ORDER BY o.id ASC
limit 0, 10
  • 写回答

1条回答 默认 最新

  • dream752614590 2017-01-23 08:22
    关注

    To improve performance you should check the selectivity index of the columns on which joins are made. A proper indexed table will improve performance. for more info : http://beginner-sql-tutorial.com/sql-query-tuning.htm

    You can also try indexed views for tables which can have some performance benefit. That said, SQL Server 2000 and above do have a special feature called Indexed Views that can greatly improve performance, but you have to create indexed views following a very specific set of guidelines(https://msdn.microsoft.com/en-us/library/ms187864.aspx). There is an important reference in Books Online in regards to view resolution(https://msdn.microsoft.com/en-us/library/ms190237.aspx).

    Here is an article that describes the benefits and creation of indexed views:https://technet.microsoft.com/library/Cc917715

    评论

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么