在sql中查询优化

时间:2017-03-17 09:13:28

标签: join group-by query-optimization cpu-usage between

select a.col1,a.col2,count(b.col1) as cnt 
from table1 a,table2 b 
where b.col2 between a.col1 and a.col2 
group by a.col1,a.col2

以上查询在SQL Server 2008 r2中占用5分钟并且占用100%cpu,是否有任何调整查询的想法?

table1&上有索引table2 columns。

0 个答案:

没有答案