Databases

Updated at:

This topic describes the views available in and . You can query these views to retrieve information about your instance and troubleshoot performance issues.

Basic database information

  • pg_stat_database
    The pg_stat_database view contains one row for each database in the cluster, showing database-wide statistics. The following table describes the parameters.
    Parameter Type Description
    datid oid The OID of the database.
    datname name The name of the database.
    numbackends integer The number of backends currently connected to this database. This is the only column in this view that reflects the current state. All other columns return values accumulated since the last reset.
    xact_commit bigint The number of committed transactions in this database.
    xact_rollback bigint The number of transactions rolled back in this database.
    blks_read bigint The number of disk blocks read in this database.
    blks_hit bigint The number of times disk blocks were found in the buffer, which prevented a read. This includes only hits in the buffer and does not include hits in the operating system's file system cache.
    tup_returned bigint The number of rows returned by queries in this database.
    tup_fetched bigint The number of rows fetched by queries in this database.
    tup_inserted bigint The number of rows inserted by queries in this database.
    tup_updated bigint The number of rows updated by queries in this database.
    tup_deleted bigint The number of rows deleted by queries in this database.
    conflicts bigint The number of queries in this database canceled due to recovery conflicts.
    temp_files bigint The number of temporary files created by queries in this database. All temporary files are counted, regardless of the reason for their creation (for example, sorting or hashing) and the log_temp_files setting.
    temp_bytes bigint The total amount of data written to temporary files by queries in this database. All temporary files are counted, regardless of the reason for their creation and the log_temp_files setting.
    deadlocks bigint The number of deadlocks detected in this database.
    blk_read_time double precision The total time backends in this database spent reading data file blocks, in milliseconds.
    blk_write_time double precision The total time backends in this database spent writing data file blocks, in milliseconds.
    stats_reset timestamp with time zone The last time these statistics were reset.
  • pg_stat_bgwriter
    The pg_stat_bgwriter view contains a single row of global data for the cluster.
    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 total time spent writing files to disk during the file writing phase of a checkpoint, in milliseconds.
    checkpoint_sync_time double precision The total time spent synchronizing files to disk during the file synchronization phase of a checkpoint, in milliseconds.
    buffers_checkpoint bigint The number of buffers written during checkpoints.
    buffers_clean bigint The number of buffers written by the background writer.
    maxwritten_clean bigint The number of times the background writer stopped a cleaning scan because it had written too many buffers.
    buffers_backend bigint The number of buffers written directly by backends.
    buffers_backend_fsync bigint The number of times a backend had to execute its own fsync call. These calls are normally handled by the background writer.
    buffers_alloc bigint The number of buffers allocated.
    stats_reset timestamp with time zone The last time these statistics were reset.

Activity status

  • polar_stat_activity
    The polar_stat_activity view shows the current state of all processes and contains cumulative statistics.
    Parameter Type Description
    datid oid OID of the database.
    datname name Name of the database.
    pid integer The backend's process ID.
    usesysid oid OID of the user logged in to this backend.
    usename name Username of the user logged in to this backend.
    application_name text Name of the application connected to this backend.
    client_addr inet Client IP address.
    client_hostname text Hostname of the client machine.
    client_port integer Client port number.
    backend_start timestamp Start time of the backend process.
    xact_start timestamp Start time of the current transaction.
    query_start timestamp Start time of the currently active query.
    state_change timestamp Time of the last state change.
    wait_event_type text The type of event the backend is waiting for, or NULL if not waiting. Possible values include:
    • LWLock: The backend is waiting for a lightweight lock. Each such lock protects a specific data structure in shared memory. The wait_event column contains a name that identifies the purpose of the lightweight lock. Some locks have specific names, while others are part of a group of locks with similar purposes.
    • Lock: The backend is waiting for a heavyweight lock. Heavyweight locks, also known as lock manager locks or simply locks, primarily protect SQL-visible objects such as tables. However, they are also used to ensure mutual exclusion for certain internal operations, such as relation extension. The wait_event column identifies the type of lock being waited for.
    • BufferPin: The server process is waiting to access a data buffer while no other process is examining that buffer. A buffer pin wait may be prolonged if another process holds an open cursor that will eventually read data from that buffer.
    • Activity: The server process is idle. This is used for system processes that are waiting for activity in their main processing loop. The wait_event column identifies the specific wait point.
    • Extension: The server process is waiting for activity in an extension module. This category is used for modules that need to track custom wait points.
    • Client: The server process is waiting on a socket for activity from the client application, expecting an event unrelated to internal processing. The wait_event column identifies the specific wait point.
    • IPC: The server process is waiting for activity from another process in the server. The wait_event column identifies the specific wait point.
    • Timeout: The server process is waiting for a timeout to occur. The wait_event column identifies the specific wait point.
    • IO: The server process is waiting for an IO operation to complete. The wait_event column identifies the specific wait point.
    wait_event text Name of the wait event if the backend is waiting, or NULL otherwise.
    state text Current state of this backend.
    backend_xid xid This backend's top-level transaction ID.
    backend_xmin xid This backend's xmin horizon.
    query text Text of the current SQL statement.
    backend_type text Type of the current backend.
    queryid bigint Unique identifier of the SQL statement.
    wait_object text The object being waited for, if any.
    wait_type text The type of object being waited for, if any.
    wait_time_ms double The elapsed wait time in milliseconds, if any.
    cpu_user bigint User-mode CPU time used by this backend.
    cpu_sys bigint Kernel-mode CPU time used by this backend.
    rss bigint Memory usage of this backend.
    pfs_read_ps bigint Cumulative number of PFS read IO operations.
    pfs_write_ps bigint Cumulative number of PFS write IO operations.
    pfs_read_throughput bigint Cumulative PFS read IO throughput.
    pfs_write_throughput bigint Cumulative PFS write IO throughput.
    pfs_read_latency_ms double PFS read IO latency.
    pfs_write_latency_ms double PFS write IO latency.
    local_read_ps bigint Cumulative number of read IO operations on the local file system.
    local_write_ps bigint Cumulative number of write IO operations on the local file system.
    local_read_throughput bigint Cumulative read IO throughput on the local file system.
    local_write_throughput bigint Cumulative write IO throughput on the local file system.
    local_read_latency_ms double Read IO latency on the local file system.
    local_write_latency_ms double Write IO latency on the local file system.
    Wait event type
    Type Parameter Description
    LWLock ShmemIndexLock Waiting to look up or allocate space in shared memory.
    OidGenLock Waiting to allocate or assign an OID.
    XidGenLock Waiting to allocate or assign a transaction ID.
    ProcArrayLock Waiting to take a snapshot or clear a transaction ID at transaction end.
    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 WAL buffer.
    WALWriteLock Waiting for the WAL buffer to be written to disk.
    ControlFileLock Waiting to read or update the control file, or to create a new WAL file.
    CheckpointLock Waiting to perform a checkpoint.
    CLogControlLock Waiting to read or update transaction status.
    SubtransControlLock Waiting to read or update sub-transaction information.
    MultiXactGenLock Waiting to read or update shared multitransaction status.
    MultiXactOffsetControlLock Waiting to read or update the multitransaction offset mapping.
    MultiXactMemberControlLock Waiting to read or update the multitransaction member mapping.
    RelCacheInitLock Waiting to read or write the relation cache initialization file.
    CheckpointerCommLock Waiting to manage fsync requests.
    TwoPhaseStateLock Waiting to read or update the state 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 An autovacuum worker or launcher is waiting to read or update the current status of autovacuum workers.
    AutovacuumScheduleLock Waiting to confirm that the selected table still needs vacuuming.
    SyncScanLock Waiting to get the scan start position for a table in a synchronized scan.
    RelationMappingLock Waiting to update the relation mapping file that stores the mapping from catalogs to file nodes.
    AsyncCtlLock Waiting to read or update shared notification status.
    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 the list of locks held by serializable transactions.
    OldSerXidLock Waiting to read or record conflicting serializable transactions.
    SyncRepLock Waiting to read or update information about synchronous replication.
    BackgroundWorkerLock Waiting to read or update background worker status.
    DynamicSharedMemoryControlLock Waiting to read or update dynamic shared memory status.
    AutoFileLock Waiting to update the postgresql.auto.conf file.
    ReplicationSlotAllocationLock Waiting to allocate or free a replication slot.
    ReplicationSlotControlLock Waiting to read or update replication slot status.
    CommitTsControlLock Waiting to read or update transaction commit timestamps.
    CommitTsLock Waiting to read or update the latest value of the transaction timestamp setting.
    ReplicationOriginLock Waiting to set up, drop, or use a replication origin.
    MultiXactTruncationLock Waiting to read or truncate multitransaction information.
    OldSnapshotTimeMapLock Waiting to read or update old snapshot control information.
    BackendRandomLock Waiting to generate a random number.
    LogicalRepWorkerLock Waiting for an action on a logical replication worker to complete.
    CLogTruncationLock Waiting to truncate the write-ahead log or for the write-ahead log truncation to complete.
    clog Waiting for I/O on the clog (transaction status) buffer.
    commit_timestamp Waiting for I/O on the commit timestamp buffer.
    subtrans Waiting for I/O on the sub-transaction buffer.
    multixact_offset Waiting for I/O on the multitransaction offset buffer.
    multixact_member Waiting for I/O on the multitransaction member buffer.
    async Waiting for I/O on the async (notification) buffer.
    oldserxid Waiting for I/O on the oldserxid buffer.
    wal_insert Waiting to insert WAL records into an in-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 add or check a backend lock, or to join or leave a lock group for parallel queries.
    predicate_lock_manager Waiting to add or check predicate lock information.
    parallel_query_dsa Waiting for a parallel query dynamic shared memory allocation lock.
    tbm Waiting for the TBM shared iterator lock.
    parallel_append Waiting to select the next subplan while executing a Parallel Append plan.
    parallel_hash_join Waiting to allocate or exchange a block of memory, or to update a counter 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 page of a relation.
    tuple Waiting to acquire a lock on a tuple.
    transactionid Waiting for a transaction to end.
    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-relation 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 Hibernating in the background writer process.
    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 apply process.
    LogicalLauncherMain Waiting in the main loop of the logical launcher process.
    PgStatMain Waiting in the main loop of the statistics collector process.
    RecoveryWalAll Waiting for WAL from any source (local, archive, or streaming) during recovery.
    RecoveryWalStream Waiting for WAL from streaming replication during recovery.
    SysLoggerMain Waiting in the main loop of the system logger 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 to establish a connection with the remote server.
    LibPQWalReceiverReceive Waiting in the WAL receiver to receive data from the remote server.
    SSLOpenServer Waiting for SSL during connection attempt.
    WalReceiverWaitStart Waiting for the startup process to send the initial data for streaming replication.
    WalSenderWaitForWAL Waiting in the WAL sender process for WAL to be flushed.
    WalSenderWriteData Waiting for network activity while the WAL sender process handles replies from the WAL receiver.
    Extension Extension Waiting in an extension.
    IPC BgWorkerShutdown Waiting for a background worker to shut down.
    BgWorkerStartup Waiting for a background worker to start up.
    BtreePage Waiting for the page number needed to continue a parallel B-tree scan to become available.
    ClogGroupUpdate Waiting for the group leader to update transaction status at transaction end.
    ExecuteGather Waiting for activity from child processes while executing a Gather node.
    Hash/Batch/Allocating Waiting for the selected Parallel Hash participant to allocate a hash table.
    Hash/Batch/Electing Waiting while electing a Parallel Hash participant to allocate a hash table.
    Hash/Batch/Loading Waiting for other Parallel Hash participants to finish loading the hash table.
    Hash/Build/Allocating Waiting for the selected Parallel Hash participant to allocate the initial hash table.
    Hash/Build/Electing Waiting while electing a Parallel Hash participant to allocate the initial hash table.
    Hash/Build/HashingInner Waiting for other Parallel Hash participants to finish hashing the inner relation.
    Hash/Build/HashingOuter Waiting for other Parallel Hash participants to finish hashing the outer relation.
    Hash/GrowBatches/Allocating Waiting for the selected Parallel Hash participant to allocate more batches.
    Hash/GrowBatches/Deciding Waiting while electing a Parallel Hash participant to decide future batch growth.
    Hash/GrowBatches/Electing Waiting while electing a Parallel Hash participant to allocate more batches.
    Hash/GrowBatches/Finishing Waiting for the elected Parallel Hash participant to decide future batch growth.
    Hash/GrowBatches/Repartitioning Waiting for other Parallel Hash participants to finish repartitioning.
    Hash/GrowBuckets/Allocating Waiting for the selected Parallel Hash participant to allocate more buckets.
    Hash/GrowBuckets/Electing Waiting while electing a Parallel Hash participant to allocate more buckets.
    Hash/GrowBuckets/Reinserting Waiting for other Parallel Hash participants to finish reinserting tuples into the 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 its state.
    MessageQueueInternal Waiting for another process to attach to the shared message queue.
    MessageQueuePutMessage Waiting to write protocol messages to the shared message queue.
    MessageQueueReceive Waiting to receive bytes from the shared message queue.
    MessageQueueSend Waiting to send bytes to the shared message queue.
    ParallelBitmapScan Waiting for parallel bitmap scan to initialize.
    ParallelCreateIndexScan Waiting for parallel CREATE INDEX workers to finish heap scans.
    ParallelFinish Waiting for parallel workers to finish processing.
    ProcArrayGroupUpdate Waiting for the group leader to clear transaction IDs at transaction end.
    ReplicationOriginDrop Waiting for a replication origin to become inactive before it can be dropped.
    ReplicationSlotDrop Waiting for a replication slot to become inactive before it can be dropped.
    SafeSnapshot Waiting for a snapshot for a READ ONLY DEFERRABLE transaction.
    SyncRep Waiting for acknowledgment from a remote server during synchronous replication.
    Timeout BaseBackupThrottle Waiting during a base backup when rate-limited.
    PgSleep Sleeping due to a pg_sleep() call.
    RecoveryApplyDelay Waiting to apply WAL due to a configured recovery delay.
    IO BufFileRead Waiting to read from a buffered file.
    BufFileWrite Waiting to write to a buffered file.
    ControlFileRead Waiting to read the control file.
    ControlFileSync Waiting for the control file to reach durable storage.
    ControlFileSyncUpdate Waiting for an update to the control file to reach durable storage.
    ControlFileWrite Waiting to write to the control file.
    ControlFileWriteUpdate Waiting to write an update to the control file.
    CopyFileRead Waiting to read during a file copy operation.
    CopyFileWrite Waiting to write during a file copy operation.
    DataFileExtend Waiting for a relation data file to be extended.
    DataFileFlush Waiting for a relation data file to reach durable storage.
    DataFileImmediateSync Waiting for an immediate synchronization of a relation data file to reach durable storage.
    DataFilePrefetch Waiting for an asynchronous prefetch from a relation data file.
    DataFileRead Waiting to read a relation data file.
    DataFileSync Waiting for changes to a relation data file to reach durable storage.
    DataFileTruncate Waiting for a relation data file to be truncated.
    DataFileWrite Waiting to write a relation data file.
    DSMFillZeroWrite Waiting to write zero bytes to a dynamic shared memory backing file.
    LockFileAddToDataDirRead Waiting to read while adding a line to the data directory lock file.
    LockFileAddToDataDirSync Waiting for data to reach durable storage while adding a line to the data directory lock file.
    LockFileAddToDataDirWrite Waiting to write while adding a line to the data directory lock file.
    LockFileCreateRead Waiting to read while creating the data directory lock file.
    LockFileCreateSync Waiting for data to reach durable storage while creating the data directory lock file.
    LockFileCreateWrite Waiting to write while creating the data directory lock file.
    LockFileReCheckDataDirRead Waiting to read while re-checking the data directory lock file.
    LogicalRewriteCheckpointSync Waiting for the logical rewrite mapping to reach durable storage during a checkpoint.
    LogicalRewriteMappingSync Waiting for mapping data to reach durable storage during a logical rewrite.
    LogicalRewriteMappingWrite Waiting to write mapping data during a logical rewrite.
    LogicalRewriteSync Waiting for the logical rewrite mapping to reach durable storage.
    LogicalRewriteWrite Waiting to write the logical rewrite mapping.
    RelationMapRead Waiting to read the relation map file.
    RelationMapSync Waiting for the relation map file to reach durable storage.
    RelationMapWrite Waiting to write the relation map file.
    ReorderBufferRead Waiting to read during reorder buffer management.
    ReorderBufferWrite Waiting to write during reorder buffer management.
    ReorderLogicalMappingRead Waiting to read a logical mapping during reorder buffer management.
    ReplicationSlotRead Waiting to read a replication slot control file.
    ReplicationSlotRestoreSync Waiting for the replication slot control file to reach durable storage while restoring it to memory.
    ReplicationSlotSync Waiting for the replication slot control file to reach durable storage.
    ReplicationSlotWrite Waiting to write a replication slot control file.
    SLRUFlushSync Waiting for SLRU data to reach durable storage during a checkpoint or database shutdown.
    SLRURead Waiting to read an SLRU page.
    SLRUSync Waiting for SLRU data to reach durable storage after a page write.
    SLRUWrite Waiting to write an SLRU page.
    SnapbuildRead Waiting to read a serialized historical catalog snapshot.
    SnapbuildSync Waiting for a serialized historical catalog snapshot to reach durable storage.
    SnapbuildWrite Waiting to write a serialized historical catalog snapshot.
    TimelineHistoryFileSync Waiting for a timeline history file received via streaming replication to reach durable storage.
    TimelineHistoryFileWrite Waiting to write a timeline history file received via streaming replication.
    TimelineHistoryRead Waiting to read a timeline history file.
    TimelineHistorySync Waiting for a newly created timeline history file to reach durable storage.
    TimelineHistoryWrite Waiting to write a newly created timeline history file.
    TwophaseFileRead Waiting to read a two-phase state file.
    TwophaseFileSync Waiting for a two-phase state file to reach durable storage.
    TwophaseFileWrite Waiting to write a two-phase state file.
    WALBootstrapSync Waiting for WAL to reach durable storage during bootstrap.
    WALBootstrapWrite Waiting to write a WAL page during bootstrap.
    WALCopyRead Waiting to read when creating a new WAL segment by copying an existing one.
    WALCopySync Waiting for a new WAL segment, created by copying an existing one, to reach durable storage.
    WALCopyWrite Waiting to write when creating a new WAL segment by copying an existing one.
    WALInitSync Waiting for a newly initialized WAL file to reach durable storage.
    WALInitWrite Waiting to write while initializing a new WAL file.
    WALRead Waiting to read a WAL file.
    WALSenderTimelineHistoryRead Waiting to read a timeline history file during a timeline command in the WAL sender process.
    WALSyncMethodAssign Waiting for data to reach durable storage while assigning the WAL sync method.
    WALWrite Waiting to write a WAL file.
    Note The view requires the polar_monitor extension. This extension is included by default in and , but you must run the create extension polar_monitor command to enable it.
  • polar_stat_activity_rt
    Describes the current state of all processes. The polar_stat_activity_rt view contains real-time statistics.
    Parameter Type Description
    pid integer Process ID.
    backend_type text Type of the backend.
    cpu_user bigint User CPU time for the backend.
    cpu_sys bigint System CPU time for the backend.
    rss bigint Memory usage of the backend.
    local_read_ps bigint Cumulative read I/O count on the local file system.
    local_write_ps bigint Cumulative write I/O count on the local file system.
    local_read_throughput bigint Cumulative read I/O throughput on the local file system.
    local_write_throughput bigint Cumulative write I/O throughput on the local file system.
    local_read_latency_ms double Read I/O latency on the local file system.
    local_write_latency_ms double Write I/O latency on the local file system.
    Note The polar_stat_activity_rt view depends on the polar_monitor plugin. Although this plugin is included by default with and databases, you must run create extension polar_monitor to enable it.
  • polar_delta
    Important The polar_delta function retrieves the incremental value of a view and depends on the polar_monitor extension. This extension is included by default with and databases, but you must run the create extension polar_monitor command to enable it.
    Usage:
    1. Create a view that contains dimension columns and value columns.
      • Dimension column names must start with d.
      • Value column names must start with v.
    2. Use the following commands to query the view:
      select * from polar_delta (NULL::view_name)
      \watch 1 select * from polar_delta (NULL::view_name)
                                  

