在數據庫上執行字符串搜索的最佳方法

[英]Best method to perform string search on database


I am looking for the best programming practice to perform a text based search on a database. We currently use multiple LIKE '%Keyword%' queries that are quite slow on our server as it can go through anywhere from 50-75k records. I have looked into Full Text Search a bit and was wondering if that is the best solution or if there are others that exist.

我正在尋找最好的編程實踐來在數據庫上執行基於文本的搜索。我們目前使用多個LIKE'%Keyword%'查詢,這些查詢在我們的服務器上非常慢,因為它可以在50-75k記錄中查看。我有點研究全文搜索,並想知道這是否是最佳解決方案,或者是否存在其他解決方案。

Specifics: I am searching for multiple keywords or phrases in a table with a large list of records with text. I am performing an OR search for keywords and phrases.

細節:我在一個表中搜索多個關鍵字或短語,其中包含大量帶文本的記錄。我正在搜索關鍵字和短語的OR搜索。

1 个解决方案

#1


1  

Which database system do you use? Without this information it is pretty difficult to answer accurately. For SQL Server Full-Text search is a pretty good solution, like gh9 already said.

你使用哪個數據庫系統?沒有這些信息,很難准確回答。對於SQL Server全文搜索是一個非常好的解決方案,就像gh9已經說過的那樣。

Indexing the columns - like suggested - wouldn't be a solution, since you start your search term with an wildcard. So the keyword could not be used as a "Seek Predicate" Seek Predicate

索引列(如建議的那樣)不是解決方案,因為您使用通配符開始搜索詞。所以關鍵字不能用作“尋求謂詞”尋求謂詞


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2014/05/21/7208f19d8d9653d0f684e221c4faf0bc.html



 
粤ICP备14056181号  © 2014-2020 ITdaan.com