Re: Performance issue on temporary relations - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Performance issue on temporary relations
Date
Msg-id 582768.1755617751@sss.pgh.pa.us
Whole thread Raw
In response to Performance issue on temporary relations  ("章晨曦" <zhangchenxi@halodbtech.com>)
Responses Re: Performance issue on temporary relations
List pgsql-hackers
"=?utf-8?B?56ug5pmo5pum?=" <zhangchenxi@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



pgsql-hackers by date:

Previous
From: "章晨曦"
Date:
Subject: Performance issue on temporary relations
Next
From: Fujii Masao
Date:
Subject: Re: Standardize LSN-based filename