千万级数据分页

楼主
千万级数据分页
[P][CODE]
create proc [dbo].[sp_ru_News_search]
(@startIndex int,
@endIndex int,
@docount bit,
@keys char)
as
set nocount on
if(@docount=1)
select count(id) from ru_News where n_title like('%'+@keys+'%')--id in (select top 10000 id from ru_News where n_title like('%'+@keys+'%'))
else
begin
declare @indextable table(id int identity(1,1),nid int)
set rowcount @endIndex
insert into @indextable(nid) select top 10000 id from ru_News where n_title like('%'+@keys+'%') order by id desc
select t.nid as id,n_title,n_con,n_date,n_from from ru_News O,@indextable t where O.id=t.nid and t.id between @startIndex and @endIndex order by t.id
end
set nocount off
[/CODE][/P][P] [/P][P]目前使用的是以下的分页过程[/P][P]可是好像百万级还可以数据一上千万就不太好用了。页面加载时间太慢了。[/P][P]各位大虾有没有办法?[/P]

电脑版 Page created in 0.0684 seconds with 4 queries.