How to see which tables are accessed in postgreSQL?

3

How to view the tables being accessed by the select command?

EX: select *from pg_stats

I would like to get the tables that are having the most access on a given day in the database.

    
asked by anonymous 21.08.2018 / 16:45

1 answer

1

Internally, PostgreSQL has a subsystem (Known as Statistics Collector in>>) responsible for monitoring all activities that are performed by the server.

This monitoring information is made available through a few tens % system%. "

A% of% called VIEWS contains real-time information about all running processes, including queries that are currently running.

For example, to query the activity in the database named VIEW :

SELECT * FROM pg_stat_activity WHERE datname = 'foobar'; 

Another alternative is to use a log analyzer to collect statistics from log files generated by Postgres.

The pg_stat_activity makes this work very well, generating reports in foobar format.

    
25.08.2018 / 23:16