Re: Persistent changes in rolled-back transactions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Wael Khobalatte <wael(at)vendr(dot)com>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Wells Oliver <wells(dot)oliver(at)gmail(dot)com>, pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Persistent changes in rolled-back transactions
Date: 2022-11-10 03:42:47
Message-ID: 78833.1668051767@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Wael Khobalatte <wael(at)vendr(dot)com> writes:
>> Why do you say truncate is non-transactional? Something simple proves
>> that it's not?

> Right, I meant 'non-transactional' in the sense that "persisted changes" as
> you quoted them will also appear in the case of Truncate (MVCC-safety is
> more correct here).

Yeah, TRUNCATE will cause MVCC anomalies, in that data will disappear
although it should still be visible to other transactions running with
pre-TRUNCATE snapshots. Another thing TRUNCATE does that's not very
kosher is to skip running ON DELETE triggers. If you don't like these
things, use "DELETE FROM table" instead --- much slower, but no shortcuts.

Sequences are the same sort of animal, in that they give up some
transactional guarantees for performance reasons.

For that matter, every transaction isolation level below full
SERIALIZABLE represents a performance-vs-semantic-guarantees tradeoff.

I can't offhand think of any more examples within Postgres, but I
probably haven't thought long enough.

regards, tom lane

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Reinhard Mayer 2022-11-10 08:10:36 Re: Persistent changes in rolled-back transactions
Previous Message Erik Wienhold 2022-11-10 02:39:20 Re: Allowing users to create objects in version controlled schema