3 ms·
>They are way less sensitive to failing because the query optimizer decides to do things differently because table statistics have changed. Optimizer doesn't h
by ComodoHacker 7y ago
>They are way less sensitive to failing because the query optimizer decides to do things differently because table statistics have changed.
Optimizer doesn't have statistics on temp tables. It has to either gather it during query execution (which costs performance) or use some heuristical estimations (which AFAIK PostgreSQL does). These estimations could be wrong, and query plan becomes unstable.
That's why temp tables aren't used often. Another reason is complexity on app side (several query executions instead of one, transaction management, etc.)