I have a really big sql select query that I have to optimize because it takes 40 seconds.
我有一个非常大的SQL选择查询,我必须优化,因为它需要40秒。
Im using Sql Sentry Plan Explorer to do so and I found that 2 "Clustered Index Seek operations" (in a 300k rows table) take nearly 60% of the whole process time.
我使用Sql Sentry Plan Explorer这样做,我发现2“Clustered Index Seek操作”(在300k行表中)占用了整个处理时间的近60%。
My questions is: What could cause this "clustered index seek" to take so much time? When I do a simple select on this table it takes only 2 seconds but this index seek takes like 24 seconds...
我的问题是:什么可能导致这种“聚集索引寻求”花费这么多时间?当我在这个表上进行简单的选择时,它只需要2秒,但这个索引搜索需要24秒......
I also checked index fragmentation and its over 2%.
我还检查了索引碎片及其超过2%。
NOTE: Sorry I dont post details but im not allowed to do so.
注意:对不起,我不发布详细信息,但我不允许这样做。
1 个解决方案
#1
1
At the first time you can try to update statistics.
您第一次可以尝试更新统计信息。
For example so.
例如如此。
UPDATE STATISTICS ...
Or so.
或者。
EXEC sp_updatestats
#1
1
At the first time you can try to update statistics.
您第一次可以尝试更新统计信息。
For example so.
例如如此。
UPDATE STATISTICS ...
Or so.
或者。
EXEC sp_updatestats