积极答复者
帮忙出出主意优化一下数据库,模糊搜索超级慢,总是超时

问题
-
因为网站需要做搜索,现在数据大概15000条左右吧,总是超时,你们帮我出出主意应该怎么弄一下,谢谢
以下是搜索的时候用的存储过程
USE [101minecom] GO /****** 对象: StoredProcedure [101minecom].[P_Fulltext] 脚本日期: 06/03/2010 13:37:33 ******/ SET ANSI_NULLS OFF GO SET QUOTED_IDENTIFIER OFF GO CREATE PROCEDURE [101minecom].[P_Fulltext] @searchstr varchar(50) AS /*首页搜索与搜索页搜索*/ select top 25 * from ( select newsid as id,title,convert(varchar(1000),content) as content,convert(varchar(30),adddate,23) as postdate,kind='readnews.aspx',hit from v_news where title like '%'+@searchstr+'%' or content like '%'+@searchstr+'%' union all select id,title,convert(varchar(1000),content) as content,convert(varchar(30),adddate,23) as postdate,kind='showvideo.aspx',hit from v_video where title like '%'+@searchstr+'%' or content like '%'+@searchstr+'%' union all select id,title,convert(varchar(1000),content) as content,convert(varchar(30),postdate,23) as postdate,kind='readarticle.aspx',hit from v_article where title like '%'+@searchstr+'%' or content like '%'+@searchstr+'%' union all select id,title,convert(varchar(1000),content) as content,convert(varchar(30),postdate,23) as postdate,kind='readsupply.aspx',hit from v_supply where title like '%'+@searchstr+'%' or content like '%'+@searchstr+'%' ) x order by hit desc,postdate desc
答案
-
建议使用全文检索。详情请参见SQL Server自带的联机丛书。
想不想时已是想,不如不想都不想。- 已标记为答案 Nai-dong Jin - MSFTModerator 2010年6月10日 5:22
全部回复
-
建议使用全文检索。详情请参见SQL Server自带的联机丛书。
想不想时已是想,不如不想都不想。- 已标记为答案 Nai-dong Jin - MSFTModerator 2010年6月10日 5:22