Full-Text vs LIKE
LIKE '%word%' does a full table scan with no ranking. Full-text search uses an inverted index, supports relevance ranking, and is orders of magnitude faster on large tables.
LIKE '%word%' does a full table scan with no ranking. Full-text search uses an inverted index, supports relevance ranking, and is orders of magnitude faster on large tables.
-- Slow: full table scan, no ranking
SELECT * FROM articles WHERE body LIKE '%optimization%';
-- Fast: uses full-text index, ranked by relevance
SELECT *, MATCH(title,body) AGAINST('optimization') AS score
FROM articles
WHERE MATCH(title,body) AGAINST('optimization')
ORDER BY score DESC;
Use LIKE only for pattern matching on short strings; full-text for natural language search.