pg_force_unlogged_create_table
pg_force_unlogged_create_table · force CREATE TABLE to create UNLOGGED tables
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 101058 | pg_force_unlogged_create_table | pg_force_unlogged_create_table | 1.0 | ADMIN | Unknown | C |
Usage
Sources:
pg_force_unlogged_create_table installs a utility hook that changes ordinary CREATE TABLE and CREATE TABLE AS commands into UNLOGGED table creation. It is intended for environments that deliberately prefer load speed over crash durability and replication coverage.
Core Workflow
Creating the extension executes LOAD, so the hook becomes active immediately in that session. Put the library in shared_preload_libraries and restart PostgreSQL when every new session should inherit the behavior.
The expected relpersistence is u. Explicit CREATE TEMP TABLE and CREATE UNLOGGED TABLE commands are left unchanged, and CREATE MATERIALIZED VIEW is not affected. The extension defines no SQL functions or types.
Durability Boundary
Unlogged relations are truncated after an unclean shutdown and are not written to WAL for physical replication. Indexes on an unlogged table are unlogged as well. Use this only for disposable, reconstructible data, and verify that backup, failover, logical processing, and recovery procedures do not assume these tables are durable.
Session loading affects only statements executed after the library is loaded. Dropping the extension removes its membership objects but does not convert existing unlogged tables back to logged tables; convert or recreate those relations explicitly if durability requirements change.