Doist Jan 27, 2026

Optimizing GRDB in Todoist for iOS

Article Summary

Todoist's iOS app became nearly unusable for some users after migrating from Realm to GRDB. The culprit? A SQL query generating 128,136 intermediate rows from just 399 actual records.

The Todoist iOS team shares their deep-dive debugging journey after their GRDB migration caused performance complaints. This is a masterclass in performance optimization—from reproducing issues on slow devices to using Instruments, LLMs, and SQL analysis to find the root cause.

Key Takeaways

Critical Insight

Replacing GRDB's annotated LEFT JOINs with subqueries for aggregate counts eliminated the Cartesian product problem and improved performance by up to 99%.

The article includes a practical checklist of debugging techniques and GRDB-specific tips that work beyond this specific case—including the exact code transformations needed.

Recent from Doist

Related Articles