设为首页 加入收藏

TOP

分页存储过程效率对比(二)
2015-11-21 01:33:42 来源: 作者: 【 】 浏览:1
Tags:存储 过程 效率 对比
returnfields end set @sql+=' from #t where rowid>@lastmaxid order by rowid' set @sql+=' select @total total,'+cast(@pagesize as nvarchar)+' pagesize,'+cast(@pageindex as nvarchar)+' pageindex' set @sql+=' if object_id(''tempdb..#t'') is not null drop table #t' exec(@sql) END

?

?
效率对比
?
1. declare @pcount int,@rcount int
exec [dbo].[xp_getpager_user_dt] ?
? ? @pcount ?output, ? ?--总页数输出 ?
? ? @rcount ?output, ? ?--总记录数输出 ?
? ? @tablename ='v_pn_users_fromlocal', ? ?--查询表名 ?
? ? @keys ='code', ? ? ? ?--主键 ?
? ? @fields ='code,name,fname,email,isvalid,hiredate,hireva lid,quitdate,costcenter,sex,IDCard,PassDate', ? ?--查询字段 ?
? ? @where ='quitdate>''2015-01-01''', ? ?--查询条件 ?
? ? @sortfields ='quitdate', ? ?--排序字段 ?
? ? @beginindex =0, ? ? ? ?--开始位置 ?
? ? @pageindex =1, ? ? ? ?--当前页数 ?
? ? @pagesize =100
?
执行时间:1 min 18s
?
2. [xp_GetPager_user_dt2] @quitdate='2015-01-01',@pagesize=100
?
执行时间:<1s
首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇sqlite数据库中第一条数据查不出.. 下一篇sql的简单提高效率方法

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: