From: Tom Lane <tgl@sss.pgh.pa.us>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: jinhui.lai@qq.com <jinhui.lai@qq.com>
Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: Re: BUG #19103: Canceled INSERT statement can still influence the performance of subsequent SELECT statement
Date: Tue, 04 Nov 2025 09:55:28 -0500
Message-ID: <517270.1762268128@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKFQuwYNv6cGvMaXUp_Sh=Svc2KhekE39-FkCxNKXdZzHoYmYA@mail.gmail.com>
References: <19103-0e4f007453331d2b@postgresql.org>
<CAKFQuwYNv6cGvMaXUp_Sh=Svc2KhekE39-FkCxNKXdZzHoYmYA@mail.gmail.com>
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Tuesday, November 4, 2025, PG Bug reporting form <noreply@postgresql.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, david.g.johnston@gmail.com, jinhui.lai@qq.com, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #19103: Canceled INSERT statement can still influence the performance of subsequent SELECT statement
In-Reply-To: <517270.1762268128@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox