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 1nx1mT-0004El-35 for pgsql-docs@arkaria.postgresql.org; Fri, 03 Jun 2022 07:31:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nx1mQ-0002Sp-I9 for pgsql-docs@arkaria.postgresql.org; Fri, 03 Jun 2022 07:31:34 +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 1nx1mQ-0002Sg-4r for pgsql-docs@lists.postgresql.org; Fri, 03 Jun 2022 07:31:34 +0000 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nx1mN-0005Av-Dt for pgsql-docs@lists.postgresql.org; Fri, 03 Jun 2022 07:31:33 +0000 Received: by mail-lf1-x133.google.com with SMTP id y32so11299321lfa.6 for ; Fri, 03 Jun 2022 00:31:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6mAAZLPg02B9ebVcRJE6zTgf9EXYJUnobbDphAQegtk=; b=PKDtSzJkwGsuDLaiXHQ/JkMJEyQkdqY0xkemUEUgLAPrArgYSsz9Ov/voVtrptnNMd YLkDZHcrNFaaJYICbXX4h+lFJdcYPz8bJ0LyEyCz0c4soS/qn5j5bUOH1L6u7lUb2fGF tdX0VP1AXfjV7Sz/nOyJjWJraWz0DiogsSyfxCvCBw7ChAVpBiTuchQOtKFzKWjbHTGg Bo5WaLeJXWmAf6yZRr86kfYQ5DMRRy2QY+sy7sd7dy/P6m+48924IpduHV8NGyL17K3C 4zkBEbSaMw5+ZM/PB49J2xFi2H3LYk0beuW9mz1usyIJ4te8nU21gzuftnplUudilTaM +pfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6mAAZLPg02B9ebVcRJE6zTgf9EXYJUnobbDphAQegtk=; b=rbDfpwxEk65Epk1AwNcyzPeNuScjCi3q7KW8V9NjHn2YnWaW4CNGGXnRSVFTQq6F3Z l1hioZos1v3JblC4i+73d5nQbcCt9uGiGzw+IfzbdcgFWIRCaPa+D2IkD2TR94VJoGH6 hYbf+OsS5ArrK5FoL/EnT8FYYOOcMmCpvEy8lnFhMh0IKe/+LPzuvkolk8ViWU6tgzMr EtnZd58HI36iwmqH9SeV1HLW9LL3Hg+ZeQMydsIYCOSZjECTrfptLUATUwegqFPeKD5E eylHHRpOqRlOUILpcwVp2kbTJhckFbBBM4eCO12DKxmf7mRhUWNDMeeWIJradgWeueHN DDgg== X-Gm-Message-State: AOAM532d8N+xNbh+hTa6tX3tmU+IU6T2PbVcAkic0wtyKM3NtWljYxwN wUOuBCCWmrJVlHUSPFztM8qbekRFu7jH9/SJFvE= X-Google-Smtp-Source: ABdhPJyzQmhtBmfet1DmqHbzfXLWlLZ6unLoz4twWW6J8ArA00l7mNgvfzYGAPWCJ4jToXf9j4YFHBTMrAbI8InR6QE= X-Received: by 2002:a05:6512:2027:b0:479:16dc:8911 with SMTP id s7-20020a056512202700b0047916dc8911mr2298021lfs.502.1654241489783; Fri, 03 Jun 2022 00:31:29 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: jian he Date: Fri, 3 Jun 2022 13:01:18 +0530 Message-ID: Subject: Re: pg_stat_database view column xact_commit description should be more descriptive? To: "David G. Johnston" Cc: "pgsql-docs@lists.postgresql.org" Content-Type: multipart/alternative; boundary="0000000000005f119705e0861cfc" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000005f119705e0861cfc Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sorry. It refers to all the transactions. On Fri, Jun 3, 2022 at 12:30 PM David G. Johnston < david.g.johnston@gmail.com> wrote: > > > On Thursday, June 2, 2022, jian he wrote: > >> >> >> https://www.postgresql.org/docs/current/monitoring-stats.html#MONITORING= -PG-STAT-DATABASE-VIEW >> >>> xact_commit bigint >>> >>> Number of transactions in this database that have been committed >>> >> In https://www.postgresql.org/docs/current/sql-begin.html >> >> BEGIN initiates a transaction block, that is, all statements after a >>> BEGIN command will be executed in a single transaction until an >>> explicit COMMIT >>> or ROLLBACK >>> is given. B= y >>> default (without BEGIN), PostgreSQL executes transactions in =E2=80=9Ca= utocommit >>> =E2=80=9D mode, that is, each statement is executed in its own transact= ion and >>> a commit is implicitly performed at the end of the statement (if >>> execution was successful, otherwise a rollback is done). >>> >> >> I guess the pg_stat_database view column *xact_commit *refers to >> 'non-autocommit' transactions? >> If so, should we say something like "Number of autocommit >> transactions...." >> > > My guess is that it doesn=E2=80=99t matter if it=E2=80=99s implicit or ex= plicit and thus > the documentation is correct and adequate. It does seem easy enough to > prove one way or the other if you think it might be incorrect and thus to > warrant a change to the docs. If it does vary I=E2=80=99d have reason t= o suspect > that a pure select query would exhibit different behavior than an insert = or > delete query - i.e., whether a new xid is issued makes a difference. > > I may experiment myself when I=E2=80=99m back at a computer but as you ar= e raising > the potential issue the research seems like something that should be done > to support the suggestion. It isn=E2=80=99t like this will require sourc= e code > reading to discern. > > David J. > > --=20 I recommend David Deutsch's <> Jian --0000000000005f119705e0861cfc Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Sorry.
It refers = to all the transactions.

On Fri, Jun 3, 2022 at 12:30 PM David G.= Johnston <david.g.johnsto= n@gmail.com> wrote:


On Thursday, June 2, 2022, jian he <jian.universality@gmail.com= > wrote:

xact_commit bigint

Number of transactions in this database that h= ave been committed

=20

BEGIN initiates a transaction block, that is, all statements a= fter a BEGIN command will be executed in a single transaction = until an explicit COMMIT or ROLLBACK is given. By default (without BEGIN), PostgreSQL executes transactions in =E2=80=9Cautocommit=E2=80=9D mode, that is, each statement is executed in its own transaction and a=20 commit is implicitly performed at the end of the statement (if execu= tion was successful, otherwise a rollback is done).

=
I guess the pg_stat_database = view column xact_commit refers to 'non-autocommit' transacti= ons?
If so, should = we say something like "Number of=C2=A0 autocommit=C2=A0 transactions...."

My guess is that it doesn=E2=80=99t matter if it=E2=80=99s implici= t or explicit and thus the documentation is correct and adequate.=C2=A0 It = does seem easy enough to prove one way or the other if you think it might b= e incorrect and thus to warrant a change to the docs. =C2=A0 If it does var= y I=E2=80=99d have reason to suspect that a pure select query would exhibit= different behavior than an insert or delete query - i.e., whether a new xi= d is issued makes a difference.

I may experiment m= yself when I=E2=80=99m back at a computer but as you are raising the potent= ial issue the research seems like something that should be done to support = the suggestion.=C2=A0 It isn=E2=80=99t like this will require source code r= eading to discern.

David J.



--
=C2=A0I recommend David Deutsch's <&= lt;The Beginning of Infinity>>

=C2=A0 Jian


=
--0000000000005f119705e0861cfc--