audit-grdb-performance
Scan GRDB-backed code for performance and correctness problems that don't announce themselves — slow queries, unsafe raw SQL, and observations that quietly stop updating.
What This Command Does
Launches the grdb-performance-auditor agent. It first classifies your codebase (raw GRDB, SQLiteData, or both; queue vs pool; app-group sharing yes/no), then runs only the detectors that apply to that classification, so it doesn't report findings that can't happen in your setup.
This is the runtime-and-idioms counterpart to audit-database-schema, which covers migration safety.
What It Checks
- SQL string interpolation – raw SQL built from interpolated values instead of bound arguments, an injection vector
- Missing foreign-key indexes – SQLite doesn't index FK columns for you, and unindexed JOINs scan the child table
- Missing
PRAGMA optimize– without it the query planner reasons from no statistics, typically 2–10× slower on real user data - App-group sharing gaps – journal mode not WAL, and missing
observesSuspensionNotifications(the0xDEAD10CCproduction crash) - Prefix-redundant indexes – an index whose column list is a prefix of another, costing write time and disk
databaseSelectionas a stored property – a hard Swift 6 compile error- Legacy
Recordsubclasses – discouraged since GRDB 7, and awkward to makeSendable INSERT OR REPLACEmisused as an upsert – deletes and re-inserts, so unlisted columns reset to defaults andON DELETE CASCADEfires- Observation on a
WITHOUT ROWIDtable – SQLite's update hook never fires for these, so the observation goes silent permanently with no error WITHOUT ROWIDupsert below GRDB 7.11 – GRDB generated wrong SQL for that pairing before 7.11.0
Usage
/axiom:audit grdb-performanceRelated
- grdb-performance-auditor – The agent that powers this command
- grdb-performance – The discipline the auditor enforces, with the reasoning behind each finding
- grdb – Setup, record types, upsert, and query patterns
- grdb-app-groups – Multi-process sharing, if the auditor flags app-group findings
- audit-database-schema – Migration safety, the other half of a GRDB review