Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U3WmS-0005DY-Tc for pgsql-admin@arkaria.postgresql.org; Thu, 07 Feb 2013 19:05:09 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1U3WmR-0002BD-OB for pgsql-admin@arkaria.postgresql.org; Thu, 07 Feb 2013 19:05:07 +0000 Received: from magus.postgresql.org ([87.238.57.229]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U3WmQ-0002A9-PI for pgsql-admin@postgresql.org; Thu, 07 Feb 2013 19:05:06 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U3WmN-00071X-S7 for pgsql-admin@postgresql.org; Thu, 07 Feb 2013 19:05:06 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id r17J50pJ017451; Thu, 7 Feb 2013 14:05:00 -0500 (EST) From: Tom Lane To: =?utf-8?q?Milos_Gajdos?= cc: pgsql-admin@postgresql.org Subject: Re: =?utf-8?q?Postgres_9=2E1_statistics_in_pg=5Fstat=5Fdatabase?= In-reply-to: <20130207191641.149E5128@centrum.cz> References: <20130207191641.149E5128@centrum.cz> Comments: In-reply-to =?utf-8?q?Milos_Gajdos?= message dated "Thu, 07 Feb 2013 19:16:41 +0100" Date: Thu, 07 Feb 2013 14:05:00 -0500 Message-ID: <17450.1360263900@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org =?utf-8?q?Milos_Gajdos?= writes: > What this shows is that xact_commit increases by 3 after just one row insert. tup_inserted does seem to report correct value. After simple SELECT, xact_commit increases by 2 - kind of strange as SELECT shouldn't really be increasing xact_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 -- Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin