Re: Postgres 9.1 statistics in pg_stat_database - Mailing list pgsql-admin

From Tom Lane
Subject Re: Postgres 9.1 statistics in pg_stat_database
Date
Msg-id 17450.1360263900@sss.pgh.pa.us
Whole thread Raw
In response to Postgres 9.1 statistics in pg_stat_database  (Milos Gajdos <gy2kre@centrum.cz>)
Responses Re: Postgres 9.1 statistics in pg_stat_database
List pgsql-admin
=?utf-8?q?Milos_Gajdos?= <gy2kre@centrum.cz> writes:
> What this shows is that xact_commit increases by 3 after just one row insert. tup_inserted does seem to report
correctvalue. After simple SELECT, xact_commit increases by 2 - kind of strange as SELECT shouldn't really be
increasingxact_commit ? 

Yes, a SELECT does count as an xact_commit.  What I think is confusing
you is that the commit isn't reported to the stats collector right away
unless there are some database-local table access counts to send too.
And fetching from pg_stat_database doesn't result in any such accesses.
So each SELECT results in a local increment of the commit counter but
you won't see it in the stats until after you do an INSERT, or otherwise
do something that involves a countable access to a database-local table.

I do see what seems to be a bug, which is that the "Don't expend a clock
check" short-circuit at the top of pgstat_report_stat() needs to not
fire if "force" is true.  That looks like it could result in never
counting a session's last few transactions at all.  But that's not
what's affecting you here, it's the intentional optimization to delay
sending transaction counts.

            regards, tom lane



pgsql-admin by date:

Previous
From: Milos Gajdos
Date:
Subject: Postgres 9.1 statistics in pg_stat_database
Next
From: Steve Crawford
Date:
Subject: Re: Postgres 9.1 statistics in pg_stat_database