PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/htup_details.h"
#include "access/xlog.h"
#include "catalog/pg_authid.h"
#include "catalog/pg_type.h"
#include "common/ip.h"
#include "funcapi.h"
#include "miscadmin.h"
#include "pgstat.h"
#include "postmaster/bgworker_internals.h"
#include "postmaster/postmaster.h"
#include "storage/proc.h"
#include "storage/procarray.h"
#include "utils/acl.h"
#include "utils/builtins.h"
#include "utils/inet.h"
#include "utils/timestamp.h"
Go to the source code of this file.
Macros | |
#define | UINT32_ACCESS_ONCE(var) ((uint32)(*((volatile uint32 *)&(var)))) |
#define | HAS_PGSTAT_PERMISSIONS(role) (is_member_of_role(GetUserId(), DEFAULT_ROLE_READ_ALL_STATS) || has_privs_of_role(GetUserId(), role)) |
#define | PG_STAT_GET_PROGRESS_COLS PGSTAT_NUM_PROGRESS_PARAM + 3 |
#define | PG_STAT_GET_ACTIVITY_COLS 30 |
#define | PG_STAT_GET_WAL_COLS 5 |
#define | PG_STAT_GET_SLRU_COLS 9 |
#define | PG_STAT_GET_REPLICATION_SLOT_COLS 8 |
Variables | |
PgStat_MsgBgWriter | bgwriterStats |
#define HAS_PGSTAT_PERMISSIONS | ( | role | ) | (is_member_of_role(GetUserId(), DEFAULT_ROLE_READ_ALL_STATS) || has_privs_of_role(GetUserId(), role)) |
Definition at line 36 of file pgstatfuncs.c.
Referenced by pg_stat_get_activity(), pg_stat_get_backend_activity(), pg_stat_get_backend_activity_start(), pg_stat_get_backend_client_addr(), pg_stat_get_backend_client_port(), pg_stat_get_backend_start(), pg_stat_get_backend_wait_event(), pg_stat_get_backend_wait_event_type(), pg_stat_get_backend_xact_start(), and pg_stat_get_progress_info().
#define PG_STAT_GET_ACTIVITY_COLS 30 |
Referenced by pg_stat_get_activity().
#define PG_STAT_GET_PROGRESS_COLS PGSTAT_NUM_PROGRESS_PARAM + 3 |
Referenced by pg_stat_get_progress_info().
#define PG_STAT_GET_REPLICATION_SLOT_COLS 8 |
Referenced by pg_stat_get_replication_slots().
#define PG_STAT_GET_SLRU_COLS 9 |
Referenced by pg_stat_get_slru().
#define PG_STAT_GET_WAL_COLS 5 |
Referenced by pg_stat_get_wal().
Definition at line 34 of file pgstatfuncs.c.
Referenced by pg_stat_get_activity().
Datum pg_backend_pid | ( | PG_FUNCTION_ARGS | ) |
Datum pg_stat_clear_snapshot | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2122 of file pgstatfuncs.c.
References PG_RETURN_VOID, and pgstat_clear_snapshot().
Datum pg_stat_get_activity | ( | PG_FUNCTION_ARGS | ) |
Definition at line 570 of file pgstatfuncs.c.
References SockAddr::addr, ReturnSetInfo::allowedModes, AuxiliaryPidGetProc(), B_BACKEND, B_BG_WORKER, B_WAL_SENDER, LocalPgBackendStatus::backend_xid, LocalPgBackendStatus::backend_xmin, BackendPidGetProc(), LocalPgBackendStatus::backendStatus, BoolGetDatum, clean_ipv6_addr(), CStringGetDatum, CStringGetTextDatum, DirectFunctionCall1, DirectFunctionCall3, ReturnSetInfo::econtext, ExprContext::ecxt_per_query_memory, elog, ereport, errcode(), errmsg(), ERROR, get_call_result_type(), GetBackendTypeDesc(), GetBackgroundWorkerTypeByPid(), PgBackendGSSStatus::gss_auth, PgBackendGSSStatus::gss_enc, PgBackendGSSStatus::gss_princ, HAS_PGSTAT_PERMISSIONS, i, inet_in(), Int32GetDatum, InvalidOid, IsA, lengthof, PGPROC::lockGroupLeader, MemoryContextSwitchTo(), MemSet, NI_MAXHOST, NI_MAXSERV, NI_NUMERICHOST, NI_NUMERICSERV, numeric_in(), ObjectIdGetDatum, pfree(), PG_ARGISNULL, PG_GETARG_INT32, pg_getnameinfo_all(), PG_STAT_GET_ACTIVITY_COLS, pgstat_clip_activity(), pgstat_fetch_stat_local_beentry(), pgstat_fetch_stat_numbackends(), pgstat_get_wait_event(), pgstat_get_wait_event_type(), PGPROC::pid, ReturnSetInfo::returnMode, SockAddr::salen, ReturnSetInfo::setDesc, ReturnSetInfo::setResult, SFRM_Materialize, PgBackendSSLStatus::ssl_bits, PgBackendSSLStatus::ssl_cipher, PgBackendSSLStatus::ssl_client_dn, PgBackendSSLStatus::ssl_client_serial, PgBackendSSLStatus::ssl_compression, PgBackendSSLStatus::ssl_issuer_dn, PgBackendSSLStatus::ssl_version, PgBackendStatus::st_activity_raw, PgBackendStatus::st_activity_start_timestamp, PgBackendStatus::st_appname, PgBackendStatus::st_backendType, PgBackendStatus::st_clientaddr, PgBackendStatus::st_clienthostname, PgBackendStatus::st_databaseid, PgBackendStatus::st_gss, PgBackendStatus::st_gssstatus, PgBackendStatus::st_proc_start_timestamp, PgBackendStatus::st_procpid, PgBackendStatus::st_ssl, PgBackendStatus::st_sslstatus, PgBackendStatus::st_state, PgBackendStatus::st_state_start_timestamp, PgBackendStatus::st_userid, PgBackendStatus::st_xact_start_timestamp, STATE_DISABLED, STATE_FASTPATH, STATE_IDLE, STATE_IDLEINTRANSACTION, STATE_IDLEINTRANSACTION_ABORTED, STATE_RUNNING, STATE_UNDEFINED, TimestampTzGetDatum, TransactionIdGetDatum, TransactionIdIsValid, tuplestore_begin_heap(), tuplestore_donestoring, tuplestore_putvalues(), TYPEFUNC_COMPOSITE, UINT32_ACCESS_ONCE, values, PGPROC::wait_event_info, and work_mem.
Datum pg_stat_get_analyze_count | ( | PG_FUNCTION_ARGS | ) |
Definition at line 351 of file pgstatfuncs.c.
References PgStat_StatTabEntry::analyze_count, PG_GETARG_OID, PG_RETURN_INT64, and pgstat_fetch_stat_tabentry().
Datum pg_stat_get_archiver | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2200 of file pgstatfuncs.c.
References PgStat_ArchiverStats::archived_count, BlessTupleDesc(), CreateTemplateTupleDesc(), CStringGetTextDatum, PgStat_ArchiverStats::failed_count, heap_form_tuple(), HeapTupleGetDatum, Int64GetDatum(), PgStat_ArchiverStats::last_archived_timestamp, PgStat_ArchiverStats::last_archived_wal, PgStat_ArchiverStats::last_failed_timestamp, PgStat_ArchiverStats::last_failed_wal, MemSet, PG_RETURN_DATUM, pgstat_fetch_stat_archiver(), PgStat_ArchiverStats::stat_reset_timestamp, TimestampTzGetDatum, TupleDescInitEntry(), and values.
Datum pg_stat_get_autoanalyze_count | ( | PG_FUNCTION_ARGS | ) |
Definition at line 366 of file pgstatfuncs.c.
References PgStat_StatTabEntry::autovac_analyze_count, PG_GETARG_OID, PG_RETURN_INT64, and pgstat_fetch_stat_tabentry().
Datum pg_stat_get_autovacuum_count | ( | PG_FUNCTION_ARGS | ) |
Definition at line 336 of file pgstatfuncs.c.
References PgStat_StatTabEntry::autovac_vacuum_count, PG_GETARG_OID, PG_RETURN_INT64, and pgstat_fetch_stat_tabentry().
Datum pg_stat_get_backend_activity | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1009 of file pgstatfuncs.c.
References cstring_to_text(), HAS_PGSTAT_PERMISSIONS, pfree(), PG_GETARG_INT32, PG_RETURN_TEXT_P, pgstat_clip_activity(), pgstat_fetch_stat_beentry(), PgBackendStatus::st_activity_raw, and PgBackendStatus::st_userid.
Datum pg_stat_get_backend_activity_start | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1077 of file pgstatfuncs.c.
References HAS_PGSTAT_PERMISSIONS, PG_GETARG_INT32, PG_RETURN_NULL, PG_RETURN_TIMESTAMPTZ, pgstat_fetch_stat_beentry(), PgBackendStatus::st_activity_start_timestamp, and PgBackendStatus::st_userid.
Datum pg_stat_get_backend_client_addr | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1147 of file pgstatfuncs.c.
References SockAddr::addr, clean_ipv6_addr(), CStringGetDatum, DirectFunctionCall1, HAS_PGSTAT_PERMISSIONS, inet_in(), NI_MAXHOST, NI_NUMERICHOST, NI_NUMERICSERV, PG_GETARG_INT32, pg_getnameinfo_all(), PG_RETURN_INET_P, PG_RETURN_NULL, pgstat_fetch_stat_beentry(), SockAddr::salen, PgBackendStatus::st_clientaddr, and PgBackendStatus::st_userid.
Datum pg_stat_get_backend_client_port | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1194 of file pgstatfuncs.c.
References SockAddr::addr, CStringGetDatum, DirectFunctionCall1, HAS_PGSTAT_PERMISSIONS, int4in(), NI_MAXSERV, NI_NUMERICHOST, NI_NUMERICSERV, PG_GETARG_INT32, pg_getnameinfo_all(), PG_RETURN_DATUM, PG_RETURN_INT32, PG_RETURN_NULL, pgstat_fetch_stat_beentry(), SockAddr::salen, PgBackendStatus::st_clientaddr, and PgBackendStatus::st_userid.
Datum pg_stat_get_backend_dbid | ( | PG_FUNCTION_ARGS | ) |
Definition at line 983 of file pgstatfuncs.c.
References PG_GETARG_INT32, PG_RETURN_NULL, PG_RETURN_OID, pgstat_fetch_stat_beentry(), and PgBackendStatus::st_databaseid.
Datum pg_stat_get_backend_idset | ( | PG_FUNCTION_ARGS | ) |
Definition at line 416 of file pgstatfuncs.c.
References Int32GetDatum, MemoryContextAlloc(), FuncCallContext::multi_call_memory_ctx, pgstat_fetch_stat_numbackends(), SRF_FIRSTCALL_INIT, SRF_IS_FIRSTCALL, SRF_PERCALL_SETUP, SRF_RETURN_DONE, SRF_RETURN_NEXT, and FuncCallContext::user_fctx.
Datum pg_stat_get_backend_pid | ( | PG_FUNCTION_ARGS | ) |
Definition at line 970 of file pgstatfuncs.c.
References PG_GETARG_INT32, PG_RETURN_INT32, PG_RETURN_NULL, pgstat_fetch_stat_beentry(), and PgBackendStatus::st_procpid.
Datum pg_stat_get_backend_start | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1125 of file pgstatfuncs.c.
References HAS_PGSTAT_PERMISSIONS, PG_GETARG_INT32, PG_RETURN_NULL, PG_RETURN_TIMESTAMPTZ, pgstat_fetch_stat_beentry(), PgBackendStatus::st_proc_start_timestamp, and PgBackendStatus::st_userid.
Datum pg_stat_get_backend_userid | ( | PG_FUNCTION_ARGS | ) |
Definition at line 996 of file pgstatfuncs.c.
References PG_GETARG_INT32, PG_RETURN_NULL, PG_RETURN_OID, pgstat_fetch_stat_beentry(), and PgBackendStatus::st_userid.
Datum pg_stat_get_backend_wait_event | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1055 of file pgstatfuncs.c.
References BackendPidGetProc(), cstring_to_text(), HAS_PGSTAT_PERMISSIONS, PG_GETARG_INT32, PG_RETURN_NULL, PG_RETURN_TEXT_P, pgstat_fetch_stat_beentry(), pgstat_get_wait_event(), PgBackendStatus::st_procpid, PgBackendStatus::st_userid, and PGPROC::wait_event_info.
Datum pg_stat_get_backend_wait_event_type | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1034 of file pgstatfuncs.c.
References BackendPidGetProc(), cstring_to_text(), HAS_PGSTAT_PERMISSIONS, PG_GETARG_INT32, PG_RETURN_NULL, PG_RETURN_TEXT_P, pgstat_fetch_stat_beentry(), pgstat_get_wait_event_type(), PgBackendStatus::st_procpid, PgBackendStatus::st_userid, and PGPROC::wait_event_info.
Datum pg_stat_get_backend_xact_start | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1103 of file pgstatfuncs.c.
References HAS_PGSTAT_PERMISSIONS, PG_GETARG_INT32, PG_RETURN_NULL, PG_RETURN_TIMESTAMPTZ, pgstat_fetch_stat_beentry(), PgBackendStatus::st_userid, and PgBackendStatus::st_xact_start_timestamp.
Datum pg_stat_get_bgwriter_buf_written_checkpoints | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1741 of file pgstatfuncs.c.
References PG_RETURN_INT64, and pgstat_fetch_global().
Datum pg_stat_get_bgwriter_buf_written_clean | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1747 of file pgstatfuncs.c.
References PG_RETURN_INT64, and pgstat_fetch_global().
Datum pg_stat_get_bgwriter_maxwritten_clean | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1753 of file pgstatfuncs.c.
References PG_RETURN_INT64, and pgstat_fetch_global().
Datum pg_stat_get_bgwriter_requested_checkpoints | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1735 of file pgstatfuncs.c.
References PG_RETURN_INT64, and pgstat_fetch_global().
Datum pg_stat_get_bgwriter_stat_reset_time | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1773 of file pgstatfuncs.c.
References PG_RETURN_TIMESTAMPTZ, and pgstat_fetch_global().
Datum pg_stat_get_bgwriter_timed_checkpoints | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1729 of file pgstatfuncs.c.
References PG_RETURN_INT64, and pgstat_fetch_global().
Datum pg_stat_get_blocks_fetched | ( | PG_FUNCTION_ARGS | ) |
Definition at line 218 of file pgstatfuncs.c.
References PgStat_StatTabEntry::blocks_fetched, PG_GETARG_OID, PG_RETURN_INT64, and pgstat_fetch_stat_tabentry().
Datum pg_stat_get_blocks_hit | ( | PG_FUNCTION_ARGS | ) |
Definition at line 234 of file pgstatfuncs.c.
References PgStat_StatTabEntry::blocks_hit, PG_GETARG_OID, PG_RETURN_INT64, and pgstat_fetch_stat_tabentry().
Datum pg_stat_get_buf_alloc | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1791 of file pgstatfuncs.c.
References PG_RETURN_INT64, and pgstat_fetch_global().
Datum pg_stat_get_buf_fsync_backend | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1785 of file pgstatfuncs.c.
References PG_RETURN_INT64, and pgstat_fetch_global().
Datum pg_stat_get_buf_written_backend | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1779 of file pgstatfuncs.c.
References PG_RETURN_INT64, and pgstat_fetch_global().
Datum pg_stat_get_checkpoint_sync_time | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1766 of file pgstatfuncs.c.
References PG_RETURN_FLOAT8, and pgstat_fetch_global().
Datum pg_stat_get_checkpoint_write_time | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1759 of file pgstatfuncs.c.
References PG_RETURN_FLOAT8, and pgstat_fetch_global().
Datum pg_stat_get_db_active_time | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1649 of file pgstatfuncs.c.
References PG_GETARG_OID, PG_RETURN_FLOAT8, pgstat_fetch_stat_dbentry(), and PgStat_StatDBEntry::total_active_time.
Datum pg_stat_get_db_blk_read_time | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1603 of file pgstatfuncs.c.
References PgStat_StatDBEntry::n_block_read_time, PG_GETARG_OID, PG_RETURN_FLOAT8, and pgstat_fetch_stat_dbentry().
Datum pg_stat_get_db_blk_write_time | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1619 of file pgstatfuncs.c.
References PgStat_StatDBEntry::n_block_write_time, PG_GETARG_OID, PG_RETURN_FLOAT8, and pgstat_fetch_stat_dbentry().
Datum pg_stat_get_db_blocks_fetched | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1295 of file pgstatfuncs.c.
References PgStat_StatDBEntry::n_blocks_fetched, PG_GETARG_OID, PG_RETURN_INT64, and pgstat_fetch_stat_dbentry().
Datum pg_stat_get_db_blocks_hit | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1311 of file pgstatfuncs.c.
References PgStat_StatDBEntry::n_blocks_hit, PG_GETARG_OID, PG_RETURN_INT64, and pgstat_fetch_stat_dbentry().
Datum pg_stat_get_db_checksum_failures | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1564 of file pgstatfuncs.c.
References DataChecksumsEnabled(), PgStat_StatDBEntry::n_checksum_failures, PG_GETARG_OID, PG_RETURN_INT64, PG_RETURN_NULL, and pgstat_fetch_stat_dbentry().
Datum pg_stat_get_db_checksum_last_failure | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1582 of file pgstatfuncs.c.
References DataChecksumsEnabled(), PgStat_StatDBEntry::last_checksum_failure, PG_GETARG_OID, PG_RETURN_NULL, PG_RETURN_TIMESTAMPTZ, and pgstat_fetch_stat_dbentry().
Datum pg_stat_get_db_conflict_all | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1530 of file pgstatfuncs.c.
References PgStat_StatDBEntry::n_conflict_bufferpin, PgStat_StatDBEntry::n_conflict_lock, PgStat_StatDBEntry::n_conflict_snapshot, PgStat_StatDBEntry::n_conflict_startup_deadlock, PgStat_StatDBEntry::n_conflict_tablespace, PG_GETARG_OID, PG_RETURN_INT64, and pgstat_fetch_stat_dbentry().
Datum pg_stat_get_db_conflict_bufferpin | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1500 of file pgstatfuncs.c.
References PgStat_StatDBEntry::n_conflict_bufferpin, PG_GETARG_OID, PG_RETURN_INT64, and pgstat_fetch_stat_dbentry().
Datum pg_stat_get_db_conflict_lock | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1470 of file pgstatfuncs.c.
References PgStat_StatDBEntry::n_conflict_lock, PG_GETARG_OID, PG_RETURN_INT64, and pgstat_fetch_stat_dbentry().
Datum pg_stat_get_db_conflict_snapshot | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1485 of file pgstatfuncs.c.
References PgStat_StatDBEntry::n_conflict_snapshot, PG_GETARG_OID, PG_RETURN_INT64, and pgstat_fetch_stat_dbentry().
Datum pg_stat_get_db_conflict_startup_deadlock | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1515 of file pgstatfuncs.c.
References PgStat_StatDBEntry::n_conflict_startup_deadlock, PG_GETARG_OID, PG_RETURN_INT64, and pgstat_fetch_stat_dbentry().
Datum pg_stat_get_db_conflict_tablespace | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1455 of file pgstatfuncs.c.
References PgStat_StatDBEntry::n_conflict_tablespace, PG_GETARG_OID, PG_RETURN_INT64, and pgstat_fetch_stat_dbentry().
Datum pg_stat_get_db_deadlocks | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1549 of file pgstatfuncs.c.
References PgStat_StatDBEntry::n_deadlocks, PG_GETARG_OID, PG_RETURN_INT64, and pgstat_fetch_stat_dbentry().
Datum pg_stat_get_db_idle_in_transaction_time | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1663 of file pgstatfuncs.c.
References PG_GETARG_OID, PG_RETURN_FLOAT8, pgstat_fetch_stat_dbentry(), and PgStat_StatDBEntry::total_idle_in_xact_time.
Datum pg_stat_get_db_numbackends | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1242 of file pgstatfuncs.c.
References PG_GETARG_OID, PG_RETURN_INT32, pgstat_fetch_stat_beentry(), pgstat_fetch_stat_numbackends(), and PgBackendStatus::st_databaseid.
Datum pg_stat_get_db_session_time | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1635 of file pgstatfuncs.c.
References PG_GETARG_OID, PG_RETURN_FLOAT8, pgstat_fetch_stat_dbentry(), and PgStat_StatDBEntry::total_session_time.
Datum pg_stat_get_db_sessions | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1677 of file pgstatfuncs.c.
References PgStat_StatDBEntry::n_sessions, PG_GETARG_OID, PG_RETURN_INT64, and pgstat_fetch_stat_dbentry().
Datum pg_stat_get_db_sessions_abandoned | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1690 of file pgstatfuncs.c.
References PgStat_StatDBEntry::n_sessions_abandoned, PG_GETARG_OID, PG_RETURN_INT64, and pgstat_fetch_stat_dbentry().
Datum pg_stat_get_db_sessions_fatal | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1703 of file pgstatfuncs.c.
References PgStat_StatDBEntry::n_sessions_fatal, PG_GETARG_OID, PG_RETURN_INT64, and pgstat_fetch_stat_dbentry().
Datum pg_stat_get_db_sessions_killed | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1716 of file pgstatfuncs.c.
References PgStat_StatDBEntry::n_sessions_killed, PG_GETARG_OID, PG_RETURN_INT64, and pgstat_fetch_stat_dbentry().
Datum pg_stat_get_db_stat_reset_time | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1406 of file pgstatfuncs.c.
References PG_GETARG_OID, PG_RETURN_NULL, PG_RETURN_TIMESTAMPTZ, pgstat_fetch_stat_dbentry(), and PgStat_StatDBEntry::stat_reset_timestamp.
Datum pg_stat_get_db_temp_bytes | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1440 of file pgstatfuncs.c.
References PgStat_StatDBEntry::n_temp_bytes, PG_GETARG_OID, PG_RETURN_INT64, and pgstat_fetch_stat_dbentry().
Datum pg_stat_get_db_temp_files | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1424 of file pgstatfuncs.c.
References PgStat_StatDBEntry::n_temp_files, PG_GETARG_OID, PG_RETURN_INT64, and pgstat_fetch_stat_dbentry().
Datum pg_stat_get_db_tuples_deleted | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1391 of file pgstatfuncs.c.
References PgStat_StatDBEntry::n_tuples_deleted, PG_GETARG_OID, PG_RETURN_INT64, and pgstat_fetch_stat_dbentry().
Datum pg_stat_get_db_tuples_fetched | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1343 of file pgstatfuncs.c.
References PgStat_StatDBEntry::n_tuples_fetched, PG_GETARG_OID, PG_RETURN_INT64, and pgstat_fetch_stat_dbentry().
Datum pg_stat_get_db_tuples_inserted | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1359 of file pgstatfuncs.c.
References PgStat_StatDBEntry::n_tuples_inserted, PG_GETARG_OID, PG_RETURN_INT64, and pgstat_fetch_stat_dbentry().
Datum pg_stat_get_db_tuples_returned | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1327 of file pgstatfuncs.c.
References PgStat_StatDBEntry::n_tuples_returned, PG_GETARG_OID, PG_RETURN_INT64, and pgstat_fetch_stat_dbentry().
Datum pg_stat_get_db_tuples_updated | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1375 of file pgstatfuncs.c.
References PgStat_StatDBEntry::n_tuples_updated, PG_GETARG_OID, PG_RETURN_INT64, and pgstat_fetch_stat_dbentry().
Datum pg_stat_get_db_xact_commit | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1263 of file pgstatfuncs.c.
References PgStat_StatDBEntry::n_xact_commit, PG_GETARG_OID, PG_RETURN_INT64, and pgstat_fetch_stat_dbentry().
Datum pg_stat_get_db_xact_rollback | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1279 of file pgstatfuncs.c.
References PgStat_StatDBEntry::n_xact_rollback, PG_GETARG_OID, PG_RETURN_INT64, and pgstat_fetch_stat_dbentry().
Datum pg_stat_get_dead_tuples | ( | PG_FUNCTION_ARGS | ) |
Definition at line 170 of file pgstatfuncs.c.
References PgStat_StatTabEntry::n_dead_tuples, PG_GETARG_OID, PG_RETURN_INT64, and pgstat_fetch_stat_tabentry().
Datum pg_stat_get_function_calls | ( | PG_FUNCTION_ARGS | ) |
Definition at line 381 of file pgstatfuncs.c.
References PgStat_StatFuncEntry::f_numcalls, PG_GETARG_OID, PG_RETURN_INT64, PG_RETURN_NULL, and pgstat_fetch_stat_funcentry().
Datum pg_stat_get_function_self_time | ( | PG_FUNCTION_ARGS | ) |
Definition at line 404 of file pgstatfuncs.c.
References PgStat_StatFuncEntry::f_self_time, PG_GETARG_OID, PG_RETURN_FLOAT8, PG_RETURN_NULL, and pgstat_fetch_stat_funcentry().
Datum pg_stat_get_function_total_time | ( | PG_FUNCTION_ARGS | ) |
Definition at line 392 of file pgstatfuncs.c.
References PgStat_StatFuncEntry::f_total_time, PG_GETARG_OID, PG_RETURN_FLOAT8, PG_RETURN_NULL, and pgstat_fetch_stat_funcentry().
Datum pg_stat_get_ins_since_vacuum | ( | PG_FUNCTION_ARGS | ) |
Definition at line 202 of file pgstatfuncs.c.
References PgStat_StatTabEntry::inserts_since_vacuum, PG_GETARG_OID, PG_RETURN_INT64, and pgstat_fetch_stat_tabentry().
Datum pg_stat_get_last_analyze_time | ( | PG_FUNCTION_ARGS | ) |
Definition at line 285 of file pgstatfuncs.c.
References PgStat_StatTabEntry::analyze_timestamp, PG_GETARG_OID, PG_RETURN_NULL, PG_RETURN_TIMESTAMPTZ, and pgstat_fetch_stat_tabentry().
Datum pg_stat_get_last_autoanalyze_time | ( | PG_FUNCTION_ARGS | ) |
Definition at line 303 of file pgstatfuncs.c.
References PgStat_StatTabEntry::autovac_analyze_timestamp, PG_GETARG_OID, PG_RETURN_NULL, PG_RETURN_TIMESTAMPTZ, and pgstat_fetch_stat_tabentry().
Datum pg_stat_get_last_autovacuum_time | ( | PG_FUNCTION_ARGS | ) |
Definition at line 267 of file pgstatfuncs.c.
References PgStat_StatTabEntry::autovac_vacuum_timestamp, PG_GETARG_OID, PG_RETURN_NULL, PG_RETURN_TIMESTAMPTZ, and pgstat_fetch_stat_tabentry().
Datum pg_stat_get_last_vacuum_time | ( | PG_FUNCTION_ARGS | ) |
Definition at line 249 of file pgstatfuncs.c.
References PG_GETARG_OID, PG_RETURN_NULL, PG_RETURN_TIMESTAMPTZ, pgstat_fetch_stat_tabentry(), and PgStat_StatTabEntry::vacuum_timestamp.
Datum pg_stat_get_live_tuples | ( | PG_FUNCTION_ARGS | ) |
Definition at line 154 of file pgstatfuncs.c.
References PgStat_StatTabEntry::n_live_tuples, PG_GETARG_OID, PG_RETURN_INT64, and pgstat_fetch_stat_tabentry().
Datum pg_stat_get_mod_since_analyze | ( | PG_FUNCTION_ARGS | ) |
Definition at line 186 of file pgstatfuncs.c.
References PgStat_StatTabEntry::changes_since_analyze, PG_GETARG_OID, PG_RETURN_INT64, and pgstat_fetch_stat_tabentry().
Datum pg_stat_get_numscans | ( | PG_FUNCTION_ARGS | ) |
Definition at line 42 of file pgstatfuncs.c.
References PgStat_StatTabEntry::numscans, PG_GETARG_OID, PG_RETURN_INT64, and pgstat_fetch_stat_tabentry().
Datum pg_stat_get_progress_info | ( | PG_FUNCTION_ARGS | ) |
Definition at line 459 of file pgstatfuncs.c.
References ReturnSetInfo::allowedModes, LocalPgBackendStatus::backendStatus, ReturnSetInfo::econtext, ExprContext::ecxt_per_query_memory, elog, ereport, errcode(), errmsg(), ERROR, get_call_result_type(), HAS_PGSTAT_PERMISSIONS, i, Int32GetDatum, Int64GetDatum(), IsA, MemoryContextSwitchTo(), MemSet, ObjectIdGetDatum, PG_GETARG_TEXT_PP, PG_STAT_GET_PROGRESS_COLS, pg_strcasecmp(), pgstat_fetch_stat_local_beentry(), pgstat_fetch_stat_numbackends(), PGSTAT_NUM_PROGRESS_PARAM, PROGRESS_COMMAND_ANALYZE, PROGRESS_COMMAND_BASEBACKUP, PROGRESS_COMMAND_CLUSTER, PROGRESS_COMMAND_COPY, PROGRESS_COMMAND_CREATE_INDEX, PROGRESS_COMMAND_VACUUM, ReturnSetInfo::returnMode, ReturnSetInfo::setDesc, ReturnSetInfo::setResult, SFRM_Materialize, PgBackendStatus::st_databaseid, PgBackendStatus::st_procpid, PgBackendStatus::st_progress_command, PgBackendStatus::st_progress_command_target, PgBackendStatus::st_progress_param, PgBackendStatus::st_userid, text_to_cstring(), tuplestore_begin_heap(), tuplestore_donestoring, tuplestore_putvalues(), TYPEFUNC_COMPOSITE, values, and work_mem.
Datum pg_stat_get_replication_slots | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2267 of file pgstatfuncs.c.
References ReturnSetInfo::allowedModes, cstring_to_text(), ReturnSetInfo::econtext, ExprContext::ecxt_per_query_memory, elog, ereport, errcode(), errmsg(), ERROR, get_call_result_type(), i, Int64GetDatum(), IsA, MemoryContextSwitchTo(), MemSet, PG_STAT_GET_REPLICATION_SLOT_COLS, pgstat_fetch_replslot(), PointerGetDatum, ReturnSetInfo::returnMode, ReturnSetInfo::setDesc, ReturnSetInfo::setResult, SFRM_Materialize, PgStat_ReplSlotStats::slotname, PgStat_ReplSlotStats::spill_bytes, PgStat_ReplSlotStats::spill_count, PgStat_ReplSlotStats::spill_txns, PgStat_ReplSlotStats::stat_reset_timestamp, PgStat_ReplSlotStats::stream_bytes, PgStat_ReplSlotStats::stream_count, PgStat_ReplSlotStats::stream_txns, TimestampTzGetDatum, tuplestore_begin_heap(), tuplestore_donestoring, tuplestore_putvalues(), TYPEFUNC_COMPOSITE, values, and work_mem.
Datum pg_stat_get_slru | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1853 of file pgstatfuncs.c.
References ReturnSetInfo::allowedModes, PgStat_SLRUStats::blocks_exists, PgStat_SLRUStats::blocks_hit, PgStat_SLRUStats::blocks_read, PgStat_SLRUStats::blocks_written, PgStat_SLRUStats::blocks_zeroed, cstring_to_text(), ReturnSetInfo::econtext, ExprContext::ecxt_per_query_memory, elog, ereport, errcode(), errmsg(), ERROR, PgStat_SLRUStats::flush, get_call_result_type(), i, Int64GetDatum(), IsA, MemoryContextSwitchTo(), MemSet, name, PG_STAT_GET_SLRU_COLS, pgstat_fetch_slru(), pgstat_slru_name(), PointerGetDatum, ReturnSetInfo::returnMode, ReturnSetInfo::setDesc, ReturnSetInfo::setResult, SFRM_Materialize, PgStat_SLRUStats::stat_reset_timestamp, TimestampTzGetDatum, PgStat_SLRUStats::truncate, tuplestore_begin_heap(), tuplestore_donestoring, tuplestore_putvalues(), TYPEFUNC_COMPOSITE, values, and work_mem.
Datum pg_stat_get_snapshot_timestamp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2115 of file pgstatfuncs.c.
References PG_RETURN_TIMESTAMPTZ, and pgstat_fetch_global().
Datum pg_stat_get_tuples_deleted | ( | PG_FUNCTION_ARGS | ) |
Definition at line 122 of file pgstatfuncs.c.
References PG_GETARG_OID, PG_RETURN_INT64, pgstat_fetch_stat_tabentry(), and PgStat_StatTabEntry::tuples_deleted.
Datum pg_stat_get_tuples_fetched | ( | PG_FUNCTION_ARGS | ) |
Definition at line 74 of file pgstatfuncs.c.
References PG_GETARG_OID, PG_RETURN_INT64, pgstat_fetch_stat_tabentry(), and PgStat_StatTabEntry::tuples_fetched.
Datum pg_stat_get_tuples_hot_updated | ( | PG_FUNCTION_ARGS | ) |
Definition at line 138 of file pgstatfuncs.c.
References PG_GETARG_OID, PG_RETURN_INT64, pgstat_fetch_stat_tabentry(), and PgStat_StatTabEntry::tuples_hot_updated.
Datum pg_stat_get_tuples_inserted | ( | PG_FUNCTION_ARGS | ) |
Definition at line 90 of file pgstatfuncs.c.
References PG_GETARG_OID, PG_RETURN_INT64, pgstat_fetch_stat_tabentry(), and PgStat_StatTabEntry::tuples_inserted.
Datum pg_stat_get_tuples_returned | ( | PG_FUNCTION_ARGS | ) |
Definition at line 58 of file pgstatfuncs.c.
References PG_GETARG_OID, PG_RETURN_INT64, pgstat_fetch_stat_tabentry(), and PgStat_StatTabEntry::tuples_returned.
Datum pg_stat_get_tuples_updated | ( | PG_FUNCTION_ARGS | ) |
Definition at line 106 of file pgstatfuncs.c.
References PG_GETARG_OID, PG_RETURN_INT64, pgstat_fetch_stat_tabentry(), and PgStat_StatTabEntry::tuples_updated.
Datum pg_stat_get_vacuum_count | ( | PG_FUNCTION_ARGS | ) |
Definition at line 321 of file pgstatfuncs.c.
References PG_GETARG_OID, PG_RETURN_INT64, pgstat_fetch_stat_tabentry(), and PgStat_StatTabEntry::vacuum_count.
Datum pg_stat_get_wal | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1800 of file pgstatfuncs.c.
References BlessTupleDesc(), buf, CreateTemplateTupleDesc(), CStringGetDatum, DirectFunctionCall3, heap_form_tuple(), HeapTupleGetDatum, Int32GetDatum, Int64GetDatum(), MemSet, numeric_in(), ObjectIdGetDatum, PG_RETURN_DATUM, PG_STAT_GET_WAL_COLS, pgstat_fetch_stat_wal(), snprintf, PgStat_WalStats::stat_reset_timestamp, TimestampTzGetDatum, TupleDescInitEntry(), UINT64_FORMAT, values, PgStat_WalStats::wal_buffers_full, PgStat_WalStats::wal_bytes, PgStat_WalStats::wal_fpi, and PgStat_WalStats::wal_records.
Datum pg_stat_get_xact_blocks_fetched | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2050 of file pgstatfuncs.c.
References find_tabstat_entry(), PG_GETARG_OID, PG_RETURN_INT64, PgStat_TableCounts::t_blocks_fetched, and PgStat_TableStatus::t_counts.
Datum pg_stat_get_xact_blocks_hit | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2065 of file pgstatfuncs.c.
References find_tabstat_entry(), PG_GETARG_OID, PG_RETURN_INT64, PgStat_TableCounts::t_blocks_hit, and PgStat_TableStatus::t_counts.
Datum pg_stat_get_xact_function_calls | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2080 of file pgstatfuncs.c.
References PgStat_BackendFunctionEntry::f_counts, PgStat_FunctionCounts::f_numcalls, find_funcstat_entry(), PG_GETARG_OID, PG_RETURN_INT64, and PG_RETURN_NULL.
Datum pg_stat_get_xact_function_self_time | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2102 of file pgstatfuncs.c.
References PgStat_BackendFunctionEntry::f_counts, PgStat_FunctionCounts::f_self_time, find_funcstat_entry(), INSTR_TIME_GET_MILLISEC, PG_GETARG_OID, PG_RETURN_FLOAT8, and PG_RETURN_NULL.
Datum pg_stat_get_xact_function_total_time | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2091 of file pgstatfuncs.c.
References PgStat_BackendFunctionEntry::f_counts, PgStat_FunctionCounts::f_total_time, find_funcstat_entry(), INSTR_TIME_GET_MILLISEC, PG_GETARG_OID, PG_RETURN_FLOAT8, and PG_RETURN_NULL.
Datum pg_stat_get_xact_numscans | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1927 of file pgstatfuncs.c.
References find_tabstat_entry(), PG_GETARG_OID, PG_RETURN_INT64, PgStat_TableStatus::t_counts, and PgStat_TableCounts::t_numscans.
Datum pg_stat_get_xact_tuples_deleted | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2014 of file pgstatfuncs.c.
References find_tabstat_entry(), PG_GETARG_OID, PG_RETURN_INT64, PgStat_TableStatus::t_counts, PgStat_TableCounts::t_tuples_deleted, PgStat_TableStatus::trans, trans, PgStat_TableXactStatus::tuples_deleted, and PgStat_TableXactStatus::upper.
Datum pg_stat_get_xact_tuples_fetched | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1957 of file pgstatfuncs.c.
References find_tabstat_entry(), PG_GETARG_OID, PG_RETURN_INT64, PgStat_TableStatus::t_counts, and PgStat_TableCounts::t_tuples_fetched.
Datum pg_stat_get_xact_tuples_hot_updated | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2035 of file pgstatfuncs.c.
References find_tabstat_entry(), PG_GETARG_OID, PG_RETURN_INT64, PgStat_TableStatus::t_counts, and PgStat_TableCounts::t_tuples_hot_updated.
Datum pg_stat_get_xact_tuples_inserted | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1972 of file pgstatfuncs.c.
References find_tabstat_entry(), PG_GETARG_OID, PG_RETURN_INT64, PgStat_TableStatus::t_counts, PgStat_TableCounts::t_tuples_inserted, PgStat_TableStatus::trans, trans, PgStat_TableXactStatus::tuples_inserted, and PgStat_TableXactStatus::upper.
Datum pg_stat_get_xact_tuples_returned | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1942 of file pgstatfuncs.c.
References find_tabstat_entry(), PG_GETARG_OID, PG_RETURN_INT64, PgStat_TableStatus::t_counts, and PgStat_TableCounts::t_tuples_returned.
Datum pg_stat_get_xact_tuples_updated | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1993 of file pgstatfuncs.c.
References find_tabstat_entry(), PG_GETARG_OID, PG_RETURN_INT64, PgStat_TableStatus::t_counts, PgStat_TableCounts::t_tuples_updated, PgStat_TableStatus::trans, trans, PgStat_TableXactStatus::tuples_updated, and PgStat_TableXactStatus::upper.
Datum pg_stat_reset | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2132 of file pgstatfuncs.c.
References PG_RETURN_VOID, and pgstat_reset_counters().
Datum pg_stat_reset_replication_slot | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2187 of file pgstatfuncs.c.
References PG_ARGISNULL, PG_GETARG_TEXT_PP, PG_RETURN_VOID, pgstat_reset_replslot_counter(), and text_to_cstring().
Datum pg_stat_reset_shared | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2141 of file pgstatfuncs.c.
References PG_GETARG_TEXT_PP, PG_RETURN_VOID, pgstat_reset_shared_counters(), and text_to_cstring().
Datum pg_stat_reset_single_function_counters | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2162 of file pgstatfuncs.c.
References PG_GETARG_OID, PG_RETURN_VOID, pgstat_reset_single_counter(), and RESET_FUNCTION.
Datum pg_stat_reset_single_table_counters | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2152 of file pgstatfuncs.c.
References PG_GETARG_OID, PG_RETURN_VOID, pgstat_reset_single_counter(), and RESET_TABLE.
Datum pg_stat_reset_slru | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2173 of file pgstatfuncs.c.
References PG_ARGISNULL, PG_GETARG_TEXT_PP, PG_RETURN_VOID, pgstat_reset_slru_counter(), and text_to_cstring().
PgStat_MsgBgWriter bgwriterStats |