Order by在SQL Server中花费太多时间 [英] Order by is taking too much time in Sql Server

查看:165
本文介绍了Order by在SQL Server中花费太多时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


选择查询对orderby子句的查询过多
谁能帮我这个忙.请在下面找到代码.

SELECT * FROM tblQ OR BY BY QCDate DESC

QCDate是日期列
表仅包含四行,此查询耗时25秒.

Hi
Select query is taking too much query on orderby clause

can anyone kindly help me with this. Please find the code below.

SELECT * FROM tblQ ORDER BY QCDate DESC

QCDate is a date column
table consists of only four rows and this query is taking 25sec.

推荐答案

问题在于,在此阶段可能是任何事情.
从小处着手,并将查询简化为最基本的内容:
The problem is that this could be anything at this stage.
Start small and reduce your query to it''s most basic:
SELECT QCDate FROM tblQ ORDER BY QCDate DESC

如果仍然需要25秒,请移除"ORDER BY"部分,然后重试.如果那仍然很慢,那么您需要检查一下SQL Server的安装-可能有问题.

快速查询后,可以向后添加位,直到再次执行完整查询为止,或者添加一个元素会降低查询速度.

If this still takes 25 seconds, then remove the "ORDER BY" part and try again.If that is still slow, then you need to look ate you SQL server installation - there is probably a problem.

Once you have a fast query, you can add bits back until you have the complete query again, or adding one element slows it down.


这篇关于Order by在SQL Server中花费太多时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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