Room's reactive database queries are one of the most powerful features in modern Android development:
// The Room Reactive Dream @Query ( "SELECT * FROM transactions WHERE dateTimestamp >= :start" ) fun getMonthlyTransactions ( start : Long ): Flow < List < TransactionEntity >>
Enter fullscreen mode
Exit fullscreen mode
You return a Flow , collect it in your ViewModel, and whenever data in SQLite changes, your UI automatically receives the fresh list. It feels like magic.
However, when you start building rich data visualization screens—such as spending analytics, monthly category breakdowns, and yearly net worth charts—that magic can quickly turn into a database bottleneck.
During Hardening Sprint H6 ( docs/HARDENING_SPRINTS.md:H6.3 ), a performance audit of our ReportsViewModel.kt revealed that a single screen was mounting eight independent cold Flow queries against SQLite simultaneously.
Every time a single transaction was logged, SQLite's invalidation tracker triggered eight concurrent database…