NS Nikolay Samokhvalov Nikolay Samokhvalov Founder of Postgres.ai, working on tools for safe schema changes and query optimization in Postgres.

“I know only one case where temp tables are needed: guys migrating from Oracle really want them. Beyond that, I cannot imagine any case where I would personally use temp tables at all. Zero.”

Postgres FM · Hands-On Engineering Podcasts · November 2026

“I know only one case where temp tables are needed: guys migrating from Oracle really want them. Beyond that, I cannot imagine any case where I would personally use temp tables at all. Zero.” — Nikolay Samokhvalov, Postgres FM

Context

Benchmarks had just shown a create-a-temp-table-per-transaction workload running far slower than the CTE version. The guest said temp tables still have a place for rare batch jobs; Nikolay gives his flat rule.

Transcript

Postgres FM Around 22:41 into the episode
Nikolay Samokhvalov

…So you have 17,000 transactions in the synthetic experiment. Because, okay, you are deleting rows. If we forget about that tuples and bloat, then we just avoid extra DDL and extra broadcast through that queue. So this is like slightly better, but I wouldn't still use temporary tables at all.

Kirk Wolak

…you have to do some stuff. That's perfect. Like, do that. But don't use it as part of every search we do as our system grows and we do more. This is just going to compound on temp tables. Again, had I had to do it all over again, we would have not implemented what we did. So, and we will change it.

Nikolay Samokhvalov

I know only one case where temp tables are needed: guys migrating from Oracle really want them. Beyond that, I cannot imagine any case where I would personally use temp tables at all. Zero.

Kirk Wolak

Zero. Even if, like, for example, you're asked to do a bunch of data analysis and you have to take the data and massage it into a different structure so that you can then load it into what effectively is what management wants because it's being significantly pivoted, et cetera. And they're going to…

Nikolay Samokhvalov

Follow me. And again, YouTube guys watching us on YouTube will see it in the center of the screen right now. So imagine you have a table and you select from it, select star from this table, right? Or select, let's name this table T1. You can say select star from the table and you will see the whole…

Kirk Wolak

Select T1 from T1.

Speaker names come from our own diarization. The position is estimated from where the line sits in the episode.

More from Postgres FM