海量数据分页方法
随着数据的增加,我的小站的速度也是越来越慢,于是想如何快速取得数据。目前小站的数据已经达到5K,目前还在增加中,测试数据已经达到10K,天呀,优化语句吧。我喜欢速度。
mysql 方法:
select * from news where id <= (select id from news order by id desc limit 1 offset 20) order by id desc limit 10 offset 20
access 或者mssql 方法 1:
select top 10 * from news where id<
(select max (id) from
(select top 40 id from news
order by id desc)) order by id desc
mysql 方法:
select * from news where id <= (select id from news order by id desc limit 1 offset 20) order by id desc limit 10 offset 20
access 或者mssql 方法 1:
select top 10 * from news where id<
(select max (id) from
(select top 40 id from news
order by id desc)) order by id desc
- 没有相关文章
- 没有评论