public inbox for [email protected]
help / color / mirror / Atom feedFrom: Tom Lane <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: Re: [Feature Request] INSERT FROZEN to Optimize Large Cold Data Imports and Migrations
Date: Thu, 13 Feb 2025 10:08:44 -0500
Message-ID: <[email protected]> (raw)
In-Reply-To: <CANtq+vS0KH9GPSjkQ65VmTcaWwPr3D+C2HNK1dN=C06xdvsL=g@mail.gmail.com>
References: <CANtq+vTuAsz9kX83rcO0-xJRN-rX2APW8kFmKO0p-JfQSsFMKA@mail.gmail.com>
<CANtq+vS0KH9GPSjkQ65VmTcaWwPr3D+C2HNK1dN=C06xdvsL=g@mail.gmail.com>
=?UTF-8?Q?S=C3=A9bastien?= <[email protected]> writes:
> Implementation details:
> - A new INSERT FROZEN option could be introduced, similar to COPY FREEZE,
> allowing direct insertion of tuples in a frozen state.
> - This would likely require changes in heap storage logic to ensure
> tuples are written with a frozen XID at insert time.
> - Consideration should be given to transaction semantics and WAL logging
> to ensure consistency and crash recovery integrity.
That last is exactly why this won't happen. A frozen tuple would be
considered committed and visible the instant it appears in the table,
thus completely breaking both atomicity and integrity of the
transaction.
There has been work going on recently to reduce the impact of freezing
massive amounts of data by spreading the work more effectively [1].
I don't say that that particular commit has completely solved the
problem, but I think that continued effort in that direction is more
likely to yield usable results than what you're suggesting.
BTW, this might or might not be usable in your particular workflow,
but: there have long been some optimizations for data load into a
table created in the same transaction. The idea there is that if the
transaction rolls back, the table will never have been visible to any
other transaction at all, so that maintaining atomicity/integrity of
its contents is moot.
regards, tom lane
[1] https://git.postgresql.org/gitweb/?p=postgresql.git&a=commitdiff&h=052026c9b
view thread (4+ messages) latest in thread
reply
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: [email protected]
Cc: [email protected], [email protected]
Subject: Re: [Feature Request] INSERT FROZEN to Optimize Large Cold Data Imports and Migrations
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox