Research
Nikolay Samokhvalov: The hidden costs of CREATE TEMP TABLE: catalog bloat and LWLock:SInvalWrite
The Brief
- In Postgres 18, a CTE ran 23x the TPS of a temp table per transaction in the author's benchmark.
- With 5000 idle sessions, temp-table DDL reached 127 and 249 of a 500 TPS target in two runs.
- The article examines catalog bloat and LWLock:SInvalWrite contention as costs of CREATE TEMP TABLE.
Why it matters
Temp tables created inside transactions can add significant overhead under high session counts, so teams with many connections may see lower throughput than expected.
Who’s affected
- Teams running high-concurrency Postgres workloads that create temporary tables
- Postgres 18 users with many concurrent or idle sessions
- PostgreSQL 18
- #postgresql
- #temp-tables
- #performance
- #catalog-bloat
- #lwlock
- #benchmarks
Postgres 18: a CTE ran 23x the TPS of a temp table per transaction. With 5000 idle sessions, temp-table DDL got 127 and 249 of a 500 TPS target in two runs.