Resources

  • CPU

    The polar_stat_activity view provides session-level CPU metrics.

  • Shared memory

    PolarDB allocates global data structures, such as the buffer pool and latches, in shared memory. This memory is statically allocated at startup. Query the following views for more information.

    • polar_stat_shmem

      This view provides monitoring information for various types of shared memory.
      Parameters Type Description
      shmname text The name of the shared memory area.
      shmsize bigint The size of the shared memory, in bytes.
      shmtype text The shared memory type.
      Note The polar_stat_shmem view depends on the polar_monitor plugin. Although this plugin is included by default with and databases, you must run the create extension polar_monitor command to enable it.
    • polar_stat_shmem_total_size

      This view provides summary statistics for shared memory.
      Parameters Type Description
      shmsize bigint The size of the shared memory, in bytes.
      shmtype text The shared memory type.
      Note The polar_stat_shmem_total_size view depends on the polar_monitor plugin. Although this plugin is included by default with and databases, you must run the create extension polar_monitor command to enable it.
  • Session private memory

    PolarDB dynamically allocates and releases private memory during runtime. While session-level memory metrics are available in the polar_stat_activity view, you can gain deeper insights by examining memory contexts, which PolarDB uses as the fundamental units for dynamic memory management. Use the following function and view to access this information.

    • polar_get_mcxt() function
      Parameter Type Description
      pid integer The session's process ID (PID).
      name text The name of the memory context.
      level int The level in the memory context hierarchy.
      nblocks bigint The number of allocated blocks.
      freechunks bigint The number of free blocks.
      totalspace bigint The total allocated space, in bytes.
      freespace bigint The total free space, in bytes.
    • polar_backends_mcxt

      This view provides memory context information aggregated by backend_type. The following table describes the parameters:
      Parameter Type Description
      pid integer The process ID (PID).
      name text The name of the memory context.
      nblocks bigint The number of allocated blocks.
      freechunks bigint The number of free blocks.
      totalspace bigint The total allocated space, in bytes.
      freespace bigint The total free space, in bytes.
      Note The polar_backends_mcxt view depends on the polar_monitor plugin. This plugin is included by default with and , but you must run the create extension polar_monitor command to enable it.
  • I/O

    The polar_stat_activity view provides session-level I/O metrics. To obtain file-level I/O information and the I/O latency distribution, query the following views.

    • polar_stat_io_info
      This view provides I/O monitoring information aggregated by file type. The following table describes the parameters.
      Parameter Type Description
      filetype text The file type.
      fileloc text The file system where the file is located. This can be a local file system or the PFS shared file system.
      open_count numeric The total number of file open operations.
      open_latency_us double The total latency of file open operations, in microseconds.
      close_count numeric The total number of file close operations.
      read_count numeric The total number of read operations.
      write_count numeric The total number of write operations.
      read_throughput numeric The total read throughput, in bytes.
      write_throughput numeric The total write throughput, in bytes.
      read_latency_us double The total latency of read operations, in microseconds.
      write_latency_us double The total latency of write operations, in microseconds.
      seek_count numeric The total number of seek operations.
      seek_latency_us double The total latency of seek operations, in microseconds.
      creat_count numeric The total number of file create operations.
      creat_latency_us double The total latency of file create operations, in microseconds.
      fsync_count numeric The total number of fsync operations.
      fsync_latency_us double The total latency of fsync operations, in microseconds.
      falloc_count numeric The total number of falloc operations.
      falloc_latency_us double The total latency of falloc operations, in microseconds.
      Note This view requires the polar_monitor plugin. The plugin is included by default with and , but you must run CREATE EXTENSION polar_monitor to enable it.
    • polar_stat_io_latency
      This view provides I/O latency statistics aggregated by I/O type. The following table describes the parameters.
      Parameter Type Description
      iokind text The file operation type. Valid values: fsync, creat, seek, open, read, write, and falloc.
      num_lessthan200us numeric The total number of operations that took less than 200 microseconds.
      num_lessthan400us numeric The total number of operations that took between 200 and 400 microseconds.
      num_lessthan600us numeric The total number of operations that took between 400 and 600 microseconds.
      num_lessthan800us numeric The total number of operations that took between 600 and 800 microseconds.
      num_lessthan1ms numeric The total number of operations that took between 800 microseconds and 1 millisecond.
      num_lessthan10ms numeric The total number of operations that took between 1 and 10 milliseconds.
      num_lessthan100ms numeric The total number of operations that took between 10 and 100 milliseconds.
      num_morethan100ms numeric The total number of operations that took longer than 100 milliseconds.
      Note This view requires the polar_monitor plugin. The plugin is included by default with and , but you must run CREATE EXTENSION polar_monitor to enable it.
  • Network

    You can obtain network monitoring data by querying the views described in this topic.

    • The polar_proc_stat_network() function
      Parameter Type Description
      pid bigint The process ID (PID).
      send_bytes bigint The total number of bytes sent.
      send_count bigint The total number of send operations.
      recv_bytes bigint The total number of bytes received.
      recv_count bigint The total number of receive operations.
      sendq bigint The length of the socket send queue.
      recvq bigint The length of the socket receive queue.
      cwnd bigint The socket sliding window size.
      rtt bigint The estimated network round-trip time (RTT) for TCP, in microseconds.
      retrans bigint The total number of retransmissions.
      tcpinfo_update_time bigint The UNIX timestamp of the last update for TCP socket monitoring data. This value is updated approximately every second. The sendq, recvq, cwnd, rtt, and retranstcpinfo_update_time metrics are captured at this time.
    • polar_stat_network
      Provides summary network monitoring data. The following table describes the parameters:
      Parameter Type Description
      send_count bigint The total number of send operations.
      send_bytes bigint The total number of bytes sent.
      recv_count bigint The total number of receive operations.
      recv_bytes bigint The total number of bytes received.
      retrans bigint The total number of retransmissions.
      Note The polar_stat_network view depends on the polar_monitor extension. This extension is included by default with and databases, but you must run the command to enable it.
  • Locks

    The views described in this topic provide information about locks.

    • LWLock

      polar_stat_lwlock

      Provides LWLock monitoring statistics. The following table describes the parameters.
      Parameter Type Description
      tranche smallint The LWLock ID.
      name text The LWLock name.
      sh_acquire_count bigint The total number of shared acquisitions.
      ex_acquire_count bigint The total number of exclusive acquisitions.
      block_count bigint The total number of times acquisition was blocked.
      lock_nums bigint The number of LWLocks.
      wait_time bigint The total wait time.
      Note The view depends on the polar_monitor_preload extension. This extension is included by default with and , but you must run the command to enable it.
    • Lock
      • pg_locks
        Parameter Type Description
        locktype text The type of the lockable object: relation, extend, page, tuple, transactionid, virtualxid, object, userlock, or advisory.
        database oid The OID of the database that contains the lock target. This is 0 if the target is a shared object, or null if the target is a transaction ID.
        relation oid The OID of the relation being locked. Null if the target is not a relation or part of one.
        page integer The page number of the locked page within the relation. Null if the target is not a relation page or tuple.
        tuple smallint The index of the locked tuple on the page. Null if the target is not a tuple.
        virtualxid text The virtual ID of the transaction being locked. Null if the target is not a virtual transaction ID.
        transactionid xid The ID of the transaction being locked. Null if the target is not a transaction ID.
        classid oid The OID of the system catalog containing the lock target. Null if the target is not a regular database object.
        objid oid The OID of the lock target within its system catalog. Null if the target is not a regular database object.
        objsubid smallint The column number of the lock target (classid and objid refer to the relation itself). The value is 0 if the target is some other regular database object. Null if the target is not a regular database object.
        virtualtransaction text The virtual ID of the transaction holding or waiting for the lock.
        pid integer The Process ID (PID) of the server process holding or awaiting this lock. Null if this lock is held by a prepared transaction.
        mode text The lock mode held or desired by this process.
        granted boolean True if the lock is granted; false if the process is waiting to acquire it.
        fastpath boolean True if the lock was acquired via the fast path; false if it was taken via the main lock table.
      • polar_stat_lock
        Provides lock statistics. The following table describes the parameters.
        Parameter Type Description
        id integer The primary key.
        lock_type text The lock type.
        invalid numeric Unused.
        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 times the lock was blocked.
        fastpath_count numeric The number of local fast-path locks.
        wait_time numeric The lock wait time.
        Note The polar_stat_lock view depends on the polar_monitor_preload extension. This extension is included by default with and , but you must run the create extension polar_monitor_preload command to enable it.
  • SLRU

    Query the polar_stat_slru() view to get SLRU monitoring information.

    polar_stat_slru()

    This view returns SLRU monitoring statistics. The following table describes the parameters:
    Parameter Type Description
    slru_type text The primary key of the view.
    slots_number integer Total number of pages.
    valid_pages integer Number of pages in use.
    empty_pages integer Number of empty pages.
    reading_pages integer Number of pages currently being read.
    writing_pages integer Number of pages currently being written.
    wait_readings integer Number of processes waiting to read.
    wait_writings integer Number of processes waiting to write.
    read_count bigint Number of read operations.
    read_only_count bigint Number of read-only operations.
    read_upgrade_count bigint Number of read operations upgraded to write operations.
    victim_count bigint Number of times a clean page was evicted.
    victim_write_count bigint Number of times a dirty page was evicted and written to disk.
    write_count bigint Number of write operations.
    zero_count bigint Number of times pages were zeroed out.
    flush_count bigint Number of flush operations.
    truncate_count bigint Number of truncate operations.
    storage_read_count bigint Number of read operations from storage.
    storage_write_count bigint Number of write operations to storage.
    Note The polar_stat_slru view requires the polar_monitor plugin. Although this plugin is included by default in and databases, you must run the create extension polar_monitor command to enable it.
  • Cgroup

    Query these views for information about system resources.

    • polar_stat_cgroup

      This view provides statistics on various system resources and cgroup information. The following table describes the parameters.

      Parameter Type Description
      subtype text The cgroup type. Valid values: IO, Memory, and CPU.
      infotype text The cgroup information.
      count bigint The count.
      Note The view depends on the polar_monitor_preload and polar_monitorpolar_monitor_preloadpolar_monitor plugins. These plugins are included by default when you install or . However, you must enable them by running the create extension polar_monitor_preload and create extension polar_monitor commands.
    • polar_cgroup_quota
      This view provides statistics on system resources and cgroup quota information. The following table describes the parameters.
      Parameter Type Description
      subtype text The cgroup type. Valid values: IO, Memory, and CPU.
      infotype text The cgroup information.
      count bigint The limit.
      Note The polar_cgroup_quota view depends on the polar_monitor plugin. This plugin is included by default when you install or . However, you must enable it by running the create extension polar_monitor command.