Databases
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 datidoid The OID of the database. datnamename The name of the database. numbackendsinteger 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_commitbigint The number of committed transactions in this database. xact_rollbackbigint The number of transactions rolled back in this database. blks_readbigint The number of disk blocks read in this database. blks_hitbigint 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_returnedbigint The number of rows returned by queries in this database. tup_fetchedbigint The number of rows fetched by queries in this database. tup_insertedbigint The number of rows inserted by queries in this database. tup_updatedbigint The number of rows updated by queries in this database. tup_deletedbigint The number of rows deleted by queries in this database. conflictsbigint The number of queries in this database canceled due to recovery conflicts. temp_filesbigint 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_filessetting.temp_bytesbigint 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_filessetting.deadlocksbigint The number of deadlocks detected in this database. blk_read_timedouble precision The total time backends in this database spent reading data file blocks, in milliseconds. blk_write_timedouble precision The total time backends in this database spent writing data file blocks, in milliseconds. stats_resettimestamp 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_timedbigint The number of scheduled checkpoints performed. checkpoints_reqbigint The number of requested checkpoints performed. checkpoint_write_timedouble precision The total time spent writing files to disk during the file writing phase of a checkpoint, in milliseconds. checkpoint_sync_timedouble precision The total time spent synchronizing files to disk during the file synchronization phase of a checkpoint, in milliseconds. buffers_checkpointbigint The number of buffers written during checkpoints. buffers_cleanbigint The number of buffers written by the background writer. maxwritten_cleanbigint The number of times the background writer stopped a cleaning scan because it had written too many buffers. buffers_backendbigint The number of buffers written directly by backends. buffers_backend_fsyncbigint The number of times a backend had to execute its own fsync call. These calls are normally handled by the background writer. buffers_allocbigint The number of buffers allocated. stats_resettimestamp 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 datidoid OID of the database. datnamename Name of the database. pidinteger The backend's process ID. usesysidoid OID of the user logged in to this backend. usenamename Username of the user logged in to this backend. application_nametext Name of the application connected to this backend. client_addrinet Client IP address. client_hostnametext Hostname of the client machine. client_portinteger Client port number. backend_starttimestamp Start time of the backend process. xact_starttimestamp Start time of the current transaction. query_starttimestamp Start time of the currently active query. state_changetimestamp Time of the last state change. wait_event_typetext 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. Thewait_eventcolumn 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. Thewait_eventcolumn 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. Thewait_eventcolumn 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. Thewait_eventcolumn identifies the specific wait point.IPC: The server process is waiting for activity from another process in the server. Thewait_eventcolumn identifies the specific wait point.Timeout: The server process is waiting for a timeout to occur. Thewait_eventcolumn identifies the specific wait point.IO: The server process is waiting for an IO operation to complete. Thewait_eventcolumn identifies the specific wait point.
wait_eventtext Name of the wait event if the backend is waiting, or NULL otherwise. statetext Current state of this backend. backend_xidxid This backend's top-level transaction ID. backend_xminxid This backend's xminhorizon.querytext Text of the current SQL statement. backend_typetext Type of the current backend. queryidbigint Unique identifier of the SQL statement. wait_objecttext The object being waited for, if any. wait_typetext The type of object being waited for, if any. wait_time_msdouble The elapsed wait time in milliseconds, if any. cpu_userbigint User-mode CPU time used by this backend. cpu_sysbigint Kernel-mode CPU time used by this backend. rssbigint Memory usage of this backend. pfs_read_psbigint Cumulative number of PFS read IO operations. pfs_write_psbigint Cumulative number of PFS write IO operations. pfs_read_throughputbigint Cumulative PFS read IO throughput. pfs_write_throughputbigint Cumulative PFS write IO throughput. pfs_read_latency_msdouble PFS read IO latency. pfs_write_latency_msdouble PFS write IO latency. local_read_psbigint Cumulative number of read IO operations on the local file system. local_write_psbigint Cumulative number of write IO operations on the local file system. local_read_throughputbigint Cumulative read IO throughput on the local file system. local_write_throughputbigint Cumulative write IO throughput on the local file system. local_read_latency_msdouble Read IO latency on the local file system. local_write_latency_msdouble Write IO latency on the local file system. Wait event typeType Parameter Description LWLockShmemIndexLock 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. Lockrelation 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. BufferPinBufferPin Waiting to pin a buffer. ActivityArchiverMain 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. ClientClientRead 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. ExtensionExtension Waiting in an extension. IPCBgWorkerShutdown 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. TimeoutBaseBackupThrottle 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. IOBufFileRead 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 thepolar_monitorextension. 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 pidinteger Process ID. backend_typetext Type of the backend. cpu_userbigint User CPU time for the backend. cpu_sysbigint System CPU time for the backend. rssbigint Memory usage of the backend. local_read_psbigint Cumulative read I/O count on the local file system. local_write_psbigint Cumulative write I/O count on the local file system. local_read_throughputbigint Cumulative read I/O throughput on the local file system. local_write_throughputbigint Cumulative write I/O throughput on the local file system. local_read_latency_msdouble Read I/O latency on the local file system. local_write_latency_msdouble Write I/O latency on the local file system. Note Thepolar_stat_activity_rtview depends on thepolar_monitorplugin. Although this plugin is included by default with and databases, you must runcreate extension polar_monitorto enable it. - polar_delta
Important The
polar_deltafunction retrieves the incremental value of a view and depends on thepolar_monitorextension. This extension is included by default with and databases, but you must run thecreate extension polar_monitorcommand to enable it.Usage:- Create a view that contains dimension columns and value columns.
- Dimension column names must start with d.
- Value column names must start with v.
- Use the following commands to query the view:
select * from polar_delta (NULL::view_name) \watch 1 select * from polar_delta (NULL::view_name)
- Create a view that contains dimension columns and value columns.
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 shmnametext The name of the shared memory area. shmsizebigint The size of the shared memory, in bytes. shmtypetext The shared memory type. Note The polar_stat_shmem view depends on thepolar_monitorplugin. Although this plugin is included by default with and databases, you must run thecreate extension polar_monitorcommand to enable it. -
polar_stat_shmem_total_size
This view provides summary statistics for shared memory.Parameters Type Description shmsizebigint The size of the shared memory, in bytes. shmtypetext The shared memory type. Note The polar_stat_shmem_total_size view depends on thepolar_monitorplugin. Although this plugin is included by default with and databases, you must run thecreate extension polar_monitorcommand 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 pidinteger The session's process ID (PID). nametext The name of the memory context. levelint The level in the memory context hierarchy. nblocksbigint The number of allocated blocks. freechunksbigint The number of free blocks. totalspacebigint The total allocated space, in bytes. freespacebigint 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 pidinteger The process ID (PID). nametext The name of the memory context. nblocksbigint The number of allocated blocks. freechunksbigint The number of free blocks. totalspacebigint The total allocated space, in bytes. freespacebigint The total free space, in bytes. Note Thepolar_backends_mcxtview depends on thepolar_monitorplugin. This plugin is included by default with and , but you must run thecreate extension polar_monitorcommand to enable it.
- polar_get_mcxt() function
- 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 filetypetext The file type. fileloctext The file system where the file is located. This can be a local file system or the PFS shared file system. open_countnumeric The total number of file open operations. open_latency_usdouble The total latency of file open operations, in microseconds. close_countnumeric The total number of file close operations. read_countnumeric The total number of read operations. write_countnumeric The total number of write operations. read_throughputnumeric The total read throughput, in bytes. write_throughputnumeric The total write throughput, in bytes. read_latency_usdouble The total latency of read operations, in microseconds. write_latency_usdouble The total latency of write operations, in microseconds. seek_countnumeric The total number of seek operations. seek_latency_usdouble The total latency of seek operations, in microseconds. creat_countnumeric The total number of file create operations. creat_latency_usdouble The total latency of file create operations, in microseconds. fsync_countnumeric The total number of fsync operations. fsync_latency_usdouble The total latency of fsync operations, in microseconds. falloc_countnumeric The total number of falloc operations. falloc_latency_usdouble The total latency of falloc operations, in microseconds. Note This view requires thepolar_monitorplugin. The plugin is included by default with and , but you must runCREATE EXTENSION polar_monitorto 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 iokindtext The file operation type. Valid values: fsync,creat,seek,open,read,write, andfalloc.num_lessthan200usnumeric The total number of operations that took less than 200 microseconds. num_lessthan400usnumeric The total number of operations that took between 200 and 400 microseconds. num_lessthan600usnumeric The total number of operations that took between 400 and 600 microseconds. num_lessthan800usnumeric The total number of operations that took between 600 and 800 microseconds. num_lessthan1msnumeric The total number of operations that took between 800 microseconds and 1 millisecond. num_lessthan10msnumeric The total number of operations that took between 1 and 10 milliseconds. num_lessthan100msnumeric The total number of operations that took between 10 and 100 milliseconds. num_morethan100msnumeric The total number of operations that took longer than 100 milliseconds. Note This view requires thepolar_monitorplugin. The plugin is included by default with and , but you must runCREATE EXTENSION polar_monitorto enable it.
- polar_stat_io_info
- Network
You can obtain network monitoring data by querying the views described in this topic.
- The polar_proc_stat_network() function
Parameter Type Description pidbigint The process ID (PID). send_bytesbigint The total number of bytes sent. send_countbigint The total number of send operations. recv_bytesbigint The total number of bytes received. recv_countbigint The total number of receive operations. sendqbigint The length of the socket send queue. recvqbigint The length of the socket receive queue. cwndbigint The socket sliding window size. rttbigint The estimated network round-trip time (RTT) for TCP, in microseconds. retransbigint The total number of retransmissions. tcpinfo_update_timebigint The UNIX timestamp of the last update for TCP socket monitoring data. This value is updated approximately every second. The sendq,recvq,cwnd,rtt, andretranstcpinfo_update_timemetrics are captured at this time. - polar_stat_network
Provides summary network monitoring data. The following table describes the parameters:
Parameter Type Description send_countbigint The total number of send operations. send_bytesbigint The total number of bytes sent. recv_countbigint The total number of receive operations. recv_bytesbigint The total number of bytes received. retransbigint The total number of retransmissions. Note The polar_stat_network view depends on thepolar_monitorextension. This extension is included by default with and databases, but you must run the command to enable it.
- The polar_proc_stat_network() function
- 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 tranchesmallint The LWLock ID. nametext The LWLock name. sh_acquire_countbigint The total number of shared acquisitions. ex_acquire_countbigint The total number of exclusive acquisitions. block_countbigint The total number of times acquisition was blocked. lock_numsbigint The number of LWLocks. wait_timebigint The total wait time. Note The view depends on thepolar_monitor_preloadextension. This extension is included by default with and , but you must run the command to enable it. - Lock
- pg_locks
Parameter Type Description locktypetext The type of the lockable object: relation,extend,page,tuple,transactionid,virtualxid,object,userlock, oradvisory.databaseoid 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. relationoid The OID of the relation being locked. Null if the target is not a relation or part of one. pageinteger The page number of the locked page within the relation. Null if the target is not a relation page or tuple. tuplesmallint The index of the locked tuple on the page. Null if the target is not a tuple. virtualxidtext The virtual ID of the transaction being locked. Null if the target is not a virtual transaction ID. transactionidxid The ID of the transaction being locked. Null if the target is not a transaction ID. classidoid The OID of the system catalog containing the lock target. Null if the target is not a regular database object. objidoid The OID of the lock target within its system catalog. Null if the target is not a regular database object. objsubidsmallint 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. virtualtransactiontext The virtual ID of the transaction holding or waiting for the lock. pidinteger The Process ID (PID) of the server process holding or awaiting this lock. Null if this lock is held by a prepared transaction. modetext The lock mode held or desired by this process. grantedboolean True if the lock is granted; false if the process is waiting to acquire it. fastpathboolean 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 idinteger The primary key. lock_typetext The lock type. invalidnumeric Unused. accesssharelocknumeric The number of Access Share locks. rowsharelocknumeric The number of Row Share locks. rowexclusivelocknumeric The number of Row Exclusive locks. shareupdateexclusivelocknumeric The number of Share Update Exclusive locks. sharelocknumeric The number of Share locks. sharerowexclusivelocknumeric The number of Share Row Exclusive locks. exclusivelocknumeric The number of Exclusive locks. accessexclusivelocknumeric The number of Access Exclusive locks. block_countnumeric The number of times the lock was blocked. fastpath_countnumeric The number of local fast-path locks. wait_timenumeric The lock wait time. Note Thepolar_stat_lockview depends on thepolar_monitor_preloadextension. This extension is included by default with and , but you must run thecreate extension polar_monitor_preloadcommand to enable it.
- pg_locks
- LWLock
- 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_typetext The primary key of the view. slots_numberinteger Total number of pages. valid_pagesinteger Number of pages in use. empty_pagesinteger Number of empty pages. reading_pagesinteger Number of pages currently being read. writing_pagesinteger Number of pages currently being written. wait_readingsinteger Number of processes waiting to read. wait_writingsinteger Number of processes waiting to write. read_countbigint Number of read operations. read_only_countbigint Number of read-only operations. read_upgrade_countbigint Number of read operations upgraded to write operations. victim_countbigint Number of times a clean page was evicted. victim_write_countbigint Number of times a dirty page was evicted and written to disk. write_countbigint Number of write operations. zero_countbigint Number of times pages were zeroed out. flush_countbigint Number of flush operations. truncate_countbigint Number of truncate operations. storage_read_countbigint Number of read operations from storage. storage_write_countbigint Number of write operations to storage. Note Thepolar_stat_slruview requires thepolar_monitorplugin. Although this plugin is included by default in and databases, you must run thecreate extension polar_monitorcommand 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 subtypetext The cgroup type. Valid values: IO,Memory, andCPU.infotypetext The cgroup information. countbigint The count. Note The view depends on thepolar_monitor_preloadandpolar_monitorpolar_monitor_preloadpolar_monitorplugins. 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 subtypetext The cgroup type. Valid values: IO,Memory, andCPU.infotypetext The cgroup information. countbigint The limit. Note Thepolar_cgroup_quotaview depends on thepolar_monitorplugin. This plugin is included by default when you install or . However, you must enable it by running thecreate extension polar_monitorcommand.
- polar_stat_cgroup