From: Bill Montgomery <billm@lulu.com>
To: Bhanu, Yogesh <yogesh@gsf.de>
Cc: pgsql-admin@postgresql.org
Subject: Re: Database stat generation
Date: Tue, 01 Jun 2004 10:46:52 -0400
Message-ID: <40BC96DC.50301@lulu.com> (raw)
In-Reply-To: <C5BFECE331DB444CAB8B246D93E286291A8B2E@sw-rz004.gsf.de>
References: <C5BFECE331DB444CAB8B246D93E286291A8B2E@sw-rz004.gsf.de>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: billm@lulu.com, yogesh@gsf.de
Subject: Re: Database stat generation
In-Reply-To: <40BC96DC.50301@lulu.com>
References: <C5BFECE331DB444CAB8B246D93E286291A8B2E@sw-rz004.gsf.de> <40BC96DC.50301@lulu.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox