[请教]关于超大数据量网站的数据搜索和分页的实现方法
生活随笔
收集整理的這篇文章主要介紹了
[请教]关于超大数据量网站的数据搜索和分页的实现方法
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
請(qǐng)教像阿里巴巴這樣的數(shù)據(jù)量過百萬的網(wǎng)站,其數(shù)據(jù)搜索和分頁是如何實(shí)現(xiàn)的?
我個(gè)人是用全文索引做的,把物品名和物品簡(jiǎn)介放在一起,檢索這個(gè)字段。
分頁是用存儲(chǔ)過程做的,
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
請(qǐng)各位大師指點(diǎn)一下我,超級(jí)謝謝
我個(gè)人是用全文索引做的,把物品名和物品簡(jiǎn)介放在一起,檢索這個(gè)字段。
分頁是用存儲(chǔ)過程做的,
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
請(qǐng)各位大師指點(diǎn)一下我,超級(jí)謝謝
轉(zhuǎn)載于:https://www.cnblogs.com/bankey/archive/2007/11/05/949605.html
總結(jié)
以上是生活随笔為你收集整理的[请教]关于超大数据量网站的数据搜索和分页的实现方法的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: C#中Trim()、TrimStart(
- 下一篇: 在SQLServer中区分大小写的几种方