International
The Morning Dev

Only the news worth knowing

‹
 

Research

Nikolay Samokhvalov: The hidden costs of CREATE TEMP TABLE: catalog bloat and LWLock:SInvalWrite

Planet PostgreSQL ·

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

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.

How do you feel about this?

0 Comments

    Nikolay Samokhvalov: The hidden costs of CREATE TEMP TABLE: catalog bloat and LWLock:SInvalWrite – The Morning Dev