Re: Performance issue on temporary relations

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: 章晨曦 <zhangchenxi(at)halodbtech(dot)com>
Cc: David G(dot) Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Performance issue on temporary relations
Date: 2025-08-19 16:44:06
Message-ID: 590159.1755621846@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"=?utf-8?B?56ug5pmo5pum?=" <zhangchenxi(at)halodbtech(dot)com> writes:
> I agree the application is not well designed for PostgreSQL because it was migrated
> from Oracle, and may not do such optimization. But back to this issue, even though
> we only create 10 temporary relations, it will cause 10 truncates on every transaction.
> Is that a good design?

[ shrug... ] If you create an ON COMMIT DELETE temp table, you
are explicitly asking for a truncation to happen at every commit.
I don't think you have much room to beef about the fact that one
happens.

Maybe you could merge some of these tables (adding an additional
key column, probably) so that a single truncate suffices for all?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2025-08-19 16:47:34 RFC: extensible planner state
Previous Message postgres 2025-08-19 16:23:07 Adjusting my IDE expectations for a C extension development