"=?utf-8?B?56ug5pmo5pum?=" <zhangche...@halodbtech.com> writes: > Recently I noticed a performance issue on temporary relation. The issue will > happened on > ON COMMIT DELETE temporary relations. If one session only create a few > temporary relations, > well, it's fine. But if one session creates plenty of ON COMMIT DELETE kind > temporary relations, > say 3,000, it will face a significant performance degradation issue.
Do you think that's supposed to be free? > To overcome this issue, A new list named in_use has been introduced to record > the actually > accessed temporary relations, and then will do the truncate only on the > actually accessed > temporary relations. And it seems works well. I do not think this is something we ought to consider. It might help certain corner use-cases, but it's probably a net loss for most. In particular, I don't think that creating thousands of temp tables in a session but then touching only a few of them in any one transaction is a very plausible usage pattern. regards, tom lane