我用了存储过程,性能却没有多大改善,为啥?详情看代码!
用vb6结合ado开发数据库,有个语句频繁使用:
select amoun(consume) as TT from Table where BeginDate>P1 and endDate<p2 and cardId=P3
其中CardId是主建,
后来发现数据库很慢,用sql的事件跟踪看,就是这句。执行时间有200毫秒之多。
于是该项为存储过程
create proc Mydll(@CI char(10))
as
begin
select amount(comsume) as tt from table where Begindate>'2004-02_14' and EndDate<'2004-02-15' and CardId=@CI
end
go
在用Mydll “1000334”调用,发现执行时间还是一样的。
不是说存储过程能改善性能吗?看看错在那里,指点指点。