Re: equivalent thing of mtr in mysql - Mailing list pgsql-general

From Christophe Pettus
Subject Re: equivalent thing of mtr in mysql
Date
Msg-id F33AF7D9-AC7E-4E5F-8A68-F5ED95CD52A2@thebuild.com
Whole thread Raw
In response to Re: equivalent thing of mtr in mysql  (Adrian Klaver <adrian.klaver@aklaver.com>)
List pgsql-general

> On Jul 18, 2022, at 20:03, merryok <merryok@163.com> wrote:
>
> I've read the doc, and it doesn't help too much.
> Finally I've found START_CRIT_SECTION and END_CRIT_SECTION. It's like mtr.start(), mtr.commit() in mysql. May I ask
whymany places are wrapped into START_CRIT_SECTION/END_CRIT_SECTION during a single dml operation ? 

A PostgreSQL critical section is not the equivalent of MySQL InnoDB mini-transaction.

A critical section in PostgreSQL is a section of code that needs to run without interruption to avoid corruption of
internalin-memory data structures. 

PostgreSQL doesn't have a direct equivalent of a MySQL mini-transaction.  When WAL information is created by a
statement,it's stored in the WAL buffers, and then flushed to disk by the WAL writer (to a first approximation).
There'sno special operation that groups pages together for atomic writes; that's done by the underlying file system
flushoperation. 

> And if Assert(CritSectionCount > 0) isn't satisfied (CritSectionCount need't be protected ?), PG server will panic
andexit ? If so, what's the probability of that ? 

If it occurs, it indicates a bug in PostgreSQL.  It is *extremely* infrequent (as in, you can go years without seeing
one;I can't remember the last time I did). 


pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Getting the table ID
Next
From: Meera Nair
Date:
Subject: pg_dump is filling C: drive up to 100 percent