This topic describes the views in PolarDB for PostgreSQL(Compatible with Oracle). You can query views to obtain instance details. This helps you troubleshoot performance issues.

Basic instance information

  • pg_stat_database
    The pg_stat_database view displays the statistics about each row in each instance of a cluster. The following table describes the parameters in this view.
    ParameterTypeDescription
    datidoidThe object identifier (OID) of the database.
    datnamenameThe database name.
    numbackendsintegerThe number of backend servers that are connected to the database. In the view, this column is the only column that returns the current status. The other columns return the cumulative values starting from the last value reset.
    xact_commitbigintThe total number of transactions that have been committed in the database.
    xact_rollbackbigintThe total number of transactions that have been rolled back in the database.
    blks_readbigintThe total number of disk blocks that have been physically read in the database.
    blks_hitbigintThe number of disk blocks that have been hit in the buffer. The disk blocks do not need to be read. The number of cache hits indicates only the hits in the PolarDB for PostgreSQL(Compatible with Oracle) buffer. The hits in the file system buffer of the OS are ignored.
    tup_returnedbigintThe number of rows returned by queries in the database.
    tup_fetchedbigintThe number of rows fetched by queries in the database.
    tup_insertedbigintThe number of rows inserted by queries in the database.
    tup_updated bigintThe number of rows updated by queries in the database.
    tup_deletedbigintThe number of rows deleted by queries in the database.
    conflictsbigintThe number of queries that are canceled due to the recovery of read-only node replay conflicts.
    temp_filesbigintThe number of temporary files created by queries in the database. All temporary files are counted regardless of why the files are created and regardless of what the log_temp_files settings are.
    temp_bytesbigintThe total amount of data written to temporary files by queries in the database. All temporary files are counted regardless of why the files are created and regardless of what the log_temp_files settings are.
    deadlocksbigintThe number of deadlocks detected in the database.
    blk_read_timedouble precisionThe amount of time spent by backend servers for reading data files in the database. (Unit: milliseconds)
    blk_write_timedouble precisionThe time spent by backend servers for writing data files in the database. (Unit: milliseconds)
    stats_resettimestamp with time zoneThe latest time when the statistics were reset.
  • pg_stat_bgwriter
    The pg_stat_bgwriter view contains only one row. This row contains the global data of the cluster.
    ParameterTypeDescription
    checkpoints_timedbigintThe number of checkpoints that have been performed.
    checkpoints_reqbigintThe number of requested checkpoints that have been performed.
    checkpoint_write_timedouble precisionThe amount of time spent in writing the file to disks during checkpoints. (Unit: milliseconds)
    checkpoint_sync_timedouble precisionThe amount of time spent in synchronizing the file to disks during checkpoints. (Unit: milliseconds)
    buffers_checkpointbigintThe number of buffers that are written during checkpoints.
    buffers_cleanbigintThe number of buffers that are occupied by the background writer process.
    maxwritten_cleanbigintThe number of times that the background writer process stops a cleaning scan because a large volume of data is written at a time.
    buffers_backendbigintThe number of buffers that are directly written by a backend.
    buffers_backend_fsyncbigintThe number of times that a backend had executed the fsync call instead of a background writer process. In most cases, the background writer process handles write operations even when the backend also performs the write operations.
    buffers_allocbigintThe number of allocated buffers.
    stats_reset timestamp with time zoneThe last time when the statistics were reset.

Activity status

  • polar_stat_activity
    The polar_stat_activity view displays the status of each process. It provides the cumulative sum for each process.
    ParameterTypeDescription
    datidoidThe OID of the database.
    datnamenameThe database name.
    pidintegerThe ID of the process.
    usesysidoidThe ID of the user.
    usenamenameThe user name.
    application_nametextThe name of the application that is connected to the database.
    client_addrinetThe IP address of the client that is connected to the database.
    client_hostnametextThe host name of the connected client.
    client_portintegerThe port that is used for the communications between the client and the database.
    backend_starttimestampThe time when the process is started.
    xact_starttimestampThe time when the current transaction of the process is started.
    query_starttimestampThe start time when the SQL statement is executed.
    state_changetimestampThe time when the status of the process is last changed.
    wait_event_typetextThe type of the event for which the backend is waiting in a session. If the backend is not waiting for an event, NULL is returned. Valid values:
    • LWLock: The backend is waiting for a lightweight lock. A lightweight lock protects a special data structure in shared memory. The wait_event parameter contains a name that identifies the purpose of the lightweight lock. Some locks have specific names. Other locks are a group of locks that have a similar purpose.
    • Lock: The backend is waiting for a heavyweight lock. A heavyweight lock is also known as a lock manager or a simple lock. A heavyweight lock protects SQL objects such as tables. The SQL objects are visible to users. A heavyweight lock is also used to ensure mutual exclusion for some internal operations such as table extension. The wait_event parameter indicates the type of the lock for which the backend is waiting.
    • BufferPin: The server process is waiting to access a data buffer during a period when no other process is checking that buffer. Buffer pin waits can be protracted if another process holds an open cursor that last reads data from the buffer.
    • Activity: The server process is idle. This parameter is used when a system process waits for an activity in the main processing loop. wait_event identifies the specific wait point.
    • Extension: The server process is waiting for an activity in an extension module. This category is useful for modules to track custom wait points.
    • Client: The server process is waiting for an activity on a socket from user applications. The server also expects events that are independent of the internal processes to happen. wait_event identifies the specific wait point.
    • IPC: The server process is waiting for an activity from another process in the server. wait_event identifies the specific wait point.
    • Timeout: The server process is waiting for a timeout. wait_event identifies the specific wait point.
    • IO: The server process is waiting for an I/O request to complete. wait_event identifies the specific wait point.
    wait_eventtextThe name of the wait event. If the backend is not waiting for an event, NULL is returned.
    statetextThe status of the process.
    backend_xidxidThe transaction identifier (XID) of the client.
    backend_xminxidThe xmin value of the client.
    querytextThe executed SQL statement.
    backend_typetextThe type of the backend process.
    queryidbigintThe unique ID of the SQL statement.
    wait_objecttextThe wait object. This parameter is returned when the backend is waiting for an event.
    wait_typetextThe type of the wait object. This parameter is returned when the backend is waiting for an event.
    wait_time_msdoubleThe wait time that is spent. This parameter is returned when the backend is waiting for an event.
    cpu_userbigintThe user CPU utilization of the backend server.
    cpu_sysbigintThe system CPU utilization of the backend server.
    rssbigintThe memory usage of the backend server.
    pfs_read_psbigintThe cumulative sum of read operations on a Polar file system (PFS).
    pfs_write_psbigintThe cumulative sum of write operations on a PFS.
    pfs_read_throughputbigintThe cumulative sum of the read throughput of a PFS.
    pfs_write_throughputbigintThe cumulative sum of the write throughput of a PFS.
    pfs_read_latency_msdoubleThe latency of the read operation on a PFS.
    pfs_write_latency_msdoubleThe latency of the write operation on a PFS.
    local_read_psbigintThe cumulative sum of read operations on a local file system.
    local_write_psbigintThe cumulative sum of write operations on a local file system.
    local_read_throughputbigintThe cumulative sum of the read throughput of a local file system.
    local_write_throughputbigintThe cumulative sum of the write throughput of a local file system.
    local_read_latency_msdoubleThe latency of the read operation on a local file system.
    local_write_latency_msdoubleThe latency of the write operation on a local file system.
    Wait events
    Wait event typeWait event nameDescription
    LWLockShmemIndexLockThe program is waiting to find or allocate space in shared memory.
    OidGenLockThe program is waiting to allocate or assign an OID.
    XidGenLockThe program is waiting to allocate or assign an XID.
    ProcArrayLockThe program is waiting to obtain a snapshot or clear an XID at the end of a transaction.
    SInvalReadLockThe program is waiting to retrieve or remove a message from an invalid shared message queue.
    SInvalWriteLockThe program is waiting to add a message to an invalid shared message queue.
    WALBufMappingLockThe program is waiting to replace a page in a write-ahead logging (WAL) buffer.
    WALWriteLockThe program is waiting for a WAL buffer to be written to a disk.
    ControlFileLockThe program is waiting to read or update the control file or create a WAL file.
    CheckpointLockThe program is waiting to perform a checkpoint operation.
    CLogControlLockThe program is waiting to read or update the transaction status.
    SubtransControlLockThe program is waiting to read or update sub-transaction information.
    MultiXactGenLockThe program is waiting to read or update the shared multixact status.
    MultiXactOffsetControlLockThe program is waiting to read or update multixact offset mappings.
    MultiXactMemberControlLockThe program is waiting to read or update multixact member mappings.
    RelCacheInitLockThe program is waiting to read or write a relation-cache initialization file.
    CheckpointerCommLockThe program is waiting to manage fsync() calls.
    TwoPhaseStateLockThe program is waiting to read or update the status of a prepared transaction.
    TablespaceCreateLockThe program is waiting to create or drop a tablespace.
    BtreeVacuumLockThe program is waiting to read or update vacuum-related information for a B-tree index.
    AddinShmemInitLockThe program is waiting to manage space allocation in shared memory.
    AutovacuumLockThe autovacuum worker or launcher is waiting to update or read the status of the autovacuum worker.
    AutovacuumScheduleLockThe program is waiting to confirm that the table selected for a vacuum still needs vacuuming.
    SyncScanLockThe program is waiting to obtain the start location of a scan on a table for synchronized scans.
    RelationMappingLockThe program is waiting to update the relation mapping file used to store the catalog to filenode mappings.
    AsyncCtlLockThe program is waiting to read or update the shared notification status.
    AsyncQueueLockThe program is waiting to read or update notification messages.
    SerializableXactHashLockThe program is waiting to retrieve or store information about serializable transactions.
    SerializableFinishedListLockThe program is waiting to access finished serializable transactions.
    SerializablePredicateLockListLockThe program is waiting to perform an operation on locks held by serializable transactions.
    OldSerXidLockThe program is waiting to read or record conflicting serializable transactions.
    SyncRepLockThe program is waiting to read or update information about synchronous replicas.
    BackgroundWorkerLockThe program is waiting to read or update the backend worker status.
    DynamicSharedMemoryControlLockThe program is waiting to read or update the status of the dynamic shared memory.
    AutoFileLockThe program is waiting to update the postgresql.auto.conf file.
    ReplicationSlotAllocationLockThe program is waiting to allocate or drop a replication slot.
    ReplicationSlotControlLockThe program is waiting to read or update the status of a replication slot.
    CommitTsControlLockThe program is waiting to read or update transaction commit timestamps.
    CommitTsLockThe program is waiting to read or update the last value set for the transaction timestamp.
    ReplicationOriginLockThe program is waiting to set up, drop, or use the replication origin.
    MultiXactTruncationLockThe program is waiting to read or truncate multixact information.
    OldSnapshotTimeMapLockThe program is waiting to read or update control information about old snapshots.
    BackendRandomLockThe program is waiting to generate a random number.
    LogicalRepWorkerLockThe program is waiting for an action on a logical replication worker to complete.
    CLogTruncationLockThe program is waiting to truncate a WAL file or waiting for the truncation of a WAL file to complete.
    clogThe backend is waiting for I/O requests on a commit log (CLOG) buffer. A CLOG records the commit status of a transaction.
    commit_timestampThe program is waiting for I/O requests on a commit timestamp buffer.
    subtransThe program is waiting for I/O requests on a subtransaction buffer.
    multixact_offsetThe program is waiting for I/O requests on a multixact offset buffer.
    multixact_memberThe program is waiting for I/O requests on a multixact member buffer.
    asyncThe program is waiting for I/O requests on an async buffer.
    oldserxidThe program is waiting for I/O requests on an oldserxid buffer.
    wal_insertThe program is waiting to insert a WAL file into a memory buffer.
    buffer_contentThe program is waiting to read or write a data page in memory.
    buffer_ioThe program is waiting for I/O requests on a data page.
    replication_originThe program is waiting to read or update the replication progress.
    replication_slot_ioThe program is waiting for I/O requests on a replication slot.
    procThe program is waiting to read or update the fast-path lock information.
    buffer_mappingThe program is waiting to associate a data block with a buffer in a buffer pool.
    lock_managerThe program is waiting to join or exit a locking group, or waiting to add or check the locks that are used for the backend. The event takes place when parallel queries are performed.
    predicate_lock_managerThe program is waiting to add or check information about a predicate lock.
    parallel_query_dsaThe program is waiting for the dynamic shared memory allocation lock for parallel execution.
    tbmThe program is waiting for the shared iterator lock for a TIDBitmap.
    parallel_appendThe program is waiting to select the next subplan while the Parallel Append plan is being executed.
    parallel_hash_joinThe program is waiting to allocate or exchange a chunk of memory or update counters while the Parallel Hash plan is being executed.
    LockrelationThe program is waiting to obtain the lock on a relation.
    extendThe program is waiting to extend a relation.
    pageThe program is waiting to obtain the lock on the page of a relation.
    tupleThe program is waiting to obtain the lock on a tuple.
    transactionidThe program is waiting for a transaction to complete.
    virtualxidThe program is waiting to obtain a virtual XID lock.
    speculative tokenThe program is waiting to obtain a speculative insertion lock.
    objectThe program is waiting to obtain the lock on a non-relational database object.
    userlockThe program is waiting to obtain a user lock.
    advisoryThe program is waiting to obtain an advisory user lock.
    BufferPinBufferPinThe program is waiting to pin a buffer.
    ActivityArchiverMainThe program is waiting in the main loop of the archiver process.
    AutoVacuumMainThe program is waiting in the main loop of the autovacuum launcher process.
    BgWriterHibernateThe program is waiting in the background writer process while the instance is in hibernation.
    BgWriterMainThe program is waiting in the main loop of the background worker of the background worker process.
    CheckpointerMainThe program is waiting in the main loop of the checkpointer process.
    LogicalApplyMainThe program is waiting in the main loop of the logical apply process.
    LogicalLauncherMainThe program is waiting in the main loop of the logical launcher process.
    PgStatMainThe program is waiting in the main loop of the statistics collector process.
    RecoveryWalAllThe program is waiting for the WAL data from a source, such as a local file, an archived file, or a stream, while the instance is being restored.
    RecoveryWalStreamThe program is waiting for the WAL data from a stream while the instance is being restored.
    SysLoggerMainThe program is waiting in the main loop of the syslog process.
    WalReceiverMainThe program is waiting in the main loop of the WAL receiver process.
    WalSenderMainThe program is waiting in the main loop of the WAL sender process.
    WalWriterMainThe program is waiting in the main loop of the WAL writer process.
    ClientClientReadThe program is waiting to read data from the client.
    ClientWriteThe program is waiting to write data to the client.
    LibPQWalReceiverConnectThe program is waiting in the WAL receiver process to connect to a remote server.
    LibPQWalReceiverReceiveThe program is waiting in the WAL receiver process to receive data from a remote server.
    SSLOpenServerThe program is waiting for SSL while a connection is being established.
    WalReceiverWaitStartThe program is waiting for the startup process to send the initial data for streaming replication.
    WalSenderWaitForWALThe program is waiting for the WAL data to be flushed in the WAL sender process.
    WalSenderWriteDataThe program is waiting for an activity that occurs while the replies from the WAL receiver are being processed in the WAL sender process.
    ExtensionExtensionThe program is waiting in an extension.
    IPCBgWorkerShutdownThe program is waiting for the background worker to shut down.
    BgWorkerStartupThe program is waiting for the background worker to start up.
    BtreePageThe program is waiting for the page number that is required for continuing to scan B-trees in parallel to become available.
    ClogGroupUpdateThe program is waiting for the group leader to update the status of a transaction when the transaction ends.
    ExecuteGatherThe program is waiting for an activity from a child process while a Gather node is being executed.
    Hash/Batch/AllocatingThe program is waiting for an elected Parallel Hash participant to allocate hash tables.
    Hash/Batch/ElectingThe program is waiting for a Parallel Hash participant to be elected to allocate hash tables.
    Hash/Batch/LoadingThe program is waiting for other Parallel Hash participants to finish loading hash tables.
    Hash/Build/AllocatingThe program is waiting for an elected Parallel Hash participant to allocate the initial hash table.
    Hash/Build/ElectingThe program is waiting for a Parallel Hash participant to be elected to allocate the initial hash table.
    Hash/Build/HashingInnerThe program is waiting for other Parallel Hash participants to complete the hash operations on inner relations.
    Hash/Build/HashingOuterThe program is waiting for other Parallel Hash participants to complete the hash operations on outer relations.
    Hash/GrowBatches/AllocatingThe program is waiting for an elected Parallel Hash participant to allocate more batches of hash tables.
    Hash/GrowBatches/DecidingThe program is waiting for a Parallel Hash participant to be elected to determine the increase of hash table batches.
    Hash/GrowBatches/ElectingThe program is waiting for a Parallel Hash participant to be elected to allocate more batches of hash tables.
    Hash/GrowBatches/FinishingThe program is waiting for an elected Parallel Hash participant to determine the increase of hash table batches.
    Hash/GrowBatches/RepartitioningThe program is waiting for other Parallel Hash participants to finish repartitioning.
    Hash/GrowBuckets/AllocatingThe program is waiting for an elected Parallel Hash participant to finish allocating more buckets.
    Hash/GrowBuckets/ElectingThe program is waiting for a Parallel Hash participant to be elected to allocate more buckets.
    Hash/GrowBuckets/ReinsertingThe program is waiting for other Parallel Hash participants to insert tuples into new buckets.
    LogicalSyncDataThe program is waiting for the remote server for logical replication to send data that is used to synchronize the initial table.
    LogicalSyncStateChangeThe program is waiting for the status of the remote server for logical replication to change.
    MessageQueueInternalThe program is waiting for other processes to be added into a shared message queue.
    MessageQueuePutMessageThe program is waiting to write a protocol message to a shared message queue.
    MessageQueueReceiveThe program is waiting to receive bytes from a shared message queue.
    MessageQueueSendThe program is waiting to send bytes to a shared message queue.
    ParallelBitmapScanThe program is waiting for the parallel scan of a bitmap to be initialized.
    ParallelCreateIndexScanThe program is waiting for CREATE INDEX parallel workers to complete heap scans.
    ParallelFinishThe program is waiting for parallel workers to finish computing.
    ProcArrayGroupUpdateThe program is waiting for the group leader to clear the XID after a transaction is complete.
    ReplicationOriginDropThe program is waiting for a replication origin to become inactive so that the replication origin can be deleted.
    ReplicationSlotDropThe program is waiting for a replication slot to become inactive so that the replication slot can be deleted.
    SafeSnapshotThe program is waiting for a snapshot that can be used in a READ ONLY DEFERRABLE transaction.
    SyncRepThe program is waiting for a confirmation from the remote server during the synchronous replication.
    TimeoutBaseBackupThrottleThe program is waiting in the base backup phase while a throttling activity is in progress.
    PgSleepThe program is waiting in the process that calls the pg_sleep function.
    RecoveryApplyDelayThe program is waiting to apply WAL while data is being restored because WAL is delayed to be applied.
    IOBufFileReadThe program is waiting to read data from a buffered file.
    BufFileWriteThe program is waiting to write data to a buffered file.
    ControlFileReadThe program is waiting to read data from the control file.
    ControlFileSyncThe program is waiting for the control file to reach stable storage.
    ControlFileSyncUpdateThe program is waiting for an update to the control file to reach stable storage.
    ControlFileWriteThe program is waiting to write data to the control file.
    ControlFileWriteUpdateThe program is waiting to write data to update the control file.
    CopyFileReadThe program is waiting to read data while a file is being copied.
    CopyFileWriteThe program is waiting to write data while a file is being copied.
    DataFileExtendThe program is waiting for a relation data file to be extended.
    DataFileFlushThe program is waiting for a relation data file to reach stable storage.
    DataFileImmediateSyncThe program is waiting for a relation data file to be immediately synchronized to reach stable storage.
    DataFilePrefetchThe program is waiting for an asynchronous prefetch from a relation data file.
    DataFileReadThe program is waiting to read data from a relation data file.
    DataFileSyncThe program is waiting for changes to a relation data file to reach stable storage.
    DataFileTruncateThe program is waiting for a relation data file to be truncated.
    DataFileWriteThe program is waiting to write data to a relation data file.
    DSMFillZeroWriteThe program is waiting to write 0 bytes to a backup file in dynamic shared memory.
    LockFileAddToDataDirReadThe program is waiting to read data while a row of data is being added to the data directory lock file.
    LockFileAddToDataDirSyncThe program is waiting for a row of data to reach stable storage while the row of data is being added to the data directory lock file.
    LockFileAddToDataDirWriteThe program is waiting to write data while a row of data is being added to the data directory lock file.
    LockFileCreateReadThe program is waiting to read data while the data directory lock file is being created.
    LockFileCreateSyncThe program is waiting for data to reach stable storage while the data directory lock file is being created.
    LockFileCreateWriteThe program is waiting to write data while the data directory lock file is being created.
    LockFileReCheckDataDirReadThe program is waiting to read data while the data directory lock file is being rechecked.
    LogicalRewriteCheckpointSyncThe program is waiting for logical rewrite mappings to reach stable storage during a checkpoint.
    LogicalRewriteMappingSyncThe program is waiting for mapping data to reach stable storage during a logical rewrite operation.
    LogicalRewriteMappingWriteThe program is waiting to write mapping data during a logical rewrite operation.
    LogicalRewriteSyncThe program is waiting for logical rewrite mappings to reach stable storage.
    LogicalRewriteWriteThe program is waiting to write data to logical rewrite mappings.
    RelationMapReadThe program is waiting to read data from the relation mapping file.
    RelationMapSyncThe program is waiting for the relation mapping file to reach stable storage.
    RelationMapWriteThe program is waiting to write data to the relation mapping file.
    ReorderBufferReadThe program is waiting to read data during reorder buffer management.
    ReorderBufferWriteThe program is waiting to write data during reorder buffer management.
    ReorderLogicalMappingReadThe program is waiting to read data from a logical mapping during reorder buffer management.
    ReplicationSlotReadThe program is waiting to read data from the control file of a replication slot.
    ReplicationSlotRestoreSyncThe program is waiting for the control file of a replication slot to reach stable storage while the file is being restored to the memory.
    ReplicationSlotSyncThe program is waiting for the control file of a replication slot to reach stable storage.
    ReplicationSlotWriteThe program is waiting to write data to the control file of a replication slot.
    SLRUFlushSyncThe program is waiting for Segmented Least Recently Used (SLRU) data to reach stable storage during a checkpoint or database shutdown period.
    SLRUReadThe program is waiting to read data from an SLRU page.
    SLRUSyncThe program is waiting for SLRU data to reach stable storage after a write operation is performed on a page.
    SLRUWriteThe program is waiting to write data to an SLRU page.
    SnapbuildReadThe program is waiting to read data from a serialized historical catalog snapshot.
    SnapbuildSyncThe program is waiting for a serialized historical catalog snapshot to reach stable storage.
    SnapbuildWriteThe program is waiting to write data to a serialized historical catalog snapshot.
    TimelineHistoryFileSyncThe program is waiting for a timeline history file that is received by using streaming replication to reach stable storage.
    TimelineHistoryFileWriteThe program is waiting to read data from a timeline history file that is received by using streaming replication.
    TimelineHistoryReadThe program is waiting to read data from a timeline history file.
    TimelineHistorySyncThe program is waiting for a newly created timeline history file to reach stable storage.
    TimelineHistoryWriteThe program is waiting to write data to a newly created timeline history file.
    TwophaseFileReadThe program is waiting to read data from a two-phase state file.
    TwophaseFileSyncThe program is waiting for a two-phase state file to reach stable storage.
    TwophaseFileWriteThe program is waiting to write data to a two-phase state file.
    WALBootstrapSyncThe program is waiting for WAL data to reach stable storage during bootstrapping.
    WALBootstrapWriteThe program is waiting to write data to a WAL page during bootstrapping.
    WALCopyReadThe program is waiting to read data while a WAL segment is being created by copying an existing WAL segment.
    WALCopySyncThe program is waiting for a WAL segment that is created by copying an existing WAL segment to reach stable storage.
    WALCopyWriteThe program is waiting to write data while a WAL segment is being created by copying an existing WAL segment.
    WALInitSyncThe program is waiting for a newly initialized WAL file to reach stable storage.
    WALInitWriteThe program is waiting to write data while a new WAL file is being initialized.
    WALReadThe program is waiting to read data from a WAL file.
    WALSenderTimelineHistoryReadThe program is waiting to read data from a timeline history file while the walsender timeline command is being run.
    WALSyncMethodAssignThe program is waiting for data to reach stable storage while the WAL sync method is being assigned.
    WALWriteThe program is waiting to write data to a WAL file.
    Note The polar_stat_activity view is provided by the polar_monitor plug-in. This plug-in is built into PolarDB for PostgreSQL(Compatible with Oracle). To activate this plug-in, execute the create extension polar_monitor statement.
  • polar_stat_activity_rt
    The polar_stat_activity_rt view provides real-time data of the status of all processes.
    ParameterTypeDescription
    pidintegerThe ID of the process.
    backend_typetextThe type of the backend process.
    cpu_userbigintThe user CPU utilization of the backend server.
    cpu_sysbigintThe system CPU utilization of the backend server.
    rssbigintThe memory usage of the backend server.
    local_read_psbigintThe cumulative sum of read operations on a local file system.
    local_write_psbigintThe cumulative sum of write operations on a local file system.
    local_read_throughputbigintThe cumulative sum of the read throughput of a local file system.
    local_write_throughputbigintThe cumulative sum of the write throughput of a local file system.
    local_read_latency_msdoubleThe latency of the read operation on a local file system.
    local_write_latency_msdoubleThe latency of the write operation on a local file system.
    Note The polar_stat_activity_rt view is provided by the polar_monitor plug-in. This plug-in is built into PolarDB for PostgreSQL(Compatible with Oracle). To activate this plug-in, execute the create extension polar_monitor statement.
  • polar_delta
    Important polar_delta is a function used to query the incremental values of a view. This function is provided by the polar_monitor plug-in. This plug-in is built into PolarDB for PostgreSQL(Compatible with Oracle) . To activate this plug-in, execute the create extension polar_monitor statement.
    To use the polar_delta function, perform the following instructions:
    1. Create a view that contains a column for dimensions and a column for values.
      • The name of the column for dimensions must start with d.
      • The name of the column for values must start with v.
    2. Execute the following statements to query the view:
      "select * from polar_delta (NULL::view_name)"
      "\watch 1 select * from polar_delta (NULL::view_name)"
                                  

