SQLite taste
# SQLite taste of an engineer who ships it to production - Use SQLite for single-node apps, CLIs, desktop and mobile apps, and edge caches before reaching for a database server. Confidence: 0.85 - Turn on WAL mode (PRAG
Works with
claude-code (compatible), claude (compatible), codex (compatible), chatgpt (compatible), gemini-cli (compatible), cursor (compatible), copilot (compatible), opencode (compatible), amp (compatible), roo (compatible), kiro (compatible), goose (compatible), junie (compatible), trae (compatible), cline (compatible), continue (compatible), antigravity (compatible), windsurf (compatible), augment (compatible), qwen-code (compatible), aider (compatible)
Content
SQLite taste of an engineer who ships it to production
- Use SQLite for single-node apps, CLIs, desktop and mobile apps, and edge caches before reaching for a database server. Confidence: 0.85
- Turn on WAL mode (
PRAGMA journal_mode = WAL) so readers never block the writer. Confidence: 0.95 - Set
PRAGMA foreign_keys = ONon every connection, since it is off by default. Confidence: 0.95 - Set a
busy_timeoutof a few seconds instead of letting writes fail immediately withSQLITE_BUSY. Confidence: 0.90 - Use
PRAGMA synchronous = NORMALwith WAL for a good balance of durability and speed. Confidence: 0.75 - Funnel all writes through a single connection or queue, and use a pool of read-only connections for reads. Confidence: 0.80
- Start write transactions with
BEGIN IMMEDIATEto avoid deadlocks when a read transaction tries to upgrade. Confidence: 0.80 - Declare tables
STRICTon new schemas so type affinity does not silently store text in integer columns. Confidence: 0.80 - Store timestamps as ISO 8601 text or Unix epoch integers consistently, and pick one convention per database. Confidence: 0.85
- Use
INTEGER PRIMARY KEYfor row ids unless you need globally unique ids, then add a separate UUID or ULID column. Confidence: 0.75 - Batch many inserts inside one transaction; thousands of autocommit inserts are slow. Confidence: 0.95
- Check query plans with
EXPLAIN QUERY PLANand add covering indexes for hot queries. Confidence: 0.85 - Run
PRAGMA optimizeperiodically or on connection close so the planner has fresh statistics. Confidence: 0.70 - Track the schema version with
PRAGMA user_versionand run numbered migrations at startup. Confidence: 0.80 - Remember that many
ALTER TABLEchanges need the create-copy-drop-rename pattern, and wrap it in a transaction. Confidence: 0.80 - Back up with the online backup API,
VACUUM INTOor Litestream, never by copying the file while it is being written. Confidence: 0.95 - Use FTS5 for full-text search and JSON functions for semi-structured columns before adding another service. Confidence: 0.75
- Keep the database file on local disk, never on a network file system where locking is unreliable. Confidence: 0.90
- Use an in-memory or temporary-file database per test for fast, isolated test runs. Confidence: 0.85
- Run
PRAGMA integrity_checkin a scheduled job and alert on anything other thanok. Confidence: 0.65
Source and license
- Source
- Prompts Chat
- Original
- f/awesome-chatgpt-prompts/prompts.csv#sqlite-taste
- License
- MIT