pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Database stats
2+ messages / 2 participants
[nested] [flat]

* Database stats
@ 2018-12-07 16:38 Campbell, Lance <lance@illinois.edu>
  2018-12-07 16:46 ` Re: Database stats Ron <ronljohnsonjr@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Campbell, Lance @ 2018-12-07 16:38 UTC (permalink / raw)
  To: pgsql-admin

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.

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

Thanks,

Lance


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Database stats
  2018-12-07 16:38 Database stats Campbell, Lance <lance@illinois.edu>
@ 2018-12-07 16:46 ` Ron <ronljohnsonjr@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Ron @ 2018-12-07 16:46 UTC (permalink / raw)
  To: pgsql-admin@lists.postgresql.org

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.

^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2018-12-07 16:46 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-12-07 16:38 Database stats Campbell, Lance <lance@illinois.edu>
2018-12-07 16:46 ` Ron <ronljohnsonjr@gmail.com>

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