Resources

  • CPU

    Session-level CPU metrics are displayed in the polar_stat_activity view.

  • Shared memory

    Other global data structures, such as the buffer pool and latch of PolarDB, are allocated to shared memory, which is applied at startup. You can obtain relevant information by querying the following view.

    • polar_stat_shmem

      The polar_stat_shmem view provides detailed monitoring information about each type of shared memory. The following table describes the parameters in this view.
      ParameterTypeDescription
      shmnametextThe name of the shared memory.
      shmsizebigintThe size of the shared memory. (Unit: bytes)
      shmtypetextThe type of the shared memory.
      Note The polar_stat_shmem view is provided by the polar_monitor plug-in. This plug-in is built into PolarDB for PostgreSQL(Compatible with Oracle). To activate this plug-in, execute the create extension polar_monitor statement.
    • polar_stat_shmem_total_size

      The polar_stat_shmem_total_size view provides aggregated monitoring information about shared memory. The following table describes the parameters in this view.
      ParameterTypeDescription
      shmsizebigintThe size of the shared memory. (Unit: bytes)
      shmtypetextThe type of the shared memory.
      Note The polar_stat_shmem_total_size view is provided by the polar_monitor plug-in. This plug-in is built into PolarDB for PostgreSQL(Compatible with Oracle). To activate this plug-in, execute the create extension polar_monitor statement.
  • Session private memory

    The private memory of PolarDB is dynamically allocated and released during the running process. The session-level memory metrics are displayed in the polar_stat_activity view. Context-dependent memory is the basic unit of dynamic memory management in PolarDB, which can be obtained by viewing the following functions and views.

    • polar_get_mcxt() function
      ParameterTypeDescription
      pidintegerThe ID of the session process.
      nametextThe name of the context-dependent memory.
      levelintThe level of the context-dependent memory.
      nblocksbigintThe number of the occupied blocks.
      freechunksbigintThe number of the free blocks.
      totalspacebigintThe total memory. (Unit: bytes)
      freespacebigintThe free memory. (Unit: bytes)
    • polar_backends_mcxt

      The polar_backends_mcxt view provides information about context-dependent memory grouped by backend_type. The following table describes the parameters in this view.
      ParameterTypeDescription
      pidintegerThe ID of the process.
      nametextThe name of the context-dependent memory.
      nblocksbigintThe number of the occupied blocks.
      freechunksbigintThe number of the free blocks.
      totalspacebigintThe total memory. (Unit: bytes)
      freespacebigintThe free memory. (Unit: bytes)
      Note The polar_backends_mcxt view is provided by the polar_monitor plug-in. This plug-in is built into PolarDB for PostgreSQL(Compatible with Oracle). To activate this plug-in, execute the create extension polar_monitor statement.
  • I/O

    Session-level I/O metrics are displayed in the polar_stat_activity view. File-level I/O information and I/O latency distribution can be obtained by querying the following views.

    • polar_stat_io_info
      The polar_stat_io_info view provides monitoring information about I/O requests grouped by file types. The following table describes the parameters in this view.
      ParameterTypeDescription
      filetypetextThe type of the file.
      fileloctextThe file system where the file resides. Currently, there are two types of file systems: local file system and shared file system Polar File System (PFS).
      open_countnumericThe number of times the file has been opened.
      open_latency_usdoubleThe total latency for opening the file. (Unit: microseconds)
      close_countnumericThe number of times the file has been closed.
      read_countnumericThe number of times the file has been read.
      write_countnumericThe number of times the file has been written.
      read_throughputnumericThe read throughput of the file system.
      write_throughputnumericThe write throughput of the file system.
      read_latency_usdoubleThe total latency for reading the file. (Unit: microseconds)
      write_latency_usdoubleThe total latency for writing data to the file. (Unit: microseconds)
      seek_countnumericThe number of times that you called the seek() function.
      seek_latency_usdoubleThe total latency for calling the seek() function.
      creat_countnumericThe number of times that you created a file.
      creat_latency_usdoubleThe total latency for creating a file.
      fsync_countnumericThe number of times that you called the fsync() function.
      fsync_latency_usdoubleThe total latency for calling the fsync() function.
      falloc_countnumericThe number of times that you called the fallocate() function.
      falloc_latency_usdoubleThe total latency for calling the fallocate() function.
      Note The polar_stat_io_info view is provided by the polar_monitor plug-in. This plug-in is built into PolarDB for PostgreSQL(Compatible with Oracle). To activate this plug-in, execute the create extension polar_monitor statement.
    • polar_stat_io_latency
      The polar_stat_io_latency view provides I/O latency information grouped by I/O types. The following table describes the parameters in this view.
      ParameterTypeDescription
      iokindtextThe type of the operation on a file. Valid values:fsync,creat,seek,open,read,write,falloc.
      num_lessthan200usnumericThe number of times that the I/O latency is less than 200 microseconds.
      num_lessthan400usnumericThe number of times that the I/O latency is greater than 200 microseconds but less than 400 microseconds.
      num_lessthan600usnumericThe number of times that the I/O latency is greater than 400 microseconds but less than 600 microseconds.
      num_lessthan800usnumericThe number of times that the I/O latency is greater than 600 microseconds but less than 800 microseconds.
      num_lessthan1msnumericThe number of times that the I/O latency is greater than 800 microseconds but less than 1 millisecond.
      num_lessthan10msnumericThe number of times that the I/O latency is greater than 1 millisecond but less than 10 milliseconds.
      num_lessthan100msnumericThe number of times that the I/O latency is greater than 10 milliseconds but less than 100 milliseconds.
      num_morethan100msnumericThe number of times that the I/O latency is greater than 100 milliseconds.
      Note The polar_stat_io_latency view is provided by the polar_monitor plug-in. This plug-in is built into PolarDB for PostgreSQL(Compatible with Oracle). To activate this plug-in, execute the create extension polar_monitor statement.
  • Network

    You can query the following functions and views to obtain network monitoring information.

    • polar_proc_stat_network() function
      ParameterTypeDescription
      pidbigintThe ID of the process.
      send_bytesbigintThe total number of bytes sent.
      send_countbigintThe cumulative number of sending times.
      recv_bytesbigintThe total number of bytes received.
      recv_countbigintThe cumulative number of receiving times.
      sendqbigintThe length of the sending queue over the socket.
      recvqbigintThe length of the receiving queue over the socket.
      cwndbigintThe length of the sliding window of the socket.
      rttbigintThe round-trip time (RTT) of TCP packets. (Unit: microseconds)
      retransbigintThe cumulative number of times that data is retransmitted.
      tcpinfo_update_timebigintThe last update time of the TCP socket monitoring information. The value of this parameter is a second-level timestamp. It is updated every second. The aforementioned sendq, recvq, cwnd, rtt, and retrans metrics are updated regularly, and their update time is displayed by this parameter.
    • polar_stat_network
      The polar_stat_network view provides network monitoring information. The following table describes the parameters in this view.
      ParameterTypeDescription
      send_countbigintThe number of times that the system sends network traffic.
      send_bytesbigintThe amount of outbound traffic. (Unit: bytes)
      recv_countbigintThe number of times that the system receives network traffic.
      recv_bytesbigintThe amount of inbound traffic. (Unit: bytes)
      retransbigintThe number of times that data is retransmitted.
      Note The polar_stat_network view is provided by the polar_monitor plug-in. This plug-in is built into PolarDB for PostgreSQL(Compatible with Oracle). To activate this plug-in, execute the create extension polar_monitor statement.
  • Lock

    You can query the following views to obtain lock information.

    • LWLock

      polar_stat_lwlock

      The polar_stat_lwlock view provides monitoring information about locks. The following table describes the parameters in this view.
      ParameterTypeDescription
      tranchesmallintThe ID of the lock.
      nametextThe name of the lock.
      sh_acquire_countbigintThe number of times that the system acquires a shared lock.
      ex_acquire_countbigintThe number of times that the system acquires an exclusive lock.
      block_countbigintThe number of blocks that occurred.
      lock_nums bigintThe number of lightweight locks.
      wait_timebigintThe total lock wait time.
      Note The polar_stat_lwlock view is provided by the polar_monitor_preload plug-in. This plug-in is built into PolarDB for PostgreSQL(Compatible with Oracle). To activate this plug-in, execute the create extension polar_monitor_preload statement.
    • Lock
      • pg_locks
        ParameterTypeDescription
        locktypetextThe type of the lockable object. Valid values: relation, extend, page, tuple, transactionid, virtualxid, object, userlock, and advisory.
        databaseoidThe OID of the database in which the object to be locked exists. If the object is a shared object, the value is 0. If the object is an XID, the value is NULL.
        relationoidThe OID of the relation to be locked. If the object to be locked is not a relation or is only part of a relation, the value is NULL.
        pageintegerThe page number of the page to be locked within the relation. If the object to be locked is not a tuple or a relation page, the value is NULL.
        tuplesmallintThe tuple number of the tuple to be locked within the page. If the object to be locked is not a tuple, the value is NULL.
        virtualxidtextThe virtual ID of the transaction to be locked. If the object to be locked is not a virtual XID, the value is NULL.
        transactionidxidThe ID of the transaction to be locked. If the object to be locked is not an XID, the value is NULL.
        classidoidThe OID of the system catalog that contains the object to be locked. If the object is not a general database object, the value is NULL.
        objidoidThe ID of the object to be locked within the system catalog. If the object is not a general database object, the value is NULL.
        objsubidsmallintThe ID of the column to be locked. The values in classid and objid refer to the table itself. If the object to be locked is another general database object, the value is 0. If the object is not a general database object, the value is NULL.
        virtualtransactiontextThe virtual ID of the transaction that holds the lock or is waiting for the lock.
        pidintegerThe ID of the server process that holds the lock or is waiting for the lock. If this lock is held by a prepared transaction, the value is NULL.
        modetextThe name of the lock mode that is held or desired by this process.
        grantedbooleanIf the lock is held, the value is true. If the lock is waited for, the value is false.
        fastpathbooleanIf the lock is obtained by using a fast path, the value is true. If the lock is obtained from the main lock table, the value is false.
      • polar_stat_lock
        The polar_stat_lock view provides lock statistics. The following table describes the parameters in this view.
        ParameterTypeDescription
        idintegerThe primary key of the table.
        lock_typetextThe type of the lock.
        invalidnumericIndicates that the lock is invalid.
        accesssharelocknumericThe number of ACCESS SHARE locks.
        rowsharelocknumericThe number of ROW SHARE locks.
        rowexclusivelocknumericThe number of ROW EXCLUSIVE locks.
        shareupdateexclusivelocknumericThe number of SHARE UPDATE EXCLUSIVE locks.
        sharelocknumericThe number of SHARE locks.
        sharerowexclusivelocknumericThe number of SHARE ROW EXCLUSIVE locks.
        exclusivelock numericThe number of EXCLUSIVE locks.
        accessexclusivelock numericThe number of ACCESS EXCLUSIVE locks.
        block_count numericThe number of blocks caused by locks.
        fastpath_count numericThe number of fast-path locks on a local system.
        wait_time numericThe lock wait time.
        Note The polar_stat_lock view is provided by the polar_monitor_preload plug-in. This plug-in is built into PolarDB for PostgreSQL(Compatible with Oracle). To activate this plug-in, execute the create extension polar_monitor_preload statement.
  • SLRU

    You can query the polar_stat_slru() view to obtain monitoring information about Segmented Least Recently Used (SLRU) cache data.

    polar_stat_slru()

    The polar_stat_slru() view provides monitoring information about SLRU cache data. The following table describes the parameters in this view.
    ParameterTypeDescription
    slru_typetextThe primary key of the table.
    slots_numberintegerThe number of pages.
    valid_pagesintegerThe number of the used pages.
    empty_pagesintegerThe number of the empty pages.
    reading_pagesintegerThe number of the pages on which the read operations are being performed.
    writing_pagesintegerThe number of the pages on which the write operations are being performed.
    wait_readingsintegerThe number of the wait events for read operations.
    wait_writingsintegerThe number of the wait events for write operations.
    read_countbigintThe number of the read operations.
    read_only_countbigintThe number of the read-only operations.
    read_upgrade_countbigintThe number of the read operations in the upgrade mode.
    victim_countbigintThe number of times that data is evicted from caches.
    victim_write_countbigintThe number of times that data is evicted from caches and then is written to disks.
    write_countbigintThe number of the write operations.
    zero_countbigintThe number of times that the cache data is cleared.
    flush_countbigintThe number of the flush operations.
    truncate_countbigintThe number of the truncate operations.
    storage_read_countbigintThe number of times that you read data from disks.
    storage_write_countbigintThe number of times that you write data to disks.
    Note The polar_stat_slru view is provided by the polar_monitor plug-in. This plug-in is built into PolarDB for PostgreSQL(Compatible with Oracle). To activate this plug-in, execute the create extension polar_monitor statement.
  • cgroup

    You can query the following views to obtain information about system resources.

    • polar_stat_cgroup

      The polar_stat_cgroup provides statistics about system resources and control groups (cgroups). The following table describes the parameters in this view.

      ParameterTypeDescription
      subtypetextThe type of the cgroup. Valid values: IO, Memory, and CPU.
      infotypetextThe information about the cgroup.
      countbigintThe statistics about the used resources.
      Note The polar_stat_cgroup view is provided by the polar_monitor_preload and polar_monitor plug-ins. These plug-ins are built into PolarDB for PostgreSQL(Compatible with Oracle). To activate the plug-ins, execute the create extension polar_monitor_preload and create extension polar_monitor statements.
    • polar_cgroup_quota
      The polar_cgroup_quota provides statistics about system resources and cgroup quotas. The following table describes the parameters in this view.
      ParameterTypeDescription
      subtypetextThe type of a cgroup. Valid values: IO, Memory, and CPU.
      infotypetextThe information about cgroups.
      countbigintThe quota of a cgroup.
      Note The polar_cgroup_quota view is provided by the polar_monitor plug-in. This plug-in is built into PolarDB for PostgreSQL(Compatible with Oracle). To activate this plug-in, execute the create extension polar_monitor statement.