改善糟糕的SQL性能 [英] Improve bad sql performance

查看:86
本文介绍了改善糟糕的SQL性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

已删除

解决方案

能够帮助解决性能问题并获得成功的机会,我们需要至少看到XML格式的实际查询计划。它太大了,不能在这里发布,但你可以上传某个地方并发布链接,或使用
http://www.brentozar.com/pastetheplan。


它还有助于了解表和索引定义以及数据配置文件等。


根据你发布的内容,我只能提出一个建议。更改此行:


    Datediff(分钟,lo.lastonlinetime,CURRENT_TIMESTAMP)> 15周


   io.lastonlimetime< dateadd(分钟,-15,CURRENT_TIMESTAMP)


这可能是你所需要的,或根本不起作用,这取决于lastonlinetime上是否有idnex以及条件的选择性。


deleted

解决方案

To be able to help with a performance problem with some chance of success, we need to see at least the actual query plan in XML format. It is too big to post here, but you can upload somewhere and post the link, or use http://www.brentozar.com/pastetheplan.

It also helps to know the table and index definitions, as well as the data profile etc.

From what you have posted, I can only give one suggestion. Change this line:

    Datediff (minute, lo.lastonlinetime, CURRENT_TIMESTAMP) > 15
to

   io.lastonlimetime < dateadd(minute, -15, CURRENT_TIMESTAMP)

This may be all you need, or have no effect at all, depending on whether there is an idnex on lastonlinetime and how selective the condition is.


这篇关于改善糟糕的SQL性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