PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/htup_details.h"
#include "access/xlog.h"
#include "access/xlogprefetcher.h"
#include "catalog/catalog.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 "replication/logicallauncher.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) (has_privs_of_role(GetUserId(), ROLE_PG_READ_ALL_STATS) || has_privs_of_role(GetUserId(), role)) |
#define | PG_STAT_GET_RELENTRY_INT64(stat) |
#define | PG_STAT_GET_RELENTRY_TIMESTAMPTZ(stat) |
#define | PG_STAT_GET_FUNCENTRY_FLOAT8_MS(stat) |
#define | PG_STAT_GET_PROGRESS_COLS PGSTAT_NUM_PROGRESS_PARAM + 3 |
#define | PG_STAT_GET_ACTIVITY_COLS 31 |
#define | PG_STAT_GET_SUBXACT_COLS 2 |
#define | PG_STAT_GET_DBENTRY_INT64(stat) |
#define | PG_STAT_GET_DBENTRY_FLOAT8_MS(stat) |
#define | PG_STAT_GET_WAL_COLS 9 |
#define | PG_STAT_GET_SLRU_COLS 9 |
#define | PG_STAT_GET_XACT_RELENTRY_INT64(stat) |
#define | PG_STAT_GET_XACT_FUNCENTRY_FLOAT8_MS(stat) |
#define | PG_STAT_GET_REPLICATION_SLOT_COLS 10 |
#define | PG_STAT_GET_SUBSCRIPTION_STATS_COLS 4 |
Typedefs | |
typedef enum io_stat_col | io_stat_col |
Enumerations | |
enum | io_stat_col { IO_COL_INVALID = -1 , IO_COL_BACKEND_TYPE , IO_COL_OBJECT , IO_COL_CONTEXT , IO_COL_READS , IO_COL_READ_TIME , IO_COL_WRITES , IO_COL_WRITE_TIME , IO_COL_WRITEBACKS , IO_COL_WRITEBACK_TIME , IO_COL_EXTENDS , IO_COL_EXTEND_TIME , IO_COL_CONVERSION , IO_COL_HITS , IO_COL_EVICTIONS , IO_COL_REUSES , IO_COL_FSYNCS , IO_COL_FSYNC_TIME , IO_COL_RESET_TIME , IO_NUM_COLUMNS } |
#define HAS_PGSTAT_PERMISSIONS | ( | role | ) | (has_privs_of_role(GetUserId(), ROLE_PG_READ_ALL_STATS) || has_privs_of_role(GetUserId(), role)) |
Definition at line 39 of file pgstatfuncs.c.
#define PG_STAT_GET_ACTIVITY_COLS 31 |
#define PG_STAT_GET_DBENTRY_FLOAT8_MS | ( | stat | ) |
Definition at line 1153 of file pgstatfuncs.c.
#define PG_STAT_GET_DBENTRY_INT64 | ( | stat | ) |
Definition at line 992 of file pgstatfuncs.c.
#define PG_STAT_GET_FUNCENTRY_FLOAT8_MS | ( | stat | ) |
Definition at line 157 of file pgstatfuncs.c.
#define PG_STAT_GET_PROGRESS_COLS PGSTAT_NUM_PROGRESS_PARAM + 3 |
#define PG_STAT_GET_RELENTRY_INT64 | ( | stat | ) |
Definition at line 41 of file pgstatfuncs.c.
#define PG_STAT_GET_RELENTRY_TIMESTAMPTZ | ( | stat | ) |
Definition at line 111 of file pgstatfuncs.c.
#define PG_STAT_GET_REPLICATION_SLOT_COLS 10 |
#define PG_STAT_GET_SLRU_COLS 9 |
#define PG_STAT_GET_SUBSCRIPTION_STATS_COLS 4 |
#define PG_STAT_GET_SUBXACT_COLS 2 |
#define PG_STAT_GET_WAL_COLS 9 |
#define PG_STAT_GET_XACT_FUNCENTRY_FLOAT8_MS | ( | stat | ) |
Definition at line 1677 of file pgstatfuncs.c.
#define PG_STAT_GET_XACT_RELENTRY_INT64 | ( | stat | ) |
Definition at line 1566 of file pgstatfuncs.c.
Definition at line 37 of file pgstatfuncs.c.
typedef enum io_stat_col io_stat_col |
enum io_stat_col |
Definition at line 1258 of file pgstatfuncs.c.
Datum pg_backend_pid | ( | PG_FUNCTION_ARGS | ) |
Datum pg_stat_clear_snapshot | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1712 of file pgstatfuncs.c.
References PG_RETURN_VOID, and pgstat_clear_snapshot().
Datum pg_stat_force_next_flush | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1722 of file pgstatfuncs.c.
References PG_RETURN_VOID, and pgstat_force_next_flush().
Datum pg_stat_get_activity | ( | PG_FUNCTION_ARGS | ) |
Definition at line 305 of file pgstatfuncs.c.
References SockAddr::addr, 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, GetBackendTypeDesc(), GetBackgroundWorkerTypeByPid(), GetLeaderApplyWorkerPid(), PgBackendGSSStatus::gss_auth, PgBackendGSSStatus::gss_delegation, PgBackendGSSStatus::gss_enc, PgBackendGSSStatus::gss_princ, HAS_PGSTAT_PERMISSIONS, inet_in(), InitMaterializedSRF(), Int32GetDatum(), InvalidOid, InvalidPid, PGPROC::lockGroupLeader, numeric_in(), ObjectIdGetDatum(), pfree(), PG_ARGISNULL, PG_GETARG_INT32, pg_getnameinfo_all(), PG_STAT_GET_ACTIVITY_COLS, pgstat_clip_activity(), pgstat_fetch_stat_numbackends(), pgstat_get_local_beentry_by_index(), pgstat_get_wait_event(), pgstat_get_wait_event_type(), PGPROC::pid, SockAddr::salen, ReturnSetInfo::setDesc, ReturnSetInfo::setResult, PgBackendSSLStatus::ssl_bits, PgBackendSSLStatus::ssl_cipher, PgBackendSSLStatus::ssl_client_dn, PgBackendSSLStatus::ssl_client_serial, 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_query_id, 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_putvalues(), UINT32_ACCESS_ONCE, UInt64GetDatum(), values, and PGPROC::wait_event_info.
Datum pg_stat_get_archiver | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1861 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, PG_RETURN_DATUM, pgstat_fetch_stat_archiver(), PgStat_ArchiverStats::stat_reset_timestamp, TimestampTzGetDatum(), TupleDescInitEntry(), and values.
Datum pg_stat_get_backend_activity | ( | PG_FUNCTION_ARGS | ) |
Definition at line 743 of file pgstatfuncs.c.
References cstring_to_text(), HAS_PGSTAT_PERMISSIONS, pfree(), PG_GETARG_INT32, PG_RETURN_TEXT_P, pgstat_clip_activity(), pgstat_get_beentry_by_backend_id(), PgBackendStatus::st_activity_raw, and PgBackendStatus::st_userid.
Datum pg_stat_get_backend_activity_start | ( | PG_FUNCTION_ARGS | ) |
Definition at line 811 of file pgstatfuncs.c.
References HAS_PGSTAT_PERMISSIONS, PG_GETARG_INT32, PG_RETURN_NULL, PG_RETURN_TIMESTAMPTZ, pgstat_get_beentry_by_backend_id(), PgBackendStatus::st_activity_start_timestamp, and PgBackendStatus::st_userid.
Datum pg_stat_get_backend_client_addr | ( | PG_FUNCTION_ARGS | ) |
Definition at line 881 of file pgstatfuncs.c.
References SockAddr::addr, clean_ipv6_addr(), CStringGetDatum(), DirectFunctionCall1, HAS_PGSTAT_PERMISSIONS, inet_in(), PG_GETARG_INT32, pg_getnameinfo_all(), PG_RETURN_DATUM, PG_RETURN_NULL, pgstat_get_beentry_by_backend_id(), SockAddr::salen, PgBackendStatus::st_clientaddr, and PgBackendStatus::st_userid.
Datum pg_stat_get_backend_client_port | ( | PG_FUNCTION_ARGS | ) |
Definition at line 926 of file pgstatfuncs.c.
References SockAddr::addr, CStringGetDatum(), DirectFunctionCall1, HAS_PGSTAT_PERMISSIONS, int4in(), PG_GETARG_INT32, pg_getnameinfo_all(), PG_RETURN_DATUM, PG_RETURN_INT32, PG_RETURN_NULL, pgstat_get_beentry_by_backend_id(), SockAddr::salen, PgBackendStatus::st_clientaddr, and PgBackendStatus::st_userid.
Datum pg_stat_get_backend_dbid | ( | PG_FUNCTION_ARGS | ) |
Definition at line 683 of file pgstatfuncs.c.
References PG_GETARG_INT32, PG_RETURN_NULL, PG_RETURN_OID, pgstat_get_beentry_by_backend_id(), and PgBackendStatus::st_databaseid.
Datum pg_stat_get_backend_idset | ( | PG_FUNCTION_ARGS | ) |
Definition at line 178 of file pgstatfuncs.c.
References LocalPgBackendStatus::backend_id, Int32GetDatum(), MemoryContextAlloc(), FuncCallContext::multi_call_memory_ctx, pgstat_fetch_stat_numbackends(), pgstat_get_local_beentry_by_index(), 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 670 of file pgstatfuncs.c.
References PG_GETARG_INT32, PG_RETURN_INT32, PG_RETURN_NULL, pgstat_get_beentry_by_backend_id(), and PgBackendStatus::st_procpid.
Datum pg_stat_get_backend_start | ( | PG_FUNCTION_ARGS | ) |
Definition at line 859 of file pgstatfuncs.c.
References HAS_PGSTAT_PERMISSIONS, PG_GETARG_INT32, PG_RETURN_NULL, PG_RETURN_TIMESTAMPTZ, pgstat_get_beentry_by_backend_id(), PgBackendStatus::st_proc_start_timestamp, and PgBackendStatus::st_userid.
Datum pg_stat_get_backend_subxact | ( | PG_FUNCTION_ARGS | ) |
Definition at line 708 of file pgstatfuncs.c.
References LocalPgBackendStatus::backend_subxact_count, LocalPgBackendStatus::backend_subxact_overflowed, BlessTupleDesc(), BoolGetDatum(), CreateTemplateTupleDesc(), heap_form_tuple(), HeapTupleGetDatum(), Int32GetDatum(), PG_GETARG_INT32, PG_RETURN_DATUM, PG_STAT_GET_SUBXACT_COLS, pgstat_get_local_beentry_by_backend_id(), TupleDescInitEntry(), and values.
Datum pg_stat_get_backend_userid | ( | PG_FUNCTION_ARGS | ) |
Definition at line 696 of file pgstatfuncs.c.
References PG_GETARG_INT32, PG_RETURN_NULL, PG_RETURN_OID, pgstat_get_beentry_by_backend_id(), and PgBackendStatus::st_userid.
Datum pg_stat_get_backend_wait_event | ( | PG_FUNCTION_ARGS | ) |
Definition at line 789 of file pgstatfuncs.c.
References BackendPidGetProc(), cstring_to_text(), HAS_PGSTAT_PERMISSIONS, PG_GETARG_INT32, PG_RETURN_NULL, PG_RETURN_TEXT_P, pgstat_get_beentry_by_backend_id(), 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 768 of file pgstatfuncs.c.
References BackendPidGetProc(), cstring_to_text(), HAS_PGSTAT_PERMISSIONS, PG_GETARG_INT32, PG_RETURN_NULL, PG_RETURN_TEXT_P, pgstat_get_beentry_by_backend_id(), 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 837 of file pgstatfuncs.c.
References HAS_PGSTAT_PERMISSIONS, PG_GETARG_INT32, PG_RETURN_NULL, PG_RETURN_TIMESTAMPTZ, pgstat_get_beentry_by_backend_id(), PgBackendStatus::st_userid, and PgBackendStatus::st_xact_start_timestamp.
Datum pg_stat_get_bgwriter_buf_written_checkpoints | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1197 of file pgstatfuncs.c.
References PG_RETURN_INT64, and pgstat_fetch_stat_checkpointer().
Datum pg_stat_get_bgwriter_buf_written_clean | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1203 of file pgstatfuncs.c.
References PG_RETURN_INT64, and pgstat_fetch_stat_bgwriter().
Datum pg_stat_get_bgwriter_maxwritten_clean | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1209 of file pgstatfuncs.c.
References PG_RETURN_INT64, and pgstat_fetch_stat_bgwriter().
Datum pg_stat_get_bgwriter_requested_checkpoints | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1191 of file pgstatfuncs.c.
References PG_RETURN_INT64, and pgstat_fetch_stat_checkpointer().
Datum pg_stat_get_bgwriter_stat_reset_time | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1231 of file pgstatfuncs.c.
References PG_RETURN_TIMESTAMPTZ, and pgstat_fetch_stat_bgwriter().
Datum pg_stat_get_bgwriter_timed_checkpoints | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1185 of file pgstatfuncs.c.
References PG_RETURN_INT64, and pgstat_fetch_stat_checkpointer().
Datum pg_stat_get_buf_alloc | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1249 of file pgstatfuncs.c.
References PG_RETURN_INT64, and pgstat_fetch_stat_bgwriter().
Datum pg_stat_get_buf_fsync_backend | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1243 of file pgstatfuncs.c.
References PG_RETURN_INT64, and pgstat_fetch_stat_checkpointer().
Datum pg_stat_get_buf_written_backend | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1237 of file pgstatfuncs.c.
References PG_RETURN_INT64, and pgstat_fetch_stat_checkpointer().
Datum pg_stat_get_checkpoint_sync_time | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1223 of file pgstatfuncs.c.
References PG_RETURN_FLOAT8, and pgstat_fetch_stat_checkpointer().
Datum pg_stat_get_checkpoint_write_time | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1215 of file pgstatfuncs.c.
References PG_RETURN_FLOAT8, and pgstat_fetch_stat_checkpointer().
Datum pg_stat_get_db_checksum_failures | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1114 of file pgstatfuncs.c.
References PgStat_StatDBEntry::checksum_failures, DataChecksumsEnabled(), 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 1132 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 1094 of file pgstatfuncs.c.
References PgStat_StatDBEntry::conflict_bufferpin, PgStat_StatDBEntry::conflict_lock, PgStat_StatDBEntry::conflict_logicalslot, PgStat_StatDBEntry::conflict_snapshot, PgStat_StatDBEntry::conflict_startup_deadlock, PgStat_StatDBEntry::conflict_tablespace, PG_GETARG_OID, PG_RETURN_INT64, and pgstat_fetch_stat_dbentry().
Datum pg_stat_get_db_numbackends | ( | PG_FUNCTION_ARGS | ) |
Definition at line 972 of file pgstatfuncs.c.
References LocalPgBackendStatus::backendStatus, idx(), PG_GETARG_OID, PG_RETURN_INT32, pgstat_fetch_stat_numbackends(), pgstat_get_local_beentry_by_index(), and PgBackendStatus::st_databaseid.
Datum pg_stat_get_db_stat_reset_time | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1075 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_function_calls | ( | PG_FUNCTION_ARGS | ) |
Definition at line 146 of file pgstatfuncs.c.
References PgStat_StatFuncEntry::numcalls, PG_GETARG_OID, PG_RETURN_INT64, PG_RETURN_NULL, and pgstat_fetch_stat_funcentry().
Datum pg_stat_get_io | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1347 of file pgstatfuncs.c.
References Assert(), BACKEND_NUM_TYPES, PgStat_BktypeIO::counts, CStringGetTextDatum, Float8GetDatum(), GetBackendTypeDesc(), InitMaterializedSRF(), Int64GetDatum(), IO_COL_BACKEND_TYPE, IO_COL_CONTEXT, IO_COL_CONVERSION, IO_COL_INVALID, IO_COL_OBJECT, IO_COL_RESET_TIME, IO_NUM_COLUMNS, IOCONTEXT_NUM_TYPES, IOOBJECT_NUM_TYPES, IOOP_NUM_TYPES, pg_stat_us_to_ms(), pgstat_bktype_io_stats_valid(), pgstat_fetch_stat_io(), pgstat_get_io_context_name(), pgstat_get_io_object_name(), pgstat_get_io_op_index(), pgstat_get_io_time_index(), pgstat_tracks_io_bktype(), pgstat_tracks_io_object(), pgstat_tracks_io_op(), ReturnSetInfo::setDesc, ReturnSetInfo::setResult, PgStat_IO::stat_reset_timestamp, PgStat_IO::stats, PgStat_BktypeIO::times, TimestampTzGetDatum(), tuplestore_putvalues(), and values.
Datum pg_stat_get_progress_info | ( | PG_FUNCTION_ARGS | ) |
Definition at line 229 of file pgstatfuncs.c.
References LocalPgBackendStatus::backendStatus, ereport, errcode(), errmsg(), ERROR, HAS_PGSTAT_PERMISSIONS, i, if(), InitMaterializedSRF(), Int32GetDatum(), Int64GetDatum(), ObjectIdGetDatum(), PG_GETARG_TEXT_PP, PG_STAT_GET_PROGRESS_COLS, pg_strcasecmp(), pgstat_fetch_stat_numbackends(), pgstat_get_local_beentry_by_index(), PGSTAT_NUM_PROGRESS_PARAM, PROGRESS_COMMAND_ANALYZE, PROGRESS_COMMAND_BASEBACKUP, PROGRESS_COMMAND_CLUSTER, PROGRESS_COMMAND_COPY, PROGRESS_COMMAND_CREATE_INDEX, PROGRESS_COMMAND_VACUUM, ReturnSetInfo::setDesc, ReturnSetInfo::setResult, 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_putvalues(), and values.
Datum pg_stat_get_replication_slot | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1927 of file pgstatfuncs.c.
References BlessTupleDesc(), CreateTemplateTupleDesc(), CStringGetTextDatum, heap_form_tuple(), HeapTupleGetDatum(), Int64GetDatum(), NameStr, namestrcpy(), PG_GETARG_TEXT_P, PG_RETURN_DATUM, PG_STAT_GET_REPLICATION_SLOT_COLS, pgstat_fetch_replslot(), PgStat_StatReplSlotEntry::spill_bytes, PgStat_StatReplSlotEntry::spill_count, PgStat_StatReplSlotEntry::spill_txns, PgStat_StatReplSlotEntry::stat_reset_timestamp, PgStat_StatReplSlotEntry::stream_bytes, PgStat_StatReplSlotEntry::stream_count, PgStat_StatReplSlotEntry::stream_txns, text_to_cstring(), TimestampTzGetDatum(), PgStat_StatReplSlotEntry::total_bytes, PgStat_StatReplSlotEntry::total_txns, TupleDescInitEntry(), and values.
Datum pg_stat_get_slru | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1523 of file pgstatfuncs.c.
References cstring_to_text(), i, InitMaterializedSRF(), Int64GetDatum(), name, PG_STAT_GET_SLRU_COLS, pgstat_fetch_slru(), pgstat_get_slru_name(), PointerGetDatum(), ReturnSetInfo::setDesc, ReturnSetInfo::setResult, stat, TimestampTzGetDatum(), tuplestore_putvalues(), and values.
Datum pg_stat_get_snapshot_timestamp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1697 of file pgstatfuncs.c.
References PG_RETURN_NULL, PG_RETURN_TIMESTAMPTZ, and pgstat_get_stat_snapshot_timestamp().
Datum pg_stat_get_subscription_stats | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1998 of file pgstatfuncs.c.
References PgStat_StatSubEntry::apply_error_count, BlessTupleDesc(), CreateTemplateTupleDesc(), heap_form_tuple(), HeapTupleGetDatum(), Int64GetDatum(), ObjectIdGetDatum(), PG_GETARG_OID, PG_RETURN_DATUM, PG_STAT_GET_SUBSCRIPTION_STATS_COLS, pgstat_fetch_stat_subscription(), PgStat_StatSubEntry::stat_reset_timestamp, PgStat_StatSubEntry::sync_error_count, TimestampTzGetDatum(), TupleDescInitEntry(), and values.
Datum pg_stat_get_wal | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1459 of file pgstatfuncs.c.
References BlessTupleDesc(), buf, CreateTemplateTupleDesc(), CStringGetDatum(), DirectFunctionCall3, Float8GetDatum(), heap_form_tuple(), HeapTupleGetDatum(), Int32GetDatum(), Int64GetDatum(), 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, PgStat_WalStats::wal_records, PgStat_WalStats::wal_sync, PgStat_WalStats::wal_sync_time, PgStat_WalStats::wal_write, and PgStat_WalStats::wal_write_time.
Datum pg_stat_get_xact_function_calls | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1667 of file pgstatfuncs.c.
References find_funcstat_entry(), PgStat_FunctionCounts::numcalls, PG_GETARG_OID, PG_RETURN_INT64, and PG_RETURN_NULL.
Datum pg_stat_get_xact_tuples_deleted | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1646 of file pgstatfuncs.c.
References PgStat_TableStatus::counts, find_tabstat_entry(), PG_GETARG_OID, PG_RETURN_INT64, PgStat_TableStatus::trans, trans, and PgStat_TableCounts::tuples_deleted.
Datum pg_stat_get_xact_tuples_inserted | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1604 of file pgstatfuncs.c.
References PgStat_TableStatus::counts, find_tabstat_entry(), PG_GETARG_OID, PG_RETURN_INT64, PgStat_TableStatus::trans, trans, and PgStat_TableCounts::tuples_inserted.
Datum pg_stat_get_xact_tuples_updated | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1625 of file pgstatfuncs.c.
References PgStat_TableStatus::counts, find_tabstat_entry(), PG_GETARG_OID, PG_RETURN_INT64, PgStat_TableStatus::trans, trans, and PgStat_TableCounts::tuples_updated.
Datum pg_stat_have_stats | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2057 of file pgstatfuncs.c.
References PG_GETARG_OID, PG_GETARG_TEXT_P, PG_RETURN_BOOL, pgstat_get_kind_from_str(), pgstat_have_entry(), and text_to_cstring().
Datum pg_stat_reset | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1732 of file pgstatfuncs.c.
References PG_RETURN_VOID, and pgstat_reset_counters().
Datum pg_stat_reset_replication_slot | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1820 of file pgstatfuncs.c.
References PG_ARGISNULL, PG_GETARG_TEXT_PP, PG_RETURN_VOID, PGSTAT_KIND_REPLSLOT, pgstat_reset_of_kind(), pgstat_reset_replslot(), and text_to_cstring().
Datum pg_stat_reset_shared | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1746 of file pgstatfuncs.c.
References ereport, errcode(), errhint(), errmsg(), ERROR, PG_GETARG_TEXT_PP, PG_RETURN_VOID, PGSTAT_KIND_ARCHIVER, PGSTAT_KIND_BGWRITER, PGSTAT_KIND_CHECKPOINTER, PGSTAT_KIND_IO, PGSTAT_KIND_WAL, pgstat_reset_of_kind(), text_to_cstring(), and XLogPrefetchResetStats().
Datum pg_stat_reset_single_function_counters | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1792 of file pgstatfuncs.c.
References MyDatabaseId, PG_GETARG_OID, PG_RETURN_VOID, PGSTAT_KIND_FUNCTION, and pgstat_reset().
Datum pg_stat_reset_single_table_counters | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1781 of file pgstatfuncs.c.
References InvalidOid, IsSharedRelation(), MyDatabaseId, PG_GETARG_OID, PG_RETURN_VOID, PGSTAT_KIND_RELATION, and pgstat_reset().
Datum pg_stat_reset_slru | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1803 of file pgstatfuncs.c.
References PG_ARGISNULL, PG_GETARG_TEXT_PP, PG_RETURN_VOID, PGSTAT_KIND_SLRU, pgstat_reset_of_kind(), pgstat_reset_slru(), and text_to_cstring().
Datum pg_stat_reset_subscription_stats | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1837 of file pgstatfuncs.c.
References ereport, errcode(), errmsg(), ERROR, InvalidOid, OidIsValid, PG_ARGISNULL, PG_GETARG_OID, PG_RETURN_VOID, PGSTAT_KIND_SUBSCRIPTION, pgstat_reset(), and pgstat_reset_of_kind().
|
inlinestatic |
Definition at line 1341 of file pgstatfuncs.c.
Referenced by pg_stat_get_io().
|
static |
Definition at line 1287 of file pgstatfuncs.c.
References elog(), ERROR, IO_COL_EVICTIONS, IO_COL_EXTENDS, IO_COL_FSYNCS, IO_COL_HITS, IO_COL_READS, IO_COL_REUSES, IO_COL_WRITEBACKS, IO_COL_WRITES, IOOP_EVICT, IOOP_EXTEND, IOOP_FSYNC, IOOP_HIT, IOOP_READ, IOOP_REUSE, IOOP_WRITE, IOOP_WRITEBACK, and pg_unreachable.
Referenced by pg_stat_get_io(), and pgstat_get_io_time_index().
|
static |
Definition at line 1320 of file pgstatfuncs.c.
References elog(), ERROR, IO_COL_INVALID, IOOP_EVICT, IOOP_EXTEND, IOOP_FSYNC, IOOP_HIT, IOOP_READ, IOOP_REUSE, IOOP_WRITE, IOOP_WRITEBACK, pg_unreachable, and pgstat_get_io_op_index().
Referenced by pg_stat_get_io().