# Scaling Android Search: Room @Fts4 vs SQL LIKE

DevFeed: [Scaling Android Search: Room @Fts4 vs SQL LIKE](<https://devfeed.tech/articles/scaling-android-search-room-fts4-vs-sql-like-84568.md>)

Original publisher: [Read original article](<https://proandroiddev.com/scaling-android-search-room-fts4-vs-sql-like-b2a8232cbd12?source=rss----c72404660798---4>)

Author: Oğuzhan Aslan

Published: 2026-10-10T17:27:22Z

Content type: tutorial

Language: en

Sources: [ProAndroidDev](<https://devfeed.tech/sources/proandroiddev-medium.md>)

Topics: [SQLite](<https://devfeed.tech/topics/sqlite.md>), [Android](<https://devfeed.tech/topics/android.md>), [SQL](<https://devfeed.tech/topics/sql.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-development](<https://devfeed.tech/tags/android-development.md>), [benchmarks](<https://devfeed.tech/tags/benchmarks.md>), [full-text-search](<https://devfeed.tech/tags/full-text-search.md>), [indexing](<https://devfeed.tech/tags/indexing.md>), [programming](<https://devfeed.tech/tags/programming.md>), [room](<https://devfeed.tech/tags/room.md>), [software-development](<https://devfeed.tech/tags/software-development.md>), [software-engineering](<https://devfeed.tech/tags/software-engineering.md>)

## AI overview

The tutorial compares SQL LIKE substring searches with SQLite FTS4 token searches in Android Room. It demonstrates external-content FTS entities, index synchronization, DAO queries, and token-prefix matching. Its reported benchmark at 5,000 emails shows FTS4 taking 6.811 ms versus 63.762 ms for LIKE, while discussing differences in search behavior and indexing overhead.

## Source excerpt

A practical deep-dive into full-text search indexing, inverted indices, and microsecond query benchmarks using Android Jetpack Room. When building search into an Android application -- whether querying an offline-first inbox, notes catalog, documentation cache, or e-commerce catalog -- almost every developer starts with the same query: SELECT * FROM mails WHERE subject LIKE '%' || :query || '%' OR body LIKE '%' || :query || '%' It is intuitive, requires zero schema alterations, and works out-of-the-box. During early development, when your local database contains 25 dummy rows, search queries return instantly. Tests pass, the UI feels snappy, and the feature gets shipped. Then reality strikes. As users accumulate months of multiline emails, notes, or cached payloads (climbing from hundreds to thousands of records), complaints begin rolling in: Keystroke lag when typing in search fields. Skipped frames and main-thread micro-stutters. Noticeable battery drain during heavy search workflows. Why does an operation that felt blazing fast in development fall apart under real-world volume? To understand this, we have to look under the hood of SQLite's query planner. Why SQL LIKE Fails at Scale In relational databases, developers rely on indices (B-Trees) to keep lookups at O(log N) time. If you query: WHERE sender LIKE 'alice%' SQLite can utilize a standard B-Tree index on sender because it knows the prefix. However, users rarely search by prefix alone. Real-world full-text search requires substring matching: finding a word anywhere within a subject or paragraph. This forces the query into a leading wildcard: WHERE body LIKE '%architecture%'WARNING: The moment a query contains a leading wildcard (%query%), standard B-Tree indices are completely bypassed. SQLite is forced to execute a sequential full table scan O(N). In a full table scan: SQLite reads every single row off the storage layer into memory. The query engine steps through every single byte of text sequentially, compa