有没有高效的分页存储过程
CREATE   procedure   PageChange 
 ( 
 	@pagesize   int, 
 	@pageindex   int, 
 	@Keywords   varchar(50), 
 	@docount   bit 
 ) 
 as 
 set   nocount   on 
 if(@docount=1) 
 select   count(*)   from   table1   as   t1   inner   join   table2   on   t1.uID=table2.uID   inner   join   containstable(table3,Content,@Keywords)   as   t3   on   t1.ID=t3.[KEY] 
 else 
 begin 
 declare   @indextable   table(id   int   identity(1,1),nid   int) 
 declare   @PageLowerBound   int 
 declare   @PageUpperBound   int 
 set   @PageLowerBound=(@pageindex-1)*@pagesize 
 set   @PageUpperBound=@PageLowerBound+@pagesize 
 set   rowcount   @PageUpperBound   
 insert   into   @indextable(nid)   select   ID   from   table1   as   t1   inner   join   table2   on   t1.uID=table2.uID   inner   join   containstable(table1,Content,@Keywords)   as   t3 
 on   t1.ID=t3.[KEY]   order   by   t3.[RANK]   desc,t1.AddTime   desc   
 insert   into   @indextable(nid).... 
 ...... 
 ......   
       SELECT   ... 
                            ... 
       from   table1   O,@indextable   t   ,table2 
 where   O.ID=t.nid 
 and   t.id> @PageLowerBound   and   t.id <=@PageUpperBound      and   O.uID=table2.uID   order   by   t.id   
 end 
 set   nocount   off 
 GO     
 这个存储过程是可以实现功能,但是数据量非常大的时候,查询速度就比较慢了。 
 不知有哪位高手能提供更好的分页存储过程?
------解决方案--------------------http://topic.csdn.net/t/20031017/11/2365596.html
------解决方案--------------------select ID from table1 as t1 inner join table2 on t1.uID=table2.uID inner join containstable(table1,Content,@Keywords) as t3 
 on t1.ID=t3.[KEY] order by t3.[RANK] desc,t1.AddTime desc   
 修改一下,table2有意义么?就查询ID来说应该无意义,去掉。