GO DBMS
2011年7月23日土曜日
[性能调优] SQL优化技巧
- 使用count case语句结合,把多次全扫描改写成一次全扫描
select
ym,
count(case when cnt between 1 and 50 then 1 end) count1,
count(case when cnt between 51 and 100 then 1 end) count2
from history group by ym order by ym;
0 件のコメント:
コメントを投稿
次の投稿
前の投稿
ホーム
登録:
コメントの投稿 (Atom)
0 件のコメント:
コメントを投稿