Slow Cross-Database Joins in SQLite: Diagnosis and Optimization
Understanding Performance Discrepancies in Attached Database Joins The core challenge revolves around a significant performance degradation when joining tables across two attached SQLite databases. A query joining first_db.lookups with first_db.content_index executes in 0.5 seconds, while a structurally similar query joining first_db.lookups with second_db.page_contents (residing in an attached database) takes 20 seconds or more. The problem…