有一个存储过程很慢,用跟踪跟了下,有几句比较慢,高手帮忙看下是否有办法优化?
多谢.if exists(
           select * from tbl1 as A,tbl2 as B
                  where 
                       ... ...
                       and ((A.aa = B.bb and B.bc = abc) or(A.aa = B.cc and B.bc <> abc))
         )
begin
         select A.aa,... from tbl1 as A,tbl2 as B
                  where 
                       ... ...
                       and ((A.aa = B.bb and B.bc = abc) or(A.aa = B.cc and B.bc <> abc))end目前我是想这么做
给B.bc加索引,把exists的语句取消掉,改成直接查,判断查出来的数据.
不知道大家有什么好的建议没?