How does MySQL handle full-text indexing vs regular B-tree indexing for large text searches?
Why Interviewers Ask This
Senior MySQL / SQL engineers are expected to reason about architecture, performance, and edge cases. This question separates mid-level from senior candidates by testing deep system-level understanding.
Answer
For large text search operations, B-tree indexes and FULLTEXT indexes serve fundamentally different purposes and have different performance characteristics. B-tree index + LIKE: WHERE description LIKE "mysql%" — only efficient with a trailing wildcard (can use index prefix scan). A leading wildcard (LIKE "%mysql" or LIKE "%mysql%") triggers a full table scan — O(n) regardless of index. B-tree is appropriate for exact matches or prefix searches on short strings (first name, SKU codes). FULLTEXT index + MATCH...AGAINST: uses an inverted index — maps every word to the list of documents containing it. Supports natural language search with relevance ranking, phrase search, Boolean operators. Finding documents containing "mysql optimization" is O(log n) using the inverted index. FULLTEXT indexes are maintained synchronously on write. Limitations: minimum word length filters; stop words ignored; InnoDB FULLTEXT requires table-level lock during index build on large tables. Performance at scale: MySQL FULLTEXT is suitable for moderate sizes (millions of records). For billions of records, complex relevance, fuzzy matching, faceted search, and geo-search, use Elasticsearch or MeiliSearch, fed via binlog CDC or application writes, with MySQL as the source of truth.
Pro Tip
Back up your answer with a specific project or situation. Saying 'In my last MySQL / SQL project, I used this when...' immediately makes your answer more credible and memorable.
More MySQL / SQL Questions
View all →- Advanced What is the difference between B-tree and Hash indexes in MySQL?
- Advanced What is MVCC (Multi-Version Concurrency Control) in MySQL?
- Advanced What is the InnoDB Buffer Pool and how does it work?
- Advanced What is deadlock in MySQL and how do you prevent it?
- Advanced What is the query execution plan and how does the MySQL optimizer work?