Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why I would bother using full text search?

I am new to Full Text Search, I used the following query

Select * From Students Where FullName LIKE '%abc%'

Students table contains million records all random and look like this 'QZAQHIEK VABCNLRM KFFZJYUU'

It took only 2 seconds and resulted 1100 rows. If million record is searched in two seconds why I would bother using Full Text Search ?!! Did Like predicate used the Full Text Index as well?

like image 708
Costa Avatar asked May 08 '12 16:05

Costa


People also ask

What is the advantage of a full-text search?

Conclusion. Users searching full text are more likely to find relevant articles than searching only abstracts. This finding affirms the value of full text collections for text retrieval and provides a starting point for future work in exploring algorithms that take advantage of rapidly-growing digital archives.

What is the importance of MySQL full-text search?

The MySQL full-text search capability provides a simple way to implement various search techniques (natural language search, query expansion search, and boolean search) into your application running MySQL.

What is full-text search?

A full-text search is a comprehensive search method that compares every word of the search request against every word within the document or database.

What is the use of full-text search in SQL Server?

Full-text queries perform linguistic searches against text data in full-text indexes by operating on words and phrases based on the rules of a particular language such as English or Japanese. Full-text queries can include simple words and phrases or multiple forms of a word or phrase.


2 Answers

No. LIKE does not make use of full text indexing. See here.

Computers are pretty darn fast these days but if you're seeing search results faster than you expect it's possible that you simply got back a cached result set because you executed the same query previously. To be sure you're not getting cached results you could use DBCC DROPCLEANBUFFERS. Take a look at this post for some SQL Server cache clearing options.

Excerpt from the linked page:

Comparing LIKE to Full-Text Search

In contrast to full-text search, the LIKE Transact-SQL predicate works on character patterns only. Also, you cannot use the LIKE predicate to query formatted binary data. Furthermore, a LIKE query against a large amount of unstructured text data is much slower than an equivalent full-text query against the same data. A LIKE query against millions of rows of text data can take minutes to return; whereas a full-text query can take only seconds or less against the same data, depending on the number of rows that are returned.

like image 147
Paul Sasik Avatar answered Oct 06 '22 00:10

Paul Sasik


I think you have answered your own question, at least to your own satisfaction. If your prototyping produces results in an acceptable amount of time, and you are certain that caching does not explain the quick response (per Paul Sasik), by all means skip the overhead of full-text indexing and proceed with LIKE.

like image 38
David Gorsline Avatar answered Oct 05 '22 23:10

David Gorsline