The stats collector process
This process, as the name indicates, collects statistics about the database. It's an optional process with the default value as on. The process keeps track of access to tables and indexes in both disk-block and individual row-terms. It also keeps track of record counts for tables, and tracks the vacuum and analyze actions. It's important to note that individual processes transmit new statistical counts to the collector just before going idle. As a result, many of the counters will not reflect activities of in-flight transactions.
The data gets logged in a set of tables and we can access this via a number of views provided. The views start with pg_stat
. Type the following command:
\d pg_stat
Hitting the Tab key twice will list all the views, as shown in the following command:
postgres=# \d pg_stat pg_stat_activity pg_statio_all_sequences pg_statio_user_tables pg_stat_user_functions pg_stat_all_indexes pg_statio_all_tables...