27,580
社区成员
发帖
与我相关
我的任务
分享
aa,gltr_project,gltr_eff_dt--建一個組合索引
create index IX_test on test(aa,gltr_project,gltr_eff_dt)
EXEC da_xm @ipdwname = 'abced' WITH RECOMPILE;
select sum(abcd) from test
where aa=@t_ipdwcode
and gltr_project <>''
and year(gltr_eff_dt)=year(getdate())
OPTION (RECOMPILE);
select sum(abcd) from test
where aa=@t_ipdwcode
and gltr_project <>''
and year(gltr_eff_dt)=year(getdate())
OPTION (OPTIMIZE FOR (@t_ipdwcode = 'abcde'));