← Graph

Unlogged Tables

concept 5 connections

PostgreSQL table option where the write-ahead log isn't written — much faster than normal storage but wiped if the database crashes or restarts. Functionally a cache. Supported in Rails migrations since ~Rails 6. In RSpec, appending a one-liner that forces unlogged creation for all test tables shaved ~3.5 minutes off a bad test suite and ~20s off a good one with no code changes. Great for CI (fresh DB every run) but confusing on local dev — Docker restarts silently empty the tables, forcing a migration re-run.

category
pattern
about
Unlogged Tables concept
Unlogged tables used as a fast cache and test-speedup trick.
about
Unlogged Tables concept
Asks whether a connection reset wipes unlogged tables.
about
Unlogged Tables concept
Advocates using unlogged tables in tests.
recommends
Unlogged Tables concept
Recommends flipping RSpec tables to unlogged for big CI speedups.
concept Unlogged Tables
related_to
PostgreSQL tool
Unlogged tables are a Postgres feature.

Provenance

Read by
2 extractions