Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U3W1j-0001O8-CP for pgsql-admin@arkaria.postgresql.org; Thu, 07 Feb 2013 18:16:51 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1U3W1i-0001yZ-TU for pgsql-admin@arkaria.postgresql.org; Thu, 07 Feb 2013 18:16:50 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U3W1i-0001yU-9V for pgsql-admin@postgresql.org; Thu, 07 Feb 2013 18:16:50 +0000 Received: from gmmr5.centrum.cz ([2a00:da80:0:502::4]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U3W1c-0006KE-6P for pgsql-admin@postgresql.org; Thu, 07 Feb 2013 18:16:50 +0000 Received: from mail1006.cent (unknown [10.32.3.102]) by gmmr5.centrum.cz (Postfix) with ESMTP id A26C789C for ; Thu, 7 Feb 2013 19:16:41 +0100 (CET) Received: by mail1006.cent (Postfix, from userid 33) id 958CA600001C5; Thu, 7 Feb 2013 19:16:41 +0100 (CET) To: Subject: =?utf-8?q?Postgres_9=2E1_statistics_in_pg=5Fstat=5Fdatabase?= Received: from 128.127.31.17 (X-Forwarded-For: 128.127.31.17) by mail1006.centrum.cz (centrum.cz multimail) with HTTP Date: Thu, 07 Feb 2013 19:16:41 +0100 From: =?utf-8?q?Milos_Gajdos?= X-Mailer: Centrum Email 5.3 X-Priority: 3 X-Original-From: gy2kre@centrum.cz MIME-Version: 1.0 Message-Id: <20130207191641.149E5128@centrum.cz> X-Maser: Georgo Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 I've been searching for some information about Postgres 9.1 stats which are= stored in pg_stat_database - on the web and on IRC. I found SOME informati= on for 9.2 but even that doesn't seem to be accurate. What I'm after is to = get proper transaction stats ie commits and rollbacks. Also I've no clue wh= at tup_fetched and tup_returned mean. I made a few tests on a dummy database. I created a database called statist= ics and one simple table called films in it. Inserted a few values into it = and here is what I found out: statistics=3D# select xact_commit, xact_rollback, blks_read, blks_hit,tup_r= eturned, tup_fetched, tup_inserted, tup_updated, tup_deleted from pg_stat_d= atabase where datname=3D'statistics'; xact_commit | xact_rollback | blks_read | blks_hit | tup_returned | tup_fe= tched | tup_inserted | tup_updated | tup_deleted=20 -------------+---------------+-----------+----------+--------------+-------= ------+--------------+-------------+------------- 94 | 0 | 182 | 3259 | 18345 | = 1293 | 27 | 0 | 0 (1 row) statistics=3D# INSERT INTO films VALUES ('UA509', 'Bananas', 105, '1971-04-= 13', 'Comedy', '85 minutes'); INSERT 0 1 statistics=3D# select xact_commit, xact_rollback, blks_read, blks_hit,tup_r= eturned, tup_fetched, tup_inserted, tup_updated, tup_deleted from pg_stat_d= atabase where datname=3D'statistics'; xact_commit | xact_rollback | blks_read | blks_hit | tup_returned | tup_fe= tched | tup_inserted | tup_updated | tup_deleted=20 -------------+---------------+-----------+----------+--------------+-------= ------+--------------+-------------+------------- 97 | 1 | 182 | 3261 | 18345 | = 1293 | 28 | 0 | 0 (1 row) statistics=3D# select * from films; code | title | did | date_prod | kind | len=20=20=20=20 -------+----------+-----+------------+--------+---------- UA502 | Bananas | 105 | 1971-07-13 | Comedy | 01:22:00 UA503 | BanaAAas | 106 | 1971-07-13 | Comedy | 01:26:00 UA504 | BanaAAas | 106 | 1971-07-13 | Comedy | 01:26:00 UA509 | Bananas | 105 | 1971-04-13 | Comedy | 01:25:00 (4 rows) statistics=3D# select xact_commit, xact_rollback, blks_read, blks_hit,tup_r= eturned, tup_fetched, tup_inserted, tup_updated, tup_deleted from pg_stat_d= atabase where datname=3D'statistics'; xact_commit | xact_rollback | blks_read | blks_hit | tup_returned | tup_fe= tched | tup_inserted | tup_updated | tup_deleted=20 -------------+---------------+-----------+----------+--------------+-------= ------+--------------+-------------+------------- 99 | 1 | 182 | 3262 | 18349 | = 1293 | 28 | 0 | 0 (1 row) What this shows is that xact_commit increases by 3 after just one row inser= t. tup_inserted does seem to report correct value. After simple SELECT, xac= t_commit increases by 2 - kind of strange as SELECT shouldn't really be inc= reasing xact_commit ? What I'm trying to do is to gather some reasonable da= ta which would give me an idea about how many transactions/s particular Dat= abase is doing. Could any of the gurus shed some light on this ? I take it = that tup_fetched and tup_returned are some really damn random values which = only Postgres developers understand :) Thanks in advance! --=20 Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin