public inbox for [email protected]
help / color / mirror / Atom feedpg_stat_database view column xact_commit description should be more descriptive?
5+ messages / 4 participants
[nested] [flat]
* pg_stat_database view column xact_commit description should be more descriptive?
@ 2022-06-03 06:45 jian he <[email protected]>
2022-06-03 06:59 ` Re: pg_stat_database view column xact_commit description should be more descriptive? David G. Johnston <[email protected]>
2022-12-16 20:40 ` Re: pg_stat_database view column xact_commit description should be more descriptive? Jaime Casanova <[email protected]>
0 siblings, 2 replies; 5+ messages in thread
From: jian he @ 2022-06-03 06:45 UTC (permalink / raw)
To: [email protected]
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
> <https://www.postgresql.org/docs/current/sql-commit.html; or ROLLBACK
> <https://www.postgresql.org/docs/current/sql-rollback.html; is given. By
> default (without BEGIN), PostgreSQL executes transactions in “autocommit”
> mode, that is, each statement is executed in its own transaction 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...."
--
I recommend David Deutsch's <<The Beginning of Infinity>>
Jian
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: pg_stat_database view column xact_commit description should be more descriptive?
2022-06-03 06:45 pg_stat_database view column xact_commit description should be more descriptive? jian he <[email protected]>
@ 2022-06-03 06:59 ` David G. Johnston <[email protected]>
2022-06-03 07:31 ` Re: pg_stat_database view column xact_commit description should be more descriptive? jian he <[email protected]>
1 sibling, 1 reply; 5+ messages in thread
From: David G. Johnston @ 2022-06-03 06:59 UTC (permalink / raw)
To: jian he <[email protected]>; +Cc: [email protected] <[email protected]>
On Thursday, June 2, 2022, jian he <[email protected]> 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
>> <https://www.postgresql.org/docs/current/sql-commit.html; or ROLLBACK
>> <https://www.postgresql.org/docs/current/sql-rollback.html; is given. By
>> default (without BEGIN), PostgreSQL executes transactions in “autocommit”
>> mode, that is, each statement is executed in its own transaction 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’t matter if it’s implicit or explicit 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’d have reason to 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’m back at a computer but as you are raising
the potential issue the research seems like something that should be done
to support the suggestion. It isn’t like this will require source code
reading to discern.
David J.
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: pg_stat_database view column xact_commit description should be more descriptive?
2022-06-03 06:45 pg_stat_database view column xact_commit description should be more descriptive? jian he <[email protected]>
2022-06-03 06:59 ` Re: pg_stat_database view column xact_commit description should be more descriptive? David G. Johnston <[email protected]>
@ 2022-06-03 07:31 ` jian he <[email protected]>
0 siblings, 0 replies; 5+ messages in thread
From: jian he @ 2022-06-03 07:31 UTC (permalink / raw)
To: David G. Johnston <[email protected]>; +Cc: [email protected] <[email protected]>
Sorry.
It refers to all the transactions.
On Fri, Jun 3, 2022 at 12:30 PM David G. Johnston <
[email protected]> wrote:
>
>
> On Thursday, June 2, 2022, jian he <[email protected]> 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
>>> <https://www.postgresql.org/docs/current/sql-commit.html; or ROLLBACK
>>> <https://www.postgresql.org/docs/current/sql-rollback.html; is given. By
>>> default (without BEGIN), PostgreSQL executes transactions in “autocommit
>>> ” mode, that is, each statement is executed in its own transaction 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’t matter if it’s implicit or explicit 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’d have reason to 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’m back at a computer but as you are raising
> the potential issue the research seems like something that should be done
> to support the suggestion. It isn’t like this will require source code
> reading to discern.
>
> David J.
>
>
--
I recommend David Deutsch's <<The Beginning of Infinity>>
Jian
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: pg_stat_database view column xact_commit description should be more descriptive?
2022-06-03 06:45 pg_stat_database view column xact_commit description should be more descriptive? jian he <[email protected]>
@ 2022-12-16 20:40 ` Jaime Casanova <[email protected]>
2022-12-18 14:55 ` Re: pg_stat_database view column xact_commit description should be more descriptive? Euler Taveira <[email protected]>
1 sibling, 1 reply; 5+ messages in thread
From: Jaime Casanova @ 2022-12-16 20:40 UTC (permalink / raw)
To: jian he <[email protected]>; +Cc: [email protected]
On Fri, Jun 3, 2022 at 1:46 AM jian he <[email protected]> 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. By default (without BEGIN), PostgreSQL executes transactions in “autocommit” mode, that is, each statement is executed in its own transaction 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...."
>
Hi,
I want to hijack this thread to say that xact_commit seems to be also
counting COMMIT records received by logical replication.
Should we explain that in documentation?
What about physical replication? Are those also counted?
--
Jaime Casanova
Director de Servicios Profesionales
SYSTEMGUARDS S.A.
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: pg_stat_database view column xact_commit description should be more descriptive?
2022-06-03 06:45 pg_stat_database view column xact_commit description should be more descriptive? jian he <[email protected]>
2022-12-16 20:40 ` Re: pg_stat_database view column xact_commit description should be more descriptive? Jaime Casanova <[email protected]>
@ 2022-12-18 14:55 ` Euler Taveira <[email protected]>
0 siblings, 0 replies; 5+ messages in thread
From: Euler Taveira @ 2022-12-18 14:55 UTC (permalink / raw)
To: Jaime Casanova <[email protected]>; jian he <[email protected]>; +Cc: [email protected]
On Fri, Dec 16, 2022, at 5:40 PM, Jaime Casanova wrote:
> I want to hijack this thread to say that xact_commit seems to be also
> counting COMMIT records received by logical replication.
> Should we explain that in documentation?
Probably. I don't think adding something to pg_stat_database is appropriate.
IMO this concept should be explained in the logical replication chapter [1].
Logical replication uses transaction infrastructure to apply changes, hence,
statistics will take it into account.
> What about physical replication? Are those also counted?
No. Physical replication does not use the transaction machinery to replicate
changes. It is in a lower layer and statistics don't apply at it.
[1] https://www.postgresql.org/docs/devel/logical-replication.html
--
Euler Taveira
EDB https://www.enterprisedb.com/
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2022-12-18 14:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-06-03 06:45 pg_stat_database view column xact_commit description should be more descriptive? jian he <[email protected]>
2022-06-03 06:59 ` David G. Johnston <[email protected]>
2022-06-03 07:31 ` jian he <[email protected]>
2022-12-16 20:40 ` Jaime Casanova <[email protected]>
2022-12-18 14:55 ` Euler Taveira <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox