Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oDdr9-0004UK-69 for pgsql-general@arkaria.postgresql.org; Tue, 19 Jul 2022 03:25:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oDdr8-0000ps-3Y for pgsql-general@arkaria.postgresql.org; Tue, 19 Jul 2022 03:25:06 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oDdr7-0000oU-PJ for pgsql-general@lists.postgresql.org; Tue, 19 Jul 2022 03:25:05 +0000 Received: from smtp80.ord1c.emailsrvr.com ([108.166.43.80]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oDdr5-0006x1-9i for pgsql-general@lists.postgresql.org; Tue, 19 Jul 2022 03:25:04 +0000 X-Auth-ID: xof@thebuild.com Received: by smtp27.relay.ord1c.emailsrvr.com (Authenticated sender: xof-AT-thebuild.com) with ESMTPSA id 1D6E7400FD; Mon, 18 Jul 2022 23:25:00 -0400 (EDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\)) Subject: Re: equivalent thing of mtr in mysql From: Christophe Pettus In-Reply-To: Date: Mon, 18 Jul 2022 20:24:00 -0700 Cc: adrian.klaver@aklaver.com, hjp-pgsql@hjp.at, pgsql-general@lists.postgresql.org X-Mailbutler-Message-Id: 929045F3-53F1-4298-A91C-3BCD8C6EEA30 Content-Transfer-Encoding: quoted-printable Message-Id: References: <52b03573-1e24-9cde-3bcb-41ecb60906ec@aklaver.com> To: merryok X-Mailer: Apple Mail (2.3608.120.23.2.7) X-Classification-ID: d9d556d2-a674-434e-8b66-8513920bef1c-1-1 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Jul 18, 2022, at 20:03, merryok wrote: >=20 > 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 why many 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 internal in-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's no special operation that groups pages together = for atomic writes; that's done by the underlying file system flush = operation. > And if Assert(CritSectionCount > 0) isn't satisfied (CritSectionCount = need't be protected ?), PG server will panic and exit ? 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).=