How to see which tables are accessed in postgresql?

Asked

Viewed 1,406 times

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 more access on a given day in the database.

1 answer

1

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

This monitoring information is made available through a few dozen VIEWS system.

To VIEW calling for pg_stat_activity contains real-time information about all running processes, including the queries that are running at that time.

For example, to query the activity in the name database foobar:

SELECT * FROM pg_stat_activity WHERE datname = 'foobar'; 

Alternatively, use a log generator to gather statistics from log files generated by Postgres.

The PgBadger does this work very well, generating reports in format HTML.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.