您的位置:首页 > 大数据

[请教]关于超大数据量网站的数据搜索和分页的实现方法

2007-11-05 11:28 706 查看
请教像阿里巴巴这样的数据量过百万的网站,其数据搜索和分页是如何实现的?

我个人是用全文索引做的,把物品名和物品简介放在一起,检索这个字段。

分页是用存储过程做的,

CREATE PROCEDURE GetSearchEnterprise

(

@strWhere varchar(3000),

@PageSize int,

@PageIndex int

)

AS

declare @strSQL varchar(8000)

if @PageIndex=1

begin

set @strSQL='select top '+str(@PageSize)+' * from t_company where '+@strWhere+'order by companyid desc'

end

else

begin

set @strSQL='select top '+str(@PageSize)+' * from t_company where companyid<(select min(tmp_t_company.companyid) from (select top '+str((@PageIndex-1)*@PageSize)+' companyid from t_company where '+@strWhere+' order by companyid desc) as tmp_t_company ) and '+@strWhere+' order by companyid desc'

end

exec(@strSQL)

--print(@strSQL)

GO

请各位大师指点一下我,超级谢谢
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: