SQLite - makstron/info GitHub Wiki

Best practices for SQLite performance

  • Read fewer rows and columns - Optimize your queries to retrieve only the necessary data. Minimize the amount of data read from the database, because excess data retrieval can impact performance.

  • Push work to SQLite engine - Perform computations, filtering, and sorting operations within the SQL queries. Using SQLite's query engine can significantly improve performance.

  • Modify the database schema - Design your database schema to help SQLite construct efficient query plans and data representations. Properly index tables and optimize table structures to enhance performance.

Configure the database for performance

  • Enable Write-Ahead Logging (WAL)
  • Relax the synchronization mode

https://developer.android.com/topic/performance/sqlite-performance-best-practices