pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-admin@lists.postgresql.org
Subject: Re: Database stats
Date: Fri, 7 Dec 2018 10:46:15 -0600
Message-ID: <998701ae-f141-66c0-cda9-f7f20306309d@gmail.com> (raw)
In-Reply-To: <1B1BD261-2B29-4B3A-84CA-4C57C125B712@illinois.edu>
References: <1B1BD261-2B29-4B3A-84CA-4C57C125B712@illinois.edu>

On 12/07/2018 10:38 AM, Campbell, Lance wrote:
>
> PostgreSQL 10.X
>
> Is there a query we can run to answer the following questions:
>
>  1. How many SQL commands have been executed in the last 24 hours?
>  2. How many insert SQL commands have been executed in the last 24 hours?
>  3. How many update SQL commands have been executed in the last 24 hours?
>
> OR
>
> Instead of 2 or 3 maybe how many row updates have occurred in the last 24 
> hours?
>
> OR
>
> Something that gives me an idea of rows reads and written.  Or rows read, 
> written and created in 24 hours.
>

Look in pg_stat_all_tables.  It keeps a running count since the cluster was 
started, but if you capture a snapshot every X hours then you should be able 
to approximate what you want.

https://www.postgresql.org/docs/9.6/monitoring-stats.html#PG-STAT-ALL-TABLES-VIEW

> There might be other ways to get to general levels of usage base on a date 
> or date range.
>
> Thanks,
>
> Lance
>

-- 
Angular momentum makes the world go 'round.

view thread (2+ messages)

Message-ID: <998701ae-f141-66c0-cda9-f7f20306309d@gmail.com>
Permalink:  ../998701ae-f141-66c0-cda9-f7f20306309d@gmail.com/
Also on:    postgresql.org/message-id/998701ae-f141-66c0-cda9-f7f20306309d@gmail.com

 · 

reply

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: ronljohnsonjr@gmail.com
  Subject: Re: Database stats
  In-Reply-To: <998701ae-f141-66c0-cda9-f7f20306309d@gmail.com>
  References: <1B1BD261-2B29-4B3A-84CA-4C57C125B712@illinois.edu> <998701ae-f141-66c0-cda9-f7f20306309d@gmail.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