From: Magnus Hagander Date: Sat, 25 Feb 2012 14:20:49 +0000 (+0100) Subject: Make each pg_stat_ view into it's own table in the documentation X-Git-Tag: REL9_2_BETA1~365 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=da9ed7dafdc49e6571d056d92f2ef67858d68946;p=postgresql Make each pg_stat_ view into it's own table in the documentation This makes it easier to match a column name with the description of it, and makes it possible to add more detailed documentation in the future. This patch does not add that extra documentation at this point, only the structure required for it. Modeled on the changes already done to pg_stat_activity. --- diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml index cb13c8e835..ffad77f04f 100644 --- a/doc/src/sgml/monitoring.sgml +++ b/doc/src/sgml/monitoring.sgml @@ -261,83 +261,44 @@ postgres: user database host pg_stat_bgwriterpg_stat_bgwriter - One row only, showing cluster-wide statistics from the - background writer: number of scheduled checkpoints, requested - checkpoints, buffers written by checkpoints and cleaning scans, - and the number of times the background writer stopped a cleaning scan - because it had written too many buffers. Also includes - statistics about the shared buffer pool, including buffers written - by backends (that is, not by the background writer), how many times - those backends had to execute their own fsync calls (normally the - background writer handles those even when the backend does its own - write), total buffers allocated, and time of last statistics reset. + One row only, showing cluster-wide statistics. See + for more details. pg_stat_databasepg_stat_database - One row per database, showing database OID, database name, - number of active server processes connected to that database, - number of transactions committed and rolled back in that database, - total disk blocks read, total buffer hits (i.e., block - read requests avoided by finding the block already in buffer cache), - number of rows returned, fetched, inserted, updated and deleted, the - total number of queries canceled due to conflict with recovery (on - standby servers), number and size of temporary files used, total - number of deadlocks detected, and time of last statistics reset. - + One row per database, showing database wide statistics. See + for more details. + pg_stat_database_conflictspg_stat_database_conflicts - One row per database, showing database OID, database name and - the number of queries that have been canceled in this database due to - dropped tablespaces, lock timeouts, old snapshots, pinned buffers and - deadlocks. Will only contain information on standby servers, since - conflicts do not occur on master servers. + + One row per database showing database wide statistics about + query cancels due to conflict with recovery on standby servers. + Will only contain information on standby servers, since + conflicts do not occur on master servers. + See for more details. pg_stat_replicationpg_stat_replication - One row per WAL sender process, showing process ID, - user OID, user name, application name, client's address, host name - (if available) and port number, time at which the server process began - execution, and the current WAL sender state and transaction log - location. In addition, the standby reports the last transaction log - position it received and wrote, the last position it flushed to disk, - and the last position it replayed, and this information is also - displayed here. If the standby's application names matches one of the - settings in synchronous_standby_names then the sync_priority - is shown here also, that is the order in which standbys will become - the synchronous standby. The columns detailing what exactly the connection - is doing are only visible if the user examining the view is a superuser. - The client's host name will be available only if - is set or if the user's host name - needed to be looked up during pg_hba.conf - processing. Only directly connected standbys are listed; no information - about downstream standby servers is recorded. + One row per WAL sender process, showing statistics about the + replication to this slave. See + for more details. Only directly connected standbys are listed; no + information about downstream standby servers is recorded. pg_stat_all_tablespg_stat_all_tables - For each table in the current database (including TOAST tables), - the table OID, schema and table name, number of sequential - scans initiated, number of live rows fetched by sequential - scans, number of index scans initiated (over all indexes - belonging to the table), number of live rows fetched by index - scans, numbers of row insertions, updates, and deletions, - number of row updates that were HOT (i.e., no separate index update), - numbers of live and dead rows, - the last time the table was non- @@ -376,11 +337,10 @@ postgres: user database host pg_stat_all_indexespg_stat_all_indexes - For each index in the current database, - the table and index OID, schema, table and index name, - number of index scans initiated on that index, number of - index entries returned by index scans, and number of live table rows - fetched by simple index scans using that index. + + One row for each index in the current database with information + about accesses to this specific index. + See for more details. @@ -398,13 +358,10 @@ postgres: user database host pg_statio_all_tablespg_statio_all_tables - For each table in the current database (including TOAST tables), - the table OID, schema and table name, number of disk - blocks read from that table, number of buffer hits, numbers of - disk blocks read and buffer hits in all indexes of that table, - numbers of disk blocks read and buffer hits from that table's - auxiliary TOAST table (if any), and numbers of disk blocks read - and buffer hits for the TOAST table's index. + + One row for each table in the current database (including TOAST + tables) with information about I/O on this specific table. + See for more details. @@ -422,9 +379,10 @@ postgres: user database host pg_statio_all_indexespg_statio_all_indexes - For each index in the current database, - the table and index OID, schema, table and index name, - numbers of disk blocks read and buffer hits in that index. + + One row for each index in the current database + with information about I/O on this specific index. + See for more details. @@ -442,10 +400,11 @@ postgres: user database host pg_statio_all_sequencespg_statio_all_sequences - For each sequence object in the current database, - the sequence OID, schema and sequence name, - numbers of disk blocks read and buffer hits in that sequence. - + + One row for each sequence in the current database + with information about I/O on this specific sequence. + See for more details. + @@ -463,11 +422,11 @@ postgres: user database host pg_stat_user_functionspg_stat_user_functions - For all tracked functions, function OID, schema, name, number - of calls, total time, and self time. Self time is the - amount of time spent in the function itself, total time includes the - time spent in functions it called. Time values are in milliseconds. - + + One row for each tracked function (as specified by the + parameter). See + for more details. + @@ -723,6 +682,824 @@ postgres: user database host + + The pg_stat_activity view will have one row + per server process, showing information related to each connection to + the server. + + + + pg_stat_bgwriter view + + + + + Column + Type + Description + + + + + + checkpoints_timed + bigint + Number of scheduled checkpoints + + + checkpoints_requested + bigint + Number of requested checkpoints + + + buffers_checkpoint + bigint + Number of buffers written during checkpoints + + + buffers_clean + bigint + Number of buffers written by the background writer + + + maxwritten_clean + bigint + Number of times the background writer stopped a cleaning + scan because it had written too many buffers + + + buffers_backend + bigint + Number of buffers written directly by a backend + + + buffers_backend_fsync + bigint + Number of times a backend had to execute its own fsync + call (normally the background writer handles those even when the + backend does its own write) + + + buffers_alloc + bigint + Number of buffers allocated + + + stats_reset + bigint + The last time these statistics were reset + + + +
+ + + The pg_stat_bgwriter view will always have a + single row with global data for the cluster. + + + + pg_stat_database view + + + + Column + Type + Description + + + + + + datid + oid + The oid of the database + + + datname + name + The name of the database + + + numbackends + integer + The number of backends currently connected to this database. + This is the only column in this view that returns a value for the + current state, all other columns return the accumulated values since + the last reset. + + + xact_commit + bigint + The number of transactions in this database that has committed + + + xact_rollback + bigint + The number of transactions in this database that has rolled back + + + blks_read + bigint + The number of disk blocks read in this database + + + blks_hits + bigint + The number of disk blocks read from the buffer cache + (this only includes hits in the PostgreSQL buffer cache, and not + the operating system filesystem cache) + + + tup_returned + bigint + The number of rows returned by queries in this database + + + tup_fetched + bigint + The number of rows fetched by queries in this database + + + tup_inserted + bigint + The number of rows inserted by queries in this database + + + tup_updated + bigint + The number of rows updated by queries in this database + + + tup_deleted + bigint + The number of rows deleted by queries in this database + + + conflicts + bigint + + The number of queries canceled due to conflict with recovery + (on standby servers) in this database. (See + for more details) + + + + temp_files + bigint + + The number of temporary files written by queries in the database. + All temporary files are counted, regardless of why the temporary file + was created (sorting or hash) or file size, and regardless of the + setting. + + + + temp_bytes + bigint + + The amount of data written to temporary files by queries in + the database. All temporary files are counted, regardless of why + the temporary file was created (sorting or hash) or file size, and + regardless of the setting. + + + + deadlocks + bigint + Number of deadlocks detected in the database + + + stats_reset + timestamptz + The last time the statistics were reset + + + +
+ + + The pg_stat_database view will contain one row + for each database in the cluster showing database wide statistics. + + + + pg_stat_database_conflicts view + + + + Column + Type + Description + + + + + + datid + oid + The oid of the database + + + datname + name + The name of the database + + + confl_tablespace + bigint + The number of queries that have been canceled due to + dropped tablespaces + + + confl_lock + bigint + The number of queries that have been canceled due to + lock timeouts + + + confl_snapshot + bigint + The number of queries that have been canceled due to + old snapshots + + + confl_bufferpin + bigint + The number of queries that have been canceled due to + pinned buffers + + + confl_deadlock + bigint + The number of queries that have been canceled due to + deadlocks + + + +
+ + + The pg_stat_database_conflicts view will contain + one row per database showing database wide statistics about + query cancels due to conflict with recovery on standby servers. + Will only contain information on standby servers, since + conflicts do not occur on master servers. + + + + pg_stat_replication view + + + + Column + Type + Description + + + + + + pid + integer + The process id of the WAL sender process + + + usesysid + oid + The oid of the user logged into this WAL sender process + + + usename + name + The name of the user logged into this WAL sender process + + + application_name + text + The name of the application that has initiated the connection + to the WAL sender. + + + client_addr + inet + The remote IP of the client connected to the WAL sender. + If this field is not set, it indicates that the client is + connected via a Unix socket on the server machine. + + + + client_hostname + text + + If available, the hostname of the client as reported by a + reverse lookup of client_addr. This field will + only be set when is enabled. + + + + client_port + integer + + The remote TCP port that the client is using for communication + to the , or NULL if a unix socket is used. + + + + backend_start + timestamp with time zone + + The time when this process was started, i.e. when the + client connected to the WAL sender. + + + + state + text + Current WAL sender state + + + sent_location + text + Last transaction log position sent on this connection + + + write_location + text + Last transaction log position written to disk by the slave + + + flush_location + text + Last transaction log position flushed to disk by the slave + + + replay_location + text + Last transaction log position replayed into the database on the slave + + + sync_priority + int + + The priority in the order which this slave will be picked as + the synchronous standby. + + + + sync_state + text + + The synchronous state of this slave. + + + + +
+ + + The pg_stat_replication view will contain one row + per WAL sender process, showing statistics about the replication to this + slave. Only directly connected standbys are listed; no information about + downstream standby servers is recorded. + + + + pg_stat_all_tables view + + + + Column + Type + Description + + + + + + relid + oid + The OID of the table this row + + + schemaname + name + The name of the schema that the table is in + + + relname + name + The name of the table + + + seq_scan + bigint + The number of sequential scans initiated on this table + + + seq_tup_read + bigint + The number of live rows fetch by sequential scans + + + idx_scan + bigint + The number of index scans initiated on this table + + + idx_tup_fetch + bigint + The number of live rows fetch by index scans + + + n_tup_ins + bigint + The number of rows inserted + + + n_tup_upd + bigint + The number of rows updated + + + n_tup_del + bigint + The number of rows deleted + + + n_tup_hot_upd + bigint + The number of rows HOT (i.e., no separate index update) updated + + + n_live_tup + bigint + The number of live rows + + + n_dead_tup + bigint + The number of dead rows + + + last_vacuum + timestamp with time zone + The last time the table was manually non- + + + last_autovacuum + timestamp with time zone + The last time the table was vacuumed by the autovacuum daemon + + + last_analyze + timestamp with time zone + The last time the table was manually analyzed + + + last_autoanalyze + timestamp with time zone + The last time the table was analyzed by the autovacuum daemon + + + vacuum_count + bigint + The number of times this table has been manually non- + + + autovacuum_count + bigint + The number of times this table has been vacuumed by the autovacuum daemon + + + analyze_count + bigint + The number of times this table has been manually analyzed + + + autoanalyze_count + bigint + The number of times this table has been analyzed by the autovacuum daemon + + + +
+ + + The pg_stat_all_tables view will contain + one row for each table in the current database (including TOAST + tables) with information about accesses to this specific table. The + pg_stat_user_tables and + pg_stat_sys_tables contain the same information, + but filtered to only have rows for user and system tables. + + + + pg_stat_all_indexes view + + + + Column + Type + Description + + + + + + relid + oid + The OID of the table for this index + + + indexrelid + oid + The OID of the index + + + schemaname + name + The name of the schema the index is in + + + relname + name + The name of the table for this index + + + indexrelname + name + The name of the index + + + idx_scan + bigint + Number of index scans initiated on this index + + + idx_tup_read + bigint + Number of index entries returned by scans on this index + + + idx_tup_fetch + bigint + Number of live table rows fetched by simple index scans using this index + + + +
+ + + The pg_stat_all_indexes view will contain + one row for each index in the current database + with information about accesses to this specific index. The + pg_stat_user_indexes and + pg_stat_sys_indexes contain the same information, + but filtered to only have rows for user and system indexes. + + + + pg_statio_all_tables view + + + + Column + Type + Description + + + + + + relid + oid + The OID of the table + + + schemaname + name + The name of the schema that the table is in + + + relname + name + The name of the table + + + heap_blks_read + name + Number of disk blocks read from this table + + + heap_blks_hit + name + Number of buffer hits in this table + + + idx_blks_read + name + Number of disk blocks read from all indexes on this table + + + idx_blks_hit + name + Number of buffer hits in all indexes of this table + + + toast_blks_read + name + Number of disk blocks read from this table's TOAST table (if any) + + + toast_blks_hit + name + Number of buffer hits in this table's TOAST table (if any) + + + tidx_blks_read + name + Number of disk blocks read from this table's TOAST table index (if any) + + + tidx_blks_hit + name + Number of buffer hits in this table's TOAST table index (if any) + + + +
+ + + The pg_statio_all_tables view will contain + one row for each table in the current database (including TOAST + tables) with information about I/O on this specific table. The + pg_statio_user_tables and + pg_statio_sys_tables contain the same information, + but filtered to only have rows for user and system tables. + + + + pg_statio_all_indexes view + + + + Column + Type + Description + + + + + + relid + oid + The OID of the table for this index + + + indexrelid + oid + The OID of the index + + + schemaname + name + The name of the schema the index is in + + + relname + name + The name of the table for this index + + + indexrelname + name + The name of the index + + + idx_blks_read + name + Number of disk blocks read from the index + + + idx_blks_hit + name + Number of buffer hits in the index + + + +
+ + + The pg_statio_all_indexes view will contain + one row for each index in the current database + with information about I/O on this specific index. The + pg_statio_user_indexes and + pg_statio_sys_indexes contain the same information, + but filtered to only have rows for user and system indexes. + + + + pg_statio_all_sequences view + + + + Column + Type + Description + + + + + + relid + oid + The OID of the sequence + + + schemaname + name + The name of the schema the sequence is in + + + relname + name + The name of the sequence + + + blks_read + name + Number of disk blocks read from the sequence + + + blks_hit + name + Number of buffer hits in the sequence + + + +
+ + + The pg_statio_all_indexes view will contain + one row for each sequence in the current database + with information about I/O on this specific sequence. + + + + pg_stat_user_functions view + + + + Column + Type + Description + + + + + + funcid + oid + The OID of the function + + + schemaname + name + The name of the schema the function is in + + + funcname + name + The name of the function + + + calls + bigint + Number of times the function has been called + + + total_time + bigint + Total time spent in this functions and all other functions + called by it, in milliseconds. + + + self_time + bigint + Total time spent in this functions itself but not including + other functions called by it, in milliseconds. + + + +
+ + + The pg_stat_user_functions view will contain + one row for each tracked function (as specified by the + parameter). + + Statistics Access Functions