All rules Rule BV023
note
hosted, paid — --remote

UNLOGGED table holding data that cannot survive a crash

Note — this works and blocks nothing, but a performance regression is likely.

What it catches

Unlogged tables skip WAL: writes are faster, but the table is truncated to empty on crash recovery and its contents never reach physical replicas. This will work — until the first failover or crash quietly empties it.

Fires on

CREATE UNLOGGED TABLE session_cache (id bigint PRIMARY KEY);

Do this instead

Default to a regular (logged) table — it survives crashes and reaches replicas. Keep UNLOGGED only for data you can rebuild from scratch without notice, and treat it as a cache: never the only copy, never referenced by logged data you cannot repair.

CREATE TABLE session_cache (
  id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
  payload jsonb
);
-- keep UNLOGGED only for data that is rebuildable at any moment
Catch this before it ships

This rule runs in the hosted service on Startup and above — add --remote with a team token, or use the GitHub Action: npx bolvrk check migration.sql