X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 14936D1B519 for ; Tue, 1 Jun 2004 11:46:56 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 38414-10 for ; Tue, 1 Jun 2004 11:46:58 -0300 (ADT) Received: from snowwhite.lulu.com (stymie.lulu.com [66.193.5.50]) by svr1.postgresql.org (Postfix) with ESMTP id B0A33D1B467 for ; Tue, 1 Jun 2004 11:46:52 -0300 (ADT) Received: from [10.0.0.32] (meatwad.rdu.lulu.com [10.0.0.32]) (authenticated) by snowwhite.lulu.com (8.11.6/8.11.6) with ESMTP id i51Eksn02153; Tue, 1 Jun 2004 10:46:55 -0400 Message-ID: <40BC96DC.50301@lulu.com> Date: Tue, 01 Jun 2004 10:46:52 -0400 From: Bill Montgomery User-Agent: Mozilla Thunderbird 0.6 (X11/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Bhanu, Yogesh" Cc: pgsql-admin@postgresql.org Subject: Re: Database stat generation References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200406/4 X-Sequence-Number: 13664 Bhanu, Yogesh wrote: >Hello admins, > Is there any tool available inside Postgres to track what databases are being used and how . It will be nice to generate a per database stats (Inserts, Select, Drop) for a month or more and also track how the database grew big/small in the same time . > > Yogesh, First, make sure you have set stats_start_collector and stats_row_level to true. You may optionally set stats_command_string and stats_block_level to true for more stats with a correspondingly greater performance hit. Then, look at some of the pg_stat_* (and pg_statio_* if you have block level stats turned on) tables/views. A couple of the most useful tables (to me, anyhow): The pg_class view has counts of pages and tuples per relation (tables are relkind 'r', FYI). The pg_stat_database view shows the number of transactions comitted/rolled back, which is useful to track rates of usage, especially with a graphing tool like MRTG. To get the number of inserts/updates/deletes on a table, check out the pg_stat_user_tables view. For more info, check out the postgres docs on the subject: http://www.postgresql.org/docs/7.3/interactive/monitoring-stats.html Regards, Bill Montgomery