All Products
Search
Document Center

PolarDB:Instances

Last Updated:Apr 01, 2026

Describes the views and functions in PolarDB for PostgreSQL that you can query to obtain instance-level statistics, helping you troubleshoot performance issues.

Basic instance information

pg_stat_database

The pg_stat_database view displays statistics for each database in the cluster.

Parameter Type Description
datid oid The object identifier (OID) of the database.
datname name The database name.
numbackends integer The number of backends currently connected to the database. This is the only column that reflects the current state; all other columns return cumulative values since the last statistics reset.
xact_commit bigint The total number of transactions committed in the database.
xact_rollback bigint The total number of transactions rolled back in the database.
blks_read bigint The total number of disk blocks physically read in the database.
blks_hit bigint The number of disk block reads served from the buffer cache. This count reflects only hits in the PolarDB for PostgreSQL buffer; hits in the OS file system cache are not included.
tup_returned bigint The number of rows returned by queries in the database.
tup_fetched bigint The number of rows fetched by queries in the database.
tup_inserted bigint The number of rows inserted by queries in the database.
tup_updated bigint The number of rows updated by queries in the database.
tup_deleted bigint The number of rows deleted by queries in the database.
conflicts bigint The number of queries canceled due to read-only node replay conflicts.
temp_files bigint The number of temporary files created by queries in the database. All temporary files are counted, regardless of why they were created or the log_temp_files setting.
temp_bytes bigint The total amount of data written to temporary files by queries in the database. All temporary files are counted, regardless of why they were created or the log_temp_files setting.
deadlocks bigint The number of deadlocks detected in the database.
blk_read_time double precision The time spent by backends reading data files in the database, in milliseconds.
blk_write_time double precision The time spent by backends writing data files in the database, in milliseconds.
stats_reset timestamp with time zone The last time the statistics were reset.

pg_stat_bgwriter

The pg_stat_bgwriter view contains a single row with cluster-wide statistics about the background writer process.

Parameter Type Description
checkpoints_timed bigint The number of scheduled checkpoints performed.
checkpoints_req bigint The number of requested checkpoints performed.
checkpoint_write_time double precision The time spent writing files to disk during checkpoints, in milliseconds.
checkpoint_sync_time double precision The time spent synchronizing files to disk during checkpoints, in milliseconds.
buffers_checkpoint bigint The number of buffers written during checkpoints.
buffers_clean bigint The number of buffers written by the background writer process.
maxwritten_clean bigint The number of times the background writer stopped a cleaning scan because too many buffers were written at once.
buffers_backend bigint The number of buffers written directly by backends.
buffers_backend_fsync bigint The number of times a backend executed an fsync call instead of the background writer. The background writer normally handles write operations, but backends may also perform writes.
buffers_alloc bigint The number of buffers allocated.
stats_reset timestamp with time zone The last time the statistics were reset.

Activity status

polar_stat_activity

The polar_stat_activity view displays the status of each backend process, providing cumulative totals per process.

