Câu hỏi phỏng vấn MySQL
Câu hỏi

What is advantage of FULLTEXT over LIK...

Câu trả lời

The advantage of using FULLTEXT over LIKE for performing text search in MySQL lies in several key areas:

  1. Performance and Efficiency: FULLTEXT search is significantly faster than LIKE, especially as the dataset size increases. The performance of LIKE degrades as data grows, making FULLTEXT search a more efficient solution for large datasets. FULLTEXT search performs linguistic searches against text data in full-text indexes by operating on words and phrases, which is significantly faster than the character pattern matching of LIKE. For example, in SQL Server, queries with the LIKE clause ran 6 to 15 times slower on the Transaction table and 39 times slower on the Claims table compared to FULLTEXT search[2].

  2. Complex Query Capability: FULLTEXT search allows for much more complex searching, including logical operators such as AND, OR, NOT, and even similar sounding results (SOUNDEX), providing a lot of flexibility to tune down the precision for better recall[4]. This is in contrast to LIKE, which uses wildcards only and isn't as powerful for complex query requirements.

  3. Indexing Strategy: FULLTEXT search uses an "inverted index" where the keys are individual terms, and the associated values are sets of records that contain the term. This indexing strategy is optimized to compute the intersection, union, etc., of these record sets and usually provides a ranking algorithm to quantify how strongly a given record matches search keywords. LIKE, on the other hand, can be extremely inefficient, especially if applied to an un-indexed column or if th...

senior

senior

Gợi ý câu hỏi phỏng vấn

junior

Explain foreign key constraint in MySQL

junior

Describe BLOB in MySQL. What is it used for?

middle

What are key constraints. What different types of constraints are there in MySQL?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào