Sql server 2005带来的分页便利
2013-11-20 14:24
441 查看
select threadid from
(
select threadid, ROW_NUMBER() OVER (order by stickydate) as Pos from cs_threads
) as T
where T.Pos > 100000 and T.Pos < 100030
===========================================
如果里面的这个表cs_threads数据量超大,比如,几亿条记录,那这个方法应该是有问题的
因为,select threadid from
(
select threadid, ROW_NUMBER() OVER (order by stickydate) as Pos from cs_threads
) as T
where T.Pos > 100000 and T.Pos < 100030
这个语句是把select threadid, ROW_NUMBER() OVER (order by stickydate) as Pos from cs_threads它全部取出来,然后在SQL的外面进行分页的,没在SQL2005上测试过,因为原先在ORACLE上这样的写法是不好的,ORACLE中这样写比较好:select threadid from
(
select threadid, ROW_NUMBER() OVER (order by stickydate) as Pos from cs_threads a where a.pos<100030
) as T
where T.Pos > 100000
(
select threadid, ROW_NUMBER() OVER (order by stickydate) as Pos from cs_threads
) as T
where T.Pos > 100000 and T.Pos < 100030
===========================================
如果里面的这个表cs_threads数据量超大,比如,几亿条记录,那这个方法应该是有问题的
因为,select threadid from
(
select threadid, ROW_NUMBER() OVER (order by stickydate) as Pos from cs_threads
) as T
where T.Pos > 100000 and T.Pos < 100030
这个语句是把select threadid, ROW_NUMBER() OVER (order by stickydate) as Pos from cs_threads它全部取出来,然后在SQL的外面进行分页的,没在SQL2005上测试过,因为原先在ORACLE上这样的写法是不好的,ORACLE中这样写比较好:select threadid from
(
select threadid, ROW_NUMBER() OVER (order by stickydate) as Pos from cs_threads a where a.pos<100030
) as T
where T.Pos > 100000
相关文章推荐
- Sql server 2005带来的分页便利
- Sql server 2005带来的分页便利
- Sql server 2005带来的分页便利
- Sql server 2005带来的分页便利
- Sql server 2005带来的分页便利
- 惊喜:Sql2005带来的分页便利
- SQL Server 2000/2005 分页SQL — 单条SQL语句 (转)
- SQL Server 2005的ROW_NUMBER()分页效率比较
- SQL Server 2000/2005 分页SQL — 单条SQL语句
- Sql server 2005 利用row_number() 函数实现分页
- SQL SERVER 2005分页查询语句
- SQL Server 2005下的分页SQL
- SQL Server 2005的通用分页存储过程
- 令人兴奋的sql server 2005 分页功能
- 收藏一个HIBERNATE对SQL SERVER 2005分页支持的问题
- SQL Server 2005中利用临时表和@@RowCount提高分页查询存储过程性能
- Sql Server 2005 新的分页存储过程的推荐写法
- 深入sql server 2005 万能分页存储过程的详解
- SQL Server 2005的ROW_NUMBER()分页效率比较
- SQL Server 2005 分页研究和优化(2)