Re: BUG #19103: Canceled INSERT statement can still influence the performance of subsequent SELECT statement

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: "jinhui(dot)lai(at)qq(dot)com" <jinhui(dot)lai(at)qq(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #19103: Canceled INSERT statement can still influence the performance of subsequent SELECT statement
Date: 2025-11-04 14:55:28
Message-ID: 517270.1762268128@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> On Tuesday, November 4, 2025, PG Bug reporting form <noreply(at)postgresql(dot)org>
> wrote:
>> Thanks for reading my report. Here, I find a performance issue. I have
>> found a performance issue where a canceled INSERT statement appears to
>> negatively impact the performance of subsequent SELECT queries.

> This doesn’t feel like a bug.

It is not. The reason ROLLBACK is essentially free in Postgres
is that some of the ensuing cleanup work gets done during
subsequent table accesses. Some other DBMSes do that differently,
but that's our choice and we're not likely to revisit it.

> Temporary tables are nice for this kind of flow. Don’t touch production
> tables until you know what you are going to insert is going to stick.

Yeah. Frequently rolling back large data modifications is a
performance anti-pattern no matter what the underlying implementation
does.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Jeff Davis 2025-11-04 18:14:08 ALTER TABLE ... ADD COLUMN ... DEFAULT with volatile function loses DML
Previous Message Andrei Lepikhov 2025-11-04 13:43:05 Re: BUG #19102: Assertion failure in generate_orderedappend_paths with aggregate pushdown