This view is provided by the polar_monitor plugin, which is built into PolarDB for PostgreSQL. To activate the plugin, run CREATE EXTENSION polar_monitor.
Parameter Type Description
datid oid The OID of the database.
datname name The database name.
pid integer The process ID.
usesysid oid The OID of the user.
usename name The user name.
application_name text The name of the application connected to the database.
client_addr inet The IP address of the connected client.
client_hostname text The host name of the connected client.
client_port integer The TCP port used for communication between the client and the database.
backend_start timestamp The time when the process started.
xact_start timestamp The time when the current transaction started.
query_start timestamp The time when the current SQL statement started executing.
state_change timestamp The time when the process state last changed.
wait_event_type text The category of event the backend is waiting for. Returns NULL if the backend is not waiting. Valid values: LWLock, Lock, BufferPin, Activity, Extension, Client, IPC, Timeout, IO. See the wait events table below for details.
wait_event text The name of the wait event. Returns NULL if the backend is not waiting.
state text The current state of the process.
backend_xid xid The transaction identifier (XID) of the backend.
backend_xmin xid The xmin value of the backend.
query text The SQL statement being executed.
backend_type text The type of the backend process.
queryid bigint The unique ID of the SQL statement.
wait_object text The wait object. Populated when the backend is waiting for an event.
wait_type text The type of the wait object. Populated when the backend is waiting for an event.
wait_time_ms double The wait time elapsed, in milliseconds. Populated when the backend is waiting for an event.
cpu_user bigint The user CPU usage of the backend.
cpu_sys bigint The system CPU usage of the backend.
rss bigint The memory usage of the backend, in bytes.
pfs_read_ps bigint The cumulative number of read operations on the Polar File System (PFS).
pfs_write_ps bigint The cumulative number of write operations on PFS.
pfs_read_throughput bigint The cumulative read throughput of PFS, in bytes.
pfs_write_throughput bigint The cumulative write throughput of PFS, in bytes.
pfs_read_latency_ms double The read latency for PFS operations, in milliseconds.
pfs_write_latency_ms double The write latency for PFS operations, in milliseconds.
local_read_ps bigint The cumulative number of read operations on the local file system.
local_write_ps bigint The cumulative number of write operations on the local file system.
local_read_throughput bigint The cumulative read throughput of the local file system, in bytes.
local_write_throughput bigint The cumulative write throughput of the local file system, in bytes.
local_read_latency_ms double The read latency for local file system operations, in milliseconds.
local_write_latency_ms double The write latency for local file system operations, in milliseconds.

Wait events

The following table describes the wait events returned in the wait_event_type and wait_event columns.

Wait event type Wait event name Description
LWLock ShmemIndexLock Waiting to find or allocate space in shared memory.
OidGenLock Waiting to allocate or assign an OID.
XidGenLock Waiting to allocate or assign a transaction ID (XID).
ProcArrayLock Waiting to obtain a snapshot or clear an XID at the end of a transaction.
SInvalReadLock Waiting to retrieve or remove a message from the shared invalidation message queue.
SInvalWriteLock Waiting to add a message to the shared invalidation message queue.
WALBufMappingLock Waiting to replace a page in the write-ahead logging (WAL) buffer.
WALWriteLock Waiting for a WAL buffer to be written to disk.
ControlFileLock Waiting to read or update the control file, or to create a WAL file.
CheckpointLock Waiting to perform a checkpoint.
CLogControlLock Waiting to read or update transaction status.
SubtransControlLock Waiting to read or update subtransaction information.
MultiXactGenLock Waiting to read or update the shared multixact state.
MultiXactOffsetControlLock Waiting to read or update multixact offset mappings.
MultiXactMemberControlLock Waiting to read or update multixact member mappings.
RelCacheInitLock Waiting to read or write the relation cache initialization file.
CheckpointerCommLock Waiting to manage fsync() calls.
TwoPhaseStateLock Waiting to read or update the status of a prepared transaction.
TablespaceCreateLock Waiting to create or drop a tablespace.
BtreeVacuumLock Waiting to read or update vacuum-related information for a B-tree index.
AddinShmemInitLock Waiting to manage space allocation in shared memory.
AutovacuumLock Waiting to update or read the status of an autovacuum worker.
AutovacuumScheduleLock Waiting to confirm that the table selected for vacuuming still needs to be vacuumed.
SyncScanLock Waiting to get the starting scan location for synchronized scans on a table.
RelationMappingLock Waiting to update the relation mapping file used for catalog-to-filenode mappings.
AsyncCtlLock Waiting to read or update the shared notification state.
AsyncQueueLock Waiting to read or update notification messages.
SerializableXactHashLock Waiting to retrieve or store information about serializable transactions.
SerializableFinishedListLock Waiting to access the list of finished serializable transactions.
SerializablePredicateLockListLock Waiting to perform operations on locks held by serializable transactions.
OldSerXidLock Waiting to read or record conflicting serializable transactions.
SyncRepLock Waiting to read or update information about synchronous replicas.
BackgroundWorkerLock Waiting to read or update the background worker state.
DynamicSharedMemoryControlLock Waiting to read or update the dynamic shared memory state.
AutoFileLock Waiting to update the postgresql.auto.conf file.
ReplicationSlotAllocationLock Waiting to allocate or drop a replication slot.
ReplicationSlotControlLock Waiting to read or update the state of a replication slot.
CommitTsControlLock Waiting to read or update transaction commit timestamps.
CommitTsLock Waiting to read or update the last transaction timestamp value.
ReplicationOriginLock Waiting to set up, drop, or use a replication origin.
MultiXactTruncationLock Waiting to read or truncate multixact information.
OldSnapshotTimeMapLock Waiting to read or update control information about old snapshots.
BackendRandomLock Waiting to generate a random number.
LogicalRepWorkerLock Waiting for an action on a logical replication worker to complete.
CLogTruncationLock Waiting to truncate a WAL file, or waiting for an in-progress WAL truncation to complete.
clog Waiting for I/O on a commit log (CLOG) buffer. A CLOG records the commit status of transactions.
commit_timestamp Waiting for I/O on a commit timestamp buffer.
subtrans Waiting for I/O on a subtransaction buffer.
multixact_offset Waiting for I/O on a multixact offset buffer.
multixact_member Waiting for I/O on a multixact member buffer.
async Waiting for I/O on an async buffer.
oldserxid Waiting for I/O on an oldserxid buffer.
wal_insert Waiting to insert a WAL record into a memory buffer.
buffer_content Waiting to read or write a data page in memory.
buffer_io Waiting for I/O on a data page.
replication_origin Waiting to read or update replication progress.
replication_slot_io Waiting for I/O on a replication slot.
proc Waiting to read or update fast-path lock information.
buffer_mapping Waiting to associate a data block with a buffer in the buffer pool.
lock_manager Waiting to join or exit a locking group, or to add or check locks used by backends. Occurs during parallel queries.
predicate_lock_manager Waiting to add or check predicate lock information.
parallel_query_dsa Waiting for the dynamic shared memory allocation lock for parallel execution.
tbm Waiting for the shared iterator lock on a TIDBitmap.
parallel_append Waiting to select the next subplan while executing a Parallel Append plan.
parallel_hash_join Waiting to allocate or exchange memory chunks, or to update counters while executing a Parallel Hash plan.
Lock relation Waiting to acquire a lock on a relation.
extend Waiting to extend a relation.
page Waiting to acquire a lock on a relation page.
tuple Waiting to acquire a lock on a tuple.
transactionid Waiting for a transaction to complete.
virtualxid Waiting to acquire a virtual XID lock.
speculative token Waiting to acquire a speculative insertion lock.
object Waiting to acquire a lock on a non-relational database object.
userlock Waiting to acquire a user lock.
advisory Waiting to acquire an advisory lock.
BufferPin BufferPin Waiting to pin a buffer.
Activity ArchiverMain Waiting in the main loop of the archiver process.
AutoVacuumMain Waiting in the main loop of the autovacuum launcher process.
BgWriterHibernate Waiting in the background writer process while the instance is in hibernation.
BgWriterMain Waiting in the main loop of the background writer process.
CheckpointerMain Waiting in the main loop of the checkpointer process.
LogicalApplyMain Waiting in the main loop of the logical replication apply process.
LogicalLauncherMain Waiting in the main loop of the logical replication launcher process.
PgStatMain Waiting in the main loop of the statistics collector process.
RecoveryWalAll Waiting for WAL data from any source (local file, archive, or stream) during instance recovery.
RecoveryWalStream Waiting for WAL data from a stream during instance recovery.
SysLoggerMain Waiting in the main loop of the syslog process.
WalReceiverMain Waiting in the main loop of the WAL receiver process.
WalSenderMain Waiting in the main loop of the WAL sender process.
WalWriterMain Waiting in the main loop of the WAL writer process.
Client ClientRead Waiting to read data from the client.
ClientWrite Waiting to write data to the client.
LibPQWalReceiverConnect Waiting in the WAL receiver process to connect to a remote server.
LibPQWalReceiverReceive Waiting in the WAL receiver process to receive data from a remote server.
SSLOpenServer Waiting for SSL handshake during connection establishment.
WalReceiverWaitStart Waiting for the startup process to send initial data for streaming replication.
WalSenderWaitForWAL Waiting for WAL data to be flushed in the WAL sender process.
WalSenderWriteData Waiting while processing replies from the WAL receiver in the WAL sender process.
Extension Extension Waiting in an extension module.
IPC BgWorkerShutdown Waiting for a background worker to shut down.
BgWorkerStartup Waiting for a background worker to start up.
BtreePage Waiting for a page number needed to continue a parallel B-tree scan.
ClogGroupUpdate Waiting for the group leader to update transaction status when a transaction ends.
ExecuteGather Waiting for activity from a child process while executing a Gather node.
Hash/Batch/Allocating Waiting for the elected Parallel Hash participant to allocate hash tables.
Hash/Batch/Electing Waiting for a Parallel Hash participant to be elected to allocate hash tables.
Hash/Batch/Loading Waiting for other Parallel Hash participants to finish loading hash tables.
Hash/Build/Allocating Waiting for the elected Parallel Hash participant to allocate the initial hash table.
Hash/Build/Electing Waiting for a Parallel Hash participant to be elected to allocate the initial hash table.
Hash/Build/HashingInner Waiting for other Parallel Hash participants to finish hashing inner relations.
Hash/Build/HashingOuter Waiting for other Parallel Hash participants to finish hashing outer relations.
Hash/GrowBatches/Allocating Waiting for the elected Parallel Hash participant to allocate additional hash table batches.
Hash/GrowBatches/Deciding Waiting for a Parallel Hash participant to be elected to decide the batch count increase.
Hash/GrowBatches/Electing Waiting for a Parallel Hash participant to be elected to allocate additional batches.
Hash/GrowBatches/Finishing Waiting for the elected Parallel Hash participant to decide the batch count increase.
Hash/GrowBatches/Repartitioning Waiting for other Parallel Hash participants to finish repartitioning.
Hash/GrowBuckets/Allocating Waiting for the elected Parallel Hash participant to finish allocating additional buckets.
Hash/GrowBuckets/Electing Waiting for a Parallel Hash participant to be elected to allocate additional buckets.
Hash/GrowBuckets/Reinserting Waiting for other Parallel Hash participants to insert tuples into new buckets.
LogicalSyncData Waiting for the remote logical replication server to send data for initial table synchronization.
LogicalSyncStateChange Waiting for the remote logical replication server to change state.
MessageQueueInternal Waiting for other processes to attach to a shared message queue.
MessageQueuePutMessage Waiting to write a protocol message to a shared message queue.
MessageQueueReceive Waiting to receive bytes from a shared message queue.
MessageQueueSend Waiting to send bytes to a shared message queue.
ParallelBitmapScan Waiting for a parallel bitmap scan to be initialized.
ParallelCreateIndexScan Waiting for parallel CREATE INDEX workers to finish heap scans.
ParallelFinish Waiting for parallel workers to finish computing.
ProcArrayGroupUpdate Waiting for the group leader to clear the XID after a transaction completes.
ReplicationOriginDrop Waiting for a replication origin to become inactive so it can be deleted.
ReplicationSlotDrop Waiting for a replication slot to become inactive so it can be deleted.
SafeSnapshot Waiting for a snapshot usable in a READ ONLY DEFERRABLE transaction.
SyncRep Waiting for confirmation from the remote server during synchronous replication.
Timeout BaseBackupThrottle Waiting during the base backup phase while throttling is active.
PgSleep Waiting in a process that called the pg_sleep function.
RecoveryApplyDelay Waiting to apply WAL during recovery because WAL application is delayed.
IO BufFileRead Waiting to read data from a buffered file.
BufFileWrite Waiting to write data to a buffered file.
ControlFileRead Waiting to read data from the control file.
ControlFileSync Waiting for the control file to reach stable storage.
ControlFileSyncUpdate Waiting for a control file update to reach stable storage.
ControlFileWrite Waiting to write data to the control file.
ControlFileWriteUpdate Waiting to write an update to the control file.
CopyFileRead Waiting to read data while copying a file.
CopyFileWrite Waiting to write data while copying a file.
DataFileExtend Waiting for a relation data file to be extended.
DataFileFlush Waiting for a relation data file to reach stable storage.
DataFileImmediateSync Waiting for a relation data file to be immediately synced to stable storage.
DataFilePrefetch Waiting for an asynchronous prefetch from a relation data file.
DataFileRead Waiting to read data from a relation data file.
DataFileSync Waiting for changes to a relation data file to reach stable storage.
DataFileTruncate Waiting for a relation data file to be truncated.
DataFileWrite Waiting to write data to a relation data file.
DSMFillZeroWrite Waiting to write zeros to a dynamic shared memory backing file.
LockFileAddToDataDirRead Waiting to read data while adding a row to the data directory lock file.
LockFileAddToDataDirSync Waiting for a row to reach stable storage while adding it to the data directory lock file.
LockFileAddToDataDirWrite Waiting to write data while adding a row to the data directory lock file.
LockFileCreateRead Waiting to read data while creating the data directory lock file.
LockFileCreateSync Waiting for data to reach stable storage while creating the data directory lock file.
LockFileCreateWrite Waiting to write data while creating the data directory lock file.
LockFileReCheckDataDirRead Waiting to read data while rechecking the data directory lock file.
LogicalRewriteCheckpointSync Waiting for logical rewrite mappings to reach stable storage during a checkpoint.
LogicalRewriteMappingSync Waiting for mapping data to reach stable storage during a logical rewrite.
LogicalRewriteMappingWrite Waiting to write mapping data during a logical rewrite.
LogicalRewriteSync Waiting for logical rewrite mappings to reach stable storage.
LogicalRewriteWrite Waiting to write data to logical rewrite mappings.
RelationMapRead Waiting to read data from the relation mapping file.
RelationMapSync Waiting for the relation mapping file to reach stable storage.
RelationMapWrite Waiting to write data to the relation mapping file.
ReorderBufferRead Waiting to read data during reorder buffer management.
ReorderBufferWrite Waiting to write data during reorder buffer management.
ReorderLogicalMappingRead Waiting to read a logical mapping during reorder buffer management.
ReplicationSlotRead Waiting to read data from a replication slot control file.
ReplicationSlotRestoreSync Waiting for a replication slot control file to reach stable storage while it is being restored into memory.
ReplicationSlotSync Waiting for a replication slot control file to reach stable storage.
ReplicationSlotWrite Waiting to write data to a replication slot control file.
SLRUFlushSync Waiting for Segmented Least Recently Used (SLRU) data to reach stable storage during a checkpoint or database shutdown.
SLRURead Waiting to read data from an SLRU page.
SLRUSync Waiting for SLRU data to reach stable storage after a page write.
SLRUWrite Waiting to write data to an SLRU page.
SnapbuildRead Waiting to read data from a serialized historical catalog snapshot.
SnapbuildSync Waiting for a serialized historical catalog snapshot to reach stable storage.
SnapbuildWrite Waiting to write data to a serialized historical catalog snapshot.
TimelineHistoryFileSync Waiting for a timeline history file received via streaming replication to reach stable storage.
TimelineHistoryFileWrite Waiting to write a timeline history file received via streaming replication.
TimelineHistoryRead Waiting to read data from a timeline history file.
TimelineHistorySync Waiting for a newly created timeline history file to reach stable storage.
TimelineHistoryWrite Waiting to write data to a newly created timeline history file.
TwophaseFileRead Waiting to read data from a two-phase state file.
TwophaseFileSync Waiting for a two-phase state file to reach stable storage.
TwophaseFileWrite Waiting to write data to a two-phase state file.
WALBootstrapSync Waiting for WAL data to reach stable storage during bootstrapping.
WALBootstrapWrite Waiting to write data to a WAL page during bootstrapping.
WALCopyRead Waiting to read data while creating a WAL segment by copying an existing segment.
WALCopySync Waiting for a WAL segment created by copying an existing segment to reach stable storage.
WALCopyWrite Waiting to write data while creating a WAL segment by copying an existing segment.
WALInitSync Waiting for a newly initialized WAL file to reach stable storage.
WALInitWrite Waiting to write data while initializing a new WAL file.
WALRead Waiting to read data from a WAL file.
WALSenderTimelineHistoryRead Waiting to read a timeline history file while running the walsender timeline command.
WALSyncMethodAssign Waiting for data to reach stable storage while assigning the WAL sync method.
WALWrite Waiting to write data to a WAL file.

polar_stat_activity_rt

The polar_stat_activity_rt view provides real-time status data for all backend processes. Unlike polar_stat_activity, this view does not provide cumulative totals.

This view is provided by the polar_monitor plugin, which is built into PolarDB for PostgreSQL. To activate the plugin, run CREATE EXTENSION polar_monitor.
Parameter Type Description
pid integer The process ID.
backend_type text The type of the backend process.
cpu_user bigint The user CPU usage of the backend.
cpu_sys bigint The system CPU usage of the backend.
rss bigint The memory usage of the backend, in bytes.
local_read_ps bigint The cumulative number of read operations on the local file system.
local_write_ps bigint The cumulative number of write operations on the local file system.
local_read_throughput bigint The cumulative read throughput of the local file system, in bytes.
local_write_throughput bigint The cumulative write throughput of the local file system, in bytes.
local_read_latency_ms double The read latency for local file system operations, in milliseconds.
local_write_latency_ms double The write latency for local file system operations, in milliseconds.

polar_delta

polar_delta is a function that queries the incremental (delta) values of a view between successive calls.

Important

polar_delta is provided by the polar_monitor plugin, which is built into PolarDB for PostgreSQL. To activate the plugin, run CREATE EXTENSION polar_monitor.

To use polar_delta:

  1. Create a view with a dimension column and one or more value columns.

    • Dimension column names must start with d.

    • Value column names must start with v.

  2. Query the view using one of the following statements:

    SELECT * FROM polar_delta(NULL::view_name);
    \watch 1 SELECT * FROM polar_delta(NULL::view_name);

Resources

Shared memory

Global data structures such as the buffer pool and latches are allocated in shared memory at startup. The following views provide shared memory monitoring information.

polar_stat_shmem

The polar_stat_shmem view provides detailed monitoring information for each type of shared memory.

This view is provided by the polar_monitor plugin, which is built into PolarDB for PostgreSQL. To activate the plugin, run CREATE EXTENSION polar_monitor.
Parameter Type Description
shmname text The name of the shared memory segment.
shmsize bigint The size of the shared memory segment, in bytes.
shmtype text The type of the shared memory segment.

polar_stat_shmem_total_size

The polar_stat_shmem_total_size view provides aggregated monitoring information about shared memory, grouped by type.

This view is provided by the polar_monitor plugin, which is built into PolarDB for PostgreSQL. To activate the plugin, run CREATE EXTENSION polar_monitor.
Parameter Type Description
shmsize bigint The total size of the shared memory type, in bytes.
shmtype text The type of the shared memory.

Session private memory

PolarDB dynamically allocates and releases private memory during execution. Session-level memory metrics are available in the polar_stat_activity view. For context-level memory details, use the following function and view.

polar_get_mcxt()

The polar_get_mcxt() function returns memory context information for a given backend process.

Parameter Type Description
pid integer The ID of the session process.
name text The name of the memory context.
level int The level of the memory context.
nblocks bigint The number of allocated blocks.
freechunks bigint The number of free chunks.
totalspace bigint The total memory allocated, in bytes.
freespace bigint The free memory available, in bytes.

polar_backends_mcxt

The polar_backends_mcxt view provides memory context information grouped by backend type.

This view is provided by the polar_monitor plugin, which is built into PolarDB for PostgreSQL. To activate the plugin, run CREATE EXTENSION polar_monitor.
Parameter Type Description
pid integer The process ID.
name text The name of the memory context.
nblocks bigint The number of allocated blocks.
freechunks bigint The number of free chunks.
totalspace bigint The total memory allocated, in bytes.
freespace bigint The free memory available, in bytes.

I/O

Session-level I/O metrics are available in the polar_stat_activity view. The following views provide file-level I/O statistics and latency distribution.

polar_stat_io_info

The polar_stat_io_info view provides I/O monitoring information grouped by file type.

This view is provided by the polar_monitor plugin, which is built into PolarDB for PostgreSQL. To activate the plugin, run CREATE EXTENSION polar_monitor.
Parameter Type Description
filetype text The type of the file.
fileloc text The file system where the file resides. Valid values: local file system, Polar File System (PFS).
open_count numeric The number of times the file has been opened.
open_latency_us double The total latency for opening the file, in microseconds.
close_count numeric The number of times the file has been closed.
read_count numeric The number of times the file has been read.
write_count numeric The number of times the file has been written.
read_throughput numeric The cumulative read throughput of the file system, in bytes.
write_throughput numeric The cumulative write throughput of the file system, in bytes.
read_latency_us double The total latency for reading the file, in microseconds.
write_latency_us double The total latency for writing to the file, in microseconds.
seek_count numeric The number of times seek() was called.
seek_latency_us double The total latency for seek() calls, in microseconds.
creat_count numeric The number of times a file was created.
creat_latency_us double The total latency for file creation, in microseconds.
fsync_count numeric The number of times fsync() was called.
fsync_latency_us double The total latency for fsync() calls, in microseconds.
falloc_count numeric The number of times fallocate() was called.
falloc_latency_us double The total latency for fallocate() calls, in microseconds.

polar_stat_io_latency

The polar_stat_io_latency view provides I/O latency distribution grouped by operation type.

This view is provided by the polar_monitor plugin, which is built into PolarDB for PostgreSQL. To activate the plugin, run CREATE EXTENSION polar_monitor.
Parameter Type Description
iokind text The I/O operation type. Valid values: fsync, creat, seek, open, read, write, falloc.
num_lessthan200us numeric The number of operations with latency less than 200 microseconds.
num_lessthan400us numeric The number of operations with latency between 200 and 400 microseconds.
num_lessthan600us numeric The number of operations with latency between 400 and 600 microseconds.
num_lessthan800us numeric The number of operations with latency between 600 and 800 microseconds.
num_lessthan1ms numeric The number of operations with latency between 800 microseconds and 1 millisecond.
num_lessthan10ms numeric The number of operations with latency between 1 and 10 milliseconds.
num_lessthan100ms numeric The number of operations with latency between 10 and 100 milliseconds.
num_morethan100ms numeric The number of operations with latency greater than 100 milliseconds.

Network

The following function and view provide network monitoring information.

polar_proc_stat_network()

The polar_proc_stat_network() function returns per-process network statistics.

Parameter Type Description
pid bigint The process ID.
send_bytes bigint The total number of bytes sent.
send_count bigint The cumulative number of send operations.
recv_bytes bigint The total number of bytes received.
recv_count bigint The cumulative number of receive operations.
sendq bigint The send queue length on the socket.
recvq bigint The receive queue length on the socket.
cwnd bigint The congestion window size of the socket.
rtt bigint The round-trip time (RTT) of TCP packets, in microseconds.
retrans bigint The cumulative number of TCP retransmissions.
tcpinfo_update_time bigint The Unix timestamp (in seconds) of the last update to TCP socket metrics. The sendq, recvq, cwnd, rtt, and retrans values are updated once per second; this field shows when they were last refreshed.

Lock

The following views provide lock monitoring information.

polar_stat_lwlock

The polar_stat_lwlock view provides lightweight lock (LWLock) statistics.

This view is provided by the polar_monitor_preload plugin, which is built into PolarDB for PostgreSQL. To activate the plugin, run CREATE EXTENSION polar_monitor_preload.
Parameter Type Description
tranche smallint The lock ID.
name text The lock name.
sh_acquire_count bigint The number of times a shared lock was acquired.
ex_acquire_count bigint The number of times an exclusive lock was acquired.
block_count bigint The number of lock blocks that occurred.
lock_nums bigint The number of lightweight locks.
wait_time bigint The total lock wait time.

pg_locks

The pg_locks view provides information about heavyweight locks held or awaited by server processes.

Parameter Type Description
locktype text The type of the lockable object. Valid values: relation, extend, page, tuple, transactionid, virtualxid, object, userlock, advisory.
database oid The OID of the database in which the locked object resides. Returns 0 for shared objects and NULL for XID locks.
relation oid The OID of the relation being locked. Returns NULL if the object is not a relation or is only part of a relation.
page integer The page number within the relation. Returns NULL if the object is not a tuple or relation page.
tuple smallint The tuple number within the page. Returns NULL if the object is not a tuple.
virtualxid text The virtual transaction ID being locked. Returns NULL if the object is not a virtual XID.
transactionid xid The transaction ID being locked. Returns NULL if the object is not an XID.
classid oid The OID of the system catalog containing the locked object. Returns NULL if the object is not a general database object.
objid oid The ID of the locked object within the system catalog. Returns NULL if the object is not a general database object.
objsubid smallint The ID of the locked column. The values in classid and objid refer to the table itself. Returns 0 for other general database objects, and NULL if the object is not a general database object.
virtualtransaction text The virtual transaction ID of the transaction holding or awaiting the lock.
pid integer The PID of the server process holding or awaiting the lock. Returns NULL if the lock is held by a prepared transaction.
mode text The name of the lock mode held or requested by this process.
granted boolean true if the lock is held; false if the lock is being waited for.
fastpath boolean true if the lock was acquired via the fast path; false if it was acquired from the main lock table.

polar_stat_lock

The polar_stat_lock view provides lock statistics aggregated by lock type.

This view is provided by the polar_monitor_preload plugin, which is built into PolarDB for PostgreSQL. To activate the plugin, run CREATE EXTENSION polar_monitor_preload.
Parameter Type Description
id integer The primary key.
lock_type text The type of the lock.
invalid numeric Indicates that the lock is invalid.
accesssharelock numeric The number of ACCESS SHARE locks.
rowsharelock numeric The number of ROW SHARE locks.
rowexclusivelock numeric The number of ROW EXCLUSIVE locks.
shareupdateexclusivelock numeric The number of SHARE UPDATE EXCLUSIVE locks.
sharelock numeric The number of SHARE locks.
sharerowexclusivelock numeric The number of SHARE ROW EXCLUSIVE locks.
exclusivelock numeric The number of EXCLUSIVE locks.
accessexclusivelock numeric The number of ACCESS EXCLUSIVE locks.
block_count numeric The number of lock blocks caused by lock contention.
fastpath_count numeric The number of fast-path locks acquired locally.
wait_time numeric The total lock wait time.

SLRU

The polar_stat_slru() view provides monitoring information about Segmented Least Recently Used (SLRU) cache data.

This view is provided by the polar_monitor plugin, which is built into PolarDB for PostgreSQL. To activate the plugin, run CREATE EXTENSION polar_monitor.
Parameter Type Description
slru_type text The SLRU type (primary key).
slots_number integer The total number of page slots.
valid_pages integer The number of pages in use.
empty_pages integer The number of empty pages.
reading_pages integer The number of pages currently being read.
writing_pages integer The number of pages currently being written.
wait_readings integer The number of wait events for read operations.
wait_writings integer The number of wait events for write operations.
read_count bigint The total number of read operations.
read_only_count bigint The number of read-only operations.
read_upgrade_count bigint The number of read operations in upgrade mode.
victim_count bigint The number of cache evictions.
victim_write_count bigint The number of cache evictions that required writing evicted data to disk.
write_count bigint The total number of write operations.
zero_count bigint The number of times cache data was cleared.
flush_count bigint The total number of flush operations.
truncate_count bigint The total number of truncate operations.
storage_read_count bigint The number of times data was read from disk.
storage_write_count bigint The number of times data was written to disk.

cgroup

The following views provide system resource and cgroup monitoring information.

polar_stat_cgroup

The polar_stat_cgroup view provides statistics about system resources and control groups (cgroups).

This view is provided by both the polar_monitor_preload and polar_monitor plugins, which are built into PolarDB for PostgreSQL. To activate the plugins, run CREATE EXTENSION polar_monitor_preload and CREATE EXTENSION polar_monitor.
Parameter Type Description
subtype text The cgroup type. Valid values: IO, Memory, CPU.
infotype text The cgroup metric being reported.
count bigint The resource usage count.

polar_cgroup_quota

The polar_cgroup_quota view provides cgroup quota information.

This view is provided by the polar_monitor plugin, which is built into PolarDB for PostgreSQL. To activate the plugin, run CREATE EXTENSION polar_monitor.
Parameter Type Description
subtype text The cgroup type. Valid values: IO, Memory, CPU.
infotype text The cgroup metric being reported.
count bigint The cgroup quota value.