About this collection
Database behavior is easiest to reason about when query shape, storage, concurrency and application semantics stay connected. These notes move between PostgreSQL internals, Rails call sites and architectural choices: why a query spills to temporary files, how full-text ranking and trigrams complement each other, what optimistic locking actually protects, and where a database transaction stops being able to guarantee delivery to another system.
Search belongs in the same collection because retrieval quality depends on data representation and operational constraints, not only ranking formulas. The curated investigations cover search, consistency, pagination pressure and database selection. The complete chronology adds TOAST compression, Arel, SQL-first tooling and Active Record behavior. Together they favor explicit trade-offs over default-driven advice: SQLite and PostgreSQL solve different deployment problems, Kafka and PostgreSQL expose different consistency boundaries, and an elegant query is still suspect until its plan and workload are understood.
Start here
- SQLite in production: the advice that survives the failure modes A failure-mode-first guide to SQLite production use: WAL, busy handling, checkpoints, durability, backups, replication, measurement, and migration pressure.
- Weighted full-text search and trigrams in PostgreSQL How tsquery, tsvector weights, ranking, and pg_trgm fit together when building search inside PostgreSQL.
- Kafka, PostgreSQL, and consistency boundaries Why Kafka and relational databases solve different consistency problems, and how to think about transactions, events, outboxes, and human error.
- PostgreSQL temp files and Rails pagination PostgreSQL temp-file warnings as a Rails query-shape problem: eager loading, row multiplication, pagination, preload, strict loading, and indexes.
- SQLite, PostgreSQL, and the smallest useful database choice How to compare SQLite and PostgreSQL for a Rails app without turning the decision into a reflexive architecture debate.
- Relational algebra, SQL, and Arel A practical bridge from selection, projection, joins, and grouping to SQL and Rails Arel query construction.
All investigations
- SQLite in production: the advice that survives the failure modes
- Rails includes, find, and eager loading
- PostgreSQL temp files and Rails pagination
- Transactional memory after the hype
- The Rails job that ran before checkout committed
- Optimistic locking for editing a CRUD app
- sqlc, iBATIS, and SQL-first data access
- PostgreSQL compression, TOAST, and LZ4 storage
- Relational algebra, SQL, and Arel
- SQLite, PostgreSQL, and the smallest useful database choice
- Weighted full-text search and trigrams in PostgreSQL
- Kafka, PostgreSQL, and consistency boundaries
Related main-site work
- EmbeddingGemma Inference Service for Rails and Kamal The model-service boundary used by the main site's semantic-search system.
- Semantic search in Rails using sqlite-vec, Kamal and Docker A main-site implementation note joining FTS5, vector search and a small inference service.
- API Redux API guidance for pagination, concurrency, caching, long-running work and webhooks.