请教像阿里巴巴这样的数据量过百万的网站,其数据搜索和分页是如何实现的?
我个人是用全文索引做的,把物品名和物品简介放在一起,检索这个字段。
分页是用存储过程做的,
请各位大师指点一下我,超级谢谢
我个人是用全文索引做的,把物品名和物品简介放在一起,检索这个字段。
分页是用存储过程做的,
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
(
@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
请各位大师指点一下我,超级谢谢