This topic describes the views in PolarDB for PostgreSQL. You can query views to obtain instance details. This helps you troubleshoot performance issues.
Basic instance information
- pg_stat_databaseThe 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.
Parameter Type Description datidoid The object identifier (OID) of the database. datnamename The database name. numbackendsinteger The 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_commitbigint The total number of transactions that have been committed in the database. xact_rollbackbigint The total number of transactions that have been rolled back in the database. blks_readbigint The total number of disk blocks that have been physically read in the database. blks_hitbigint The 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 buffer. The hits in the file system buffer of the OS are ignored. tup_returnedbigint The number of rows returned by queries in the database. tup_fetchedbigint The number of rows fetched by queries in the database. tup_insertedbigint The number of rows inserted by queries in the database. tup_updatedbigint The number of rows updated by queries in the database. tup_deletedbigint The number of rows deleted by queries in the database. conflictsbigint The number of queries that are canceled due to the recovery of read-only node replay conflicts. temp_filesbigint The 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_filessettings are.temp_bytesbigint The 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_filessettings are.deadlocksbigint The number of deadlocks detected in the database. blk_read_timedouble precision The amount of time spent by backend servers for reading data files in the database. (Unit: milliseconds) blk_write_timedouble precision The time spent by backend servers for writing data files in the database. (Unit: milliseconds) stats_resettimestamp with time zone The latest time when the statistics were reset. - pg_stat_bgwriterThe pg_stat_bgwriter view contains only one row. This row contains the global data of the cluster.
Parameter Type Description checkpoints_timedbigint The number of checkpoints that have been performed. checkpoints_reqbigint The number of requested checkpoints that have been performed. checkpoint_write_timedouble precision The amount of time spent in writing the file to disks during checkpoints. (Unit: milliseconds) checkpoint_sync_timedouble precision The amount of time spent in synchronizing the file to disks during checkpoints. (Unit: milliseconds) buffers_checkpointbigint The number of buffers that are written during checkpoints. buffers_cleanbigint The number of buffers that are occupied by the background writer process. maxwritten_cleanbigint The number of times that the background writer process stops a cleaning scan because a large volume of data is written at a time. buffers_backendbigint The number of buffers that are directly written by a backend. buffers_backend_fsyncbigint The 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_allocbigint The number of allocated buffers. stats_resettimestamp with time zone The last time when the statistics were reset.
Activity status
- polar_stat_activityThe polar_stat_activity view displays the status of each process. It provides the cumulative sum for each process.
Parameter Type Description datidoid The OID of the database. datnamename The database name. pidinteger The ID of the process. usesysidoid The ID of the user. usenamename The user name. application_nametext The name of the application that is connected to the database. client_addrinet The IP address of the client that is connected to the database. client_hostnametext The host name of the connected client. client_portinteger The port that is used for the communications between the client and the database. backend_starttimestamp The time when the process is started. xact_starttimestamp The time when the current transaction of the process is started. query_starttimestamp The start time when the SQL statement is executed. state_changetimestamp The time when the status of the process is last changed. wait_event_typetext The 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. Thewait_eventparameter 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. Thewait_eventparameter 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_eventidentifies 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_eventidentifies the specific wait point.IPC: The server process is waiting for an activity from another process in the server.wait_eventidentifies the specific wait point.Timeout: The server process is waiting for a timeout.wait_eventidentifies the specific wait point.IO: The server process is waiting for an I/O request to complete.wait_eventidentifies the specific wait point.
wait_eventtext The name of the wait event. If the backend is not waiting for an event, NULL is returned. statetext The status of the process. backend_xidxid The transaction identifier (XID) of the client. backend_xminxid The xmin value of the client. querytext The executed SQL statement. backend_typetext The type of the backend process. queryidbigint The unique ID of the SQL statement. wait_objecttext The wait object. This parameter is returned when the backend is waiting for an event. wait_typetext The type of the wait object. This parameter is returned when the backend is waiting for an event. wait_time_msdouble The wait time that is spent. This parameter is returned when the backend is waiting for an event. cpu_userbigint The user CPU utilization of the backend server. cpu_sysbigint The system CPU utilization of the backend server. rssbigint The memory usage of the backend server. pfs_read_psbigint The cumulative sum of read operations on a Polar file system (PFS). pfs_write_psbigint The cumulative sum of write operations on a PFS. pfs_read_throughputbigint The cumulative sum of the read throughput of a PFS. pfs_write_throughputbigint The cumulative sum of the write throughput of a PFS. pfs_read_latency_msdouble The latency of the read operation on a PFS. pfs_write_latency_msdouble The latency of the write operation on a PFS. local_read_psbigint The cumulative sum of read operations on a local file system. local_write_psbigint The cumulative sum of write operations on a local file system. local_read_throughputbigint The cumulative sum of the read throughput of a local file system. local_write_throughputbigint The cumulative sum of the write throughput of a local file system. local_read_latency_msdouble The latency of the read operation on a local file system. local_write_latency_msdouble The latency of the write operation on a local file system. Wait eventsWait event type Wait event name Description LWLockShmemIndexLock The program is waiting to find or allocate space in shared memory. OidGenLock The program is waiting to allocate or assign an OID. XidGenLock The program is waiting to allocate or assign an XID. ProcArrayLock The program is waiting to obtain a snapshot or clear an XID at the end of a transaction. SInvalReadLock The program is waiting to retrieve or remove a message from an invalid shared message queue. SInvalWriteLock The program is waiting to add a message to an invalid shared message queue. WALBufMappingLock The program is waiting to replace a page in a write-ahead logging (WAL) buffer. WALWriteLock The program is waiting for a WAL buffer to be written to a disk. ControlFileLock The program is waiting to read or update the control file or create a WAL file. CheckpointLock The program is waiting to perform a checkpoint operation. CLogControlLock The program is waiting to read or update the transaction status. SubtransControlLock The program is waiting to read or update sub-transaction information. MultiXactGenLock The program is waiting to read or update the shared multixact status. MultiXactOffsetControlLock The program is waiting to read or update multixact offset mappings. MultiXactMemberControlLock The program is waiting to read or update multixact member mappings. RelCacheInitLock The program is waiting to read or write a relation-cache initialization file. CheckpointerCommLock The program is waiting to manage fsync() calls. TwoPhaseStateLock The program is waiting to read or update the status of a prepared transaction. TablespaceCreateLock The program is waiting to create or drop a tablespace. BtreeVacuumLock The program is waiting to read or update vacuum-related information for a B-tree index. AddinShmemInitLock The program is waiting to manage space allocation in shared memory. AutovacuumLock The autovacuum worker or launcher is waiting to update or read the status of the autovacuum worker. AutovacuumScheduleLock The program is waiting to confirm that the table selected for a vacuum still needs vacuuming. SyncScanLock The program is waiting to obtain the start location of a scan on a table for synchronized scans. RelationMappingLock The program is waiting to update the relation mapping file used to store the catalog to filenode mappings. AsyncCtlLock The program is waiting to read or update the shared notification status. AsyncQueueLock The program is waiting to read or update notification messages. SerializableXactHashLock The program is waiting to retrieve or store information about serializable transactions. SerializableFinishedListLock The program is waiting to access finished serializable transactions. SerializablePredicateLockListLock The program is waiting to perform an operation on locks held by serializable transactions. OldSerXidLock The program is waiting to read or record conflicting serializable transactions. SyncRepLock The program is waiting to read or update information about synchronous replicas. BackgroundWorkerLock The program is waiting to read or update the backend worker status. DynamicSharedMemoryControlLock The program is waiting to read or update the status of the dynamic shared memory. AutoFileLock The program is waiting to update the postgresql.auto.conf file. ReplicationSlotAllocationLock The program is waiting to allocate or drop a replication slot. ReplicationSlotControlLock The program is waiting to read or update the status of a replication slot. CommitTsControlLock The program is waiting to read or update transaction commit timestamps. CommitTsLock The program is waiting to read or update the last value set for the transaction timestamp. ReplicationOriginLock The program is waiting to set up, drop, or use the replication origin. MultiXactTruncationLock The program is waiting to read or truncate multixact information. OldSnapshotTimeMapLock The program is waiting to read or update control information about old snapshots. BackendRandomLock The program is waiting to generate a random number. LogicalRepWorkerLock The program is waiting for an action on a logical replication worker to complete. CLogTruncationLock The program is waiting to truncate a WAL file or waiting for the truncation of a WAL file to complete. clog The backend is waiting for I/O requests on a commit log (CLOG) buffer. A CLOG records the commit status of a transaction. commit_timestamp The program is waiting for I/O requests on a commit timestamp buffer. subtrans The program is waiting for I/O requests on a subtransaction buffer. multixact_offset The program is waiting for I/O requests on a multixact offset buffer. multixact_member The program is waiting for I/O requests on a multixact member buffer. async The program is waiting for I/O requests on an async buffer. oldserxid The program is waiting for I/O requests on an oldserxid buffer. wal_insert The program is waiting to insert a WAL file into a memory buffer. buffer_content The program is waiting to read or write a data page in memory. buffer_io The program is waiting for I/O requests on a data page. replication_origin The program is waiting to read or update the replication progress. replication_slot_io The program is waiting for I/O requests on a replication slot. proc The program is waiting to read or update the fast-path lock information. buffer_mapping The program is waiting to associate a data block with a buffer in a buffer pool. lock_manager The 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_manager The program is waiting to add or check information about a predicate lock. parallel_query_dsa The program is waiting for the dynamic shared memory allocation lock for parallel execution. tbm The program is waiting for the shared iterator lock for a TIDBitmap. parallel_append The program is waiting to select the next subplan while the Parallel Append plan is being executed. parallel_hash_join The program is waiting to allocate or exchange a chunk of memory or update counters while the Parallel Hash plan is being executed. Lockrelation The program is waiting to obtain the lock on a relation. extend The program is waiting to extend a relation. page The program is waiting to obtain the lock on the page of a relation. tuple The program is waiting to obtain the lock on a tuple. transactionid The program is waiting for a transaction to complete. virtualxid The program is waiting to obtain a virtual XID lock. speculative token The program is waiting to obtain a speculative insertion lock. object The program is waiting to obtain the lock on a non-relational database object. userlock The program is waiting to obtain a user lock. advisory The program is waiting to obtain an advisory user lock. BufferPinBufferPin The program is waiting to pin a buffer. ActivityArchiverMain The program is waiting in the main loop of the archiver process. AutoVacuumMain The program is waiting in the main loop of the autovacuum launcher process. BgWriterHibernate The program is waiting in the background writer process while the instance is in hibernation. BgWriterMain The program is waiting in the main loop of the background worker of the background worker process. CheckpointerMain The program is waiting in the main loop of the checkpointer process. LogicalApplyMain The program is waiting in the main loop of the logical apply process. LogicalLauncherMain The program is waiting in the main loop of the logical launcher process. PgStatMain The program is waiting in the main loop of the statistics collector process. RecoveryWalAll The 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. RecoveryWalStream The program is waiting for the WAL data from a stream while the instance is being restored. SysLoggerMain The program is waiting in the main loop of the syslog process. WalReceiverMain The program is waiting in the main loop of the WAL receiver process. WalSenderMain The program is waiting in the main loop of the WAL sender process. WalWriterMain The program is waiting in the main loop of the WAL writer process. ClientClientRead The program is waiting to read data from the client. ClientWrite The program is waiting to write data to the client. LibPQWalReceiverConnect The program is waiting in the WAL receiver process to connect to a remote server. LibPQWalReceiverReceive The program is waiting in the WAL receiver process to receive data from a remote server. SSLOpenServer The program is waiting for SSL while a connection is being established. WalReceiverWaitStart The program is waiting for the startup process to send the initial data for streaming replication. WalSenderWaitForWAL The program is waiting for the WAL data to be flushed in the WAL sender process. WalSenderWriteData The program is waiting for an activity that occurs while the replies from the WAL receiver are being processed in the WAL sender process. ExtensionExtension The program is waiting in an extension. IPCBgWorkerShutdown The program is waiting for the background worker to shut down. BgWorkerStartup The program is waiting for the background worker to start up. BtreePage The program is waiting for the page number that is required for continuing to scan B-trees in parallel to become available. ClogGroupUpdate The program is waiting for the group leader to update the status of a transaction when the transaction ends. ExecuteGather The program is waiting for an activity from a child process while a Gather node is being executed. Hash/Batch/Allocating The program is waiting for an elected Parallel Hash participant to allocate hash tables. Hash/Batch/Electing The program is waiting for a Parallel Hash participant to be elected to allocate hash tables. Hash/Batch/Loading The program is waiting for other Parallel Hash participants to finish loading hash tables. Hash/Build/Allocating The program is waiting for an elected Parallel Hash participant to allocate the initial hash table. Hash/Build/Electing The program is waiting for a Parallel Hash participant to be elected to allocate the initial hash table. Hash/Build/HashingInner The program is waiting for other Parallel Hash participants to complete the hash operations on inner relations. Hash/Build/HashingOuter The program is waiting for other Parallel Hash participants to complete the hash operations on outer relations. Hash/GrowBatches/Allocating The program is waiting for an elected Parallel Hash participant to allocate more batches of hash tables. Hash/GrowBatches/Deciding The program is waiting for a Parallel Hash participant to be elected to determine the increase of hash table batches. Hash/GrowBatches/Electing The program is waiting for a Parallel Hash participant to be elected to allocate more batches of hash tables. Hash/GrowBatches/Finishing The program is waiting for an elected Parallel Hash participant to determine the increase of hash table batches. Hash/GrowBatches/Repartitioning The program is waiting for other Parallel Hash participants to finish repartitioning. Hash/GrowBuckets/Allocating The program is waiting for an elected Parallel Hash participant to finish allocating more buckets. Hash/GrowBuckets/Electing The program is waiting for a Parallel Hash participant to be elected to allocate more buckets. Hash/GrowBuckets/Reinserting The program is waiting for other Parallel Hash participants to insert tuples into new buckets. LogicalSyncData The program is waiting for the remote server for logical replication to send data that is used to synchronize the initial table. LogicalSyncStateChange The program is waiting for the status of the remote server for logical replication to change. MessageQueueInternal The program is waiting for other processes to be added into a shared message queue. MessageQueuePutMessage The program is waiting to write a protocol message to a shared message queue. MessageQueueReceive The program is waiting to receive bytes from a shared message queue. MessageQueueSend The program is waiting to send bytes to a shared message queue. ParallelBitmapScan The program is waiting for the parallel scan of a bitmap to be initialized. ParallelCreateIndexScan The program is waiting for CREATE INDEX parallel workers to complete heap scans. ParallelFinish The program is waiting for parallel workers to finish computing. ProcArrayGroupUpdate The program is waiting for the group leader to clear the XID after a transaction is complete. ReplicationOriginDrop The program is waiting for a replication origin to become inactive so that the replication origin can be deleted. ReplicationSlotDrop The program is waiting for a replication slot to become inactive so that the replication slot can be deleted. SafeSnapshot The program is waiting for a snapshot that can be used in a READ ONLY DEFERRABLE transaction. SyncRep The program is waiting for a confirmation from the remote server during the synchronous replication. TimeoutBaseBackupThrottle The program is waiting in the base backup phase while a throttling activity is in progress. PgSleep The program is waiting in the process that calls the pg_sleep function. RecoveryApplyDelay The program is waiting to apply WAL while data is being restored because WAL is delayed to be applied. IOBufFileRead The program is waiting to read data from a buffered file. BufFileWrite The program is waiting to write data to a buffered file. ControlFileRead The program is waiting to read data from the control file. ControlFileSync The program is waiting for the control file to reach stable storage. ControlFileSyncUpdate The program is waiting for an update to the control file to reach stable storage. ControlFileWrite The program is waiting to write data to the control file. ControlFileWriteUpdate The program is waiting to write data to update the control file. CopyFileRead The program is waiting to read data while a file is being copied. CopyFileWrite The program is waiting to write data while a file is being copied. DataFileExtend The program is waiting for a relation data file to be extended. DataFileFlush The program is waiting for a relation data file to reach stable storage. DataFileImmediateSync The program is waiting for a relation data file to be immediately synchronized to reach stable storage. DataFilePrefetch The program is waiting for an asynchronous prefetch from a relation data file. DataFileRead The program is waiting to read data from a relation data file. DataFileSync The program is waiting for changes to a relation data file to reach stable storage. DataFileTruncate The program is waiting for a relation data file to be truncated. DataFileWrite The program is waiting to write data to a relation data file. DSMFillZeroWrite The program is waiting to write 0 bytes to a backup file in dynamic shared memory. LockFileAddToDataDirRead The program is waiting to read data while a row of data is being added to the data directory lock file. LockFileAddToDataDirSync The 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. LockFileAddToDataDirWrite The program is waiting to write data while a row of data is being added to the data directory lock file. LockFileCreateRead The program is waiting to read data while the data directory lock file is being created. LockFileCreateSync The program is waiting for data to reach stable storage while the data directory lock file is being created. LockFileCreateWrite The program is waiting to write data while the data directory lock file is being created. LockFileReCheckDataDirRead The program is waiting to read data while the data directory lock file is being rechecked. LogicalRewriteCheckpointSync The program is waiting for logical rewrite mappings to reach stable storage during a checkpoint. LogicalRewriteMappingSync The program is waiting for mapping data to reach stable storage during a logical rewrite operation. LogicalRewriteMappingWrite The program is waiting to write mapping data during a logical rewrite operation. LogicalRewriteSync The program is waiting for logical rewrite mappings to reach stable storage. LogicalRewriteWrite The program is waiting to write data to logical rewrite mappings. RelationMapRead The program is waiting to read data from the relation mapping file. RelationMapSync The program is waiting for the relation mapping file to reach stable storage. RelationMapWrite The program is waiting to write data to the relation mapping file. ReorderBufferRead The program is waiting to read data during reorder buffer management. ReorderBufferWrite The program is waiting to write data during reorder buffer management. ReorderLogicalMappingRead The program is waiting to read data from a logical mapping during reorder buffer management. ReplicationSlotRead The program is waiting to read data from the control file of a replication slot. ReplicationSlotRestoreSync The program is waiting for the control file of a replication slot to reach stable storage while the file is being restored to the memory. ReplicationSlotSync The program is waiting for the control file of a replication slot to reach stable storage. ReplicationSlotWrite The program is waiting to write data to the control file of a replication slot. SLRUFlushSync The program is waiting for Segmented Least Recently Used (SLRU) data to reach stable storage during a checkpoint or database shutdown period. SLRURead The program is waiting to read data from an SLRU page. SLRUSync The program is waiting for SLRU data to reach stable storage after a write operation is performed on a page. SLRUWrite The program is waiting to write data to an SLRU page. SnapbuildRead The program is waiting to read data from a serialized historical catalog snapshot. SnapbuildSync The program is waiting for a serialized historical catalog snapshot to reach stable storage. SnapbuildWrite The program is waiting to write data to a serialized historical catalog snapshot. TimelineHistoryFileSync The program is waiting for a timeline history file that is received by using streaming replication to reach stable storage. TimelineHistoryFileWrite The program is waiting to read data from a timeline history file that is received by using streaming replication. TimelineHistoryRead The program is waiting to read data from a timeline history file. TimelineHistorySync The program is waiting for a newly created timeline history file to reach stable storage. TimelineHistoryWrite The program is waiting to write data to a newly created timeline history file. TwophaseFileRead The program is waiting to read data from a two-phase state file. TwophaseFileSync The program is waiting for a two-phase state file to reach stable storage. TwophaseFileWrite The program is waiting to write data to a two-phase state file. WALBootstrapSync The program is waiting for WAL data to reach stable storage during bootstrapping. WALBootstrapWrite The program is waiting to write data to a WAL page during bootstrapping. WALCopyRead The program is waiting to read data while a WAL segment is being created by copying an existing WAL segment. WALCopySync The program is waiting for a WAL segment that is created by copying an existing WAL segment to reach stable storage. WALCopyWrite The program is waiting to write data while a WAL segment is being created by copying an existing WAL segment. WALInitSync The program is waiting for a newly initialized WAL file to reach stable storage. WALInitWrite The program is waiting to write data while a new WAL file is being initialized. WALRead The program is waiting to read data from a WAL file. WALSenderTimelineHistoryRead The program is waiting to read data from a timeline history file while the walsender timeline command is being run. WALSyncMethodAssign The program is waiting for data to reach stable storage while the WAL sync method is being assigned. WALWrite The program is waiting to write data to a WAL file. Note The polar_stat_activity view is provided by thepolar_monitorplug-in. This plug-in is built into PolarDB for PostgreSQL. To activate this plug-in, execute the create extension polar_monitor statement. - polar_stat_activity_rtThe polar_stat_activity_rt view provides real-time data of the status of all processes.
Parameter Type Description pidinteger The ID of the process. backend_typetext The type of the backend process. cpu_userbigint The user CPU utilization of the backend server. cpu_sysbigint The system CPU utilization of the backend server. rssbigint The memory usage of the backend server. local_read_psbigint The cumulative sum of read operations on a local file system. local_write_psbigint The cumulative sum of write operations on a local file system. local_read_throughputbigint The cumulative sum of the read throughput of a local file system. local_write_throughputbigint The cumulative sum of the write throughput of a local file system. local_read_latency_msdouble The latency of the read operation on a local file system. local_write_latency_msdouble The latency of the write operation on a local file system. Note The polar_stat_activity_rt view is provided by thepolar_monitorplug-in. This plug-in is built into PolarDB for PostgreSQL. To activate this plug-in, execute thecreate extension polar_monitorstatement. - polar_deltaImportant
polar_deltais a function used to query the incremental values of a view. This function is provided by thepolar_monitorplug-in. This plug-in is built into PolarDB for PostgreSQL. To activate this plug-in, execute thecreate extension polar_monitorstatement.To use the polar_delta function, perform the following instructions:- 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.
- Execute the following statements 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 a column for dimensions and a column for values.
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.Parameter Type Description shmnametext The name of the shared memory. shmsizebigint The size of the shared memory. (Unit: bytes) shmtypetext The type of the shared memory. Note The polar_stat_shmem view is provided by thepolar_monitorplug-in. This plug-in is built into PolarDB for PostgreSQL. To activate this plug-in, execute thecreate extension polar_monitorstatement.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.Parameter Type Description shmsizebigint The size of the shared memory. (Unit: bytes) shmtypetext The type of the shared memory. Note The polar_stat_shmem_total_size view is provided by thepolar_monitorplug-in. This plug-in is built into PolarDB for PostgreSQL. To activate this plug-in, execute thecreate extension polar_monitorstatement.
- 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
Parameter Type Description pidinteger The ID of the session process. nametext The name of the context-dependent memory. levelint The level of the context-dependent memory. nblocksbigint The number of the occupied blocks. freechunksbigint The number of the free blocks. totalspacebigint The total memory. (Unit: bytes) freespacebigint The 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.Parameter Type Description pidinteger The ID of the process. nametext The name of the context-dependent memory. nblocksbigint The number of the occupied blocks. freechunksbigint The number of the free blocks. totalspacebigint The total memory. (Unit: bytes) freespacebigint The free memory. (Unit: bytes) Note The polar_backends_mcxt view is provided by thepolar_monitorplug-in. This plug-in is built into PolarDB for PostgreSQL. To activate this plug-in, execute thecreate extension polar_monitorstatement.
- polar_get_mcxt() function
- 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_infoThe 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.
Parameter Type Description filetypetext The type of the file. fileloctext The 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_countnumeric The number of times the file has been opened. open_latency_usdouble The total latency for opening the file. (Unit: microseconds) close_countnumeric The number of times the file has been closed. read_countnumeric The number of times the file has been read. write_countnumeric The number of times the file has been written. read_throughputnumeric The read throughput of the file system. write_throughputnumeric The write throughput of the file system. read_latency_usdouble The total latency for reading the file. (Unit: microseconds) write_latency_usdouble The total latency for writing data to the file. (Unit: microseconds) seek_countnumeric The number of times that you called the seek() function. seek_latency_usdouble The total latency for calling the seek() function. creat_countnumeric The number of times that you created a file. creat_latency_usdouble The total latency for creating a file. fsync_countnumeric The number of times that you called the fsync() function. fsync_latency_usdouble The total latency for calling the fsync() function. falloc_countnumeric The number of times that you called the fallocate() function. falloc_latency_usdouble The total latency for calling the fallocate() function. Note The polar_stat_io_info view is provided by thepolar_monitorplug-in. This plug-in is built into PolarDB for PostgreSQL. To activate this plug-in, execute thecreate extension polar_monitorstatement. - polar_stat_io_latencyThe polar_stat_io_latency view provides I/O latency information grouped by I/O types. The following table describes the parameters in this view.
Parameter Type Description iokindtext The type of the operation on a file. Valid values: fsync,creat,seek,open,read,write,falloc.num_lessthan200usnumeric The number of times that the I/O latency is less than 200 microseconds. num_lessthan400usnumeric The number of times that the I/O latency is greater than 200 microseconds but less than 400 microseconds. num_lessthan600usnumeric The number of times that the I/O latency is greater than 400 microseconds but less than 600 microseconds. num_lessthan800usnumeric The number of times that the I/O latency is greater than 600 microseconds but less than 800 microseconds. num_lessthan1msnumeric The number of times that the I/O latency is greater than 800 microseconds but less than 1 millisecond. num_lessthan10msnumeric The number of times that the I/O latency is greater than 1 millisecond but less than 10 milliseconds. num_lessthan100msnumeric The number of times that the I/O latency is greater than 10 milliseconds but less than 100 milliseconds. num_morethan100msnumeric The number of times that the I/O latency is greater than 100 milliseconds. Note The polar_stat_io_latency view is provided by thepolar_monitorplug-in. This plug-in is built into PolarDB for PostgreSQL. To activate this plug-in, execute thecreate extension polar_monitorstatement.
- polar_stat_io_info
- Network
You can query the following functions and views to obtain network monitoring information.
- polar_proc_stat_network() function
Parameter Type Description pidbigint The ID of the process. send_bytesbigint The total number of bytes sent. send_countbigint The cumulative number of sending times. recv_bytesbigint The total number of bytes received. recv_countbigint The cumulative number of receiving times. sendqbigint The length of the sending queue over the socket. recvqbigint The length of the receiving queue over the socket. cwndbigint The length of the sliding window of the socket. rttbigint The round-trip time (RTT) of TCP packets. (Unit: microseconds) retransbigint The cumulative number of times that data is retransmitted. tcpinfo_update_timebigint The 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, andretransmetrics are updated regularly, and their update time is displayed by this parameter. - polar_stat_networkThe polar_stat_network view provides network monitoring information. The following table describes the parameters in this view.
Parameter Type Description send_countbigint The number of times that the system sends network traffic. send_bytesbigint The amount of outbound traffic. (Unit: bytes) recv_countbigint The number of times that the system receives network traffic. recv_bytesbigint The amount of inbound traffic. (Unit: bytes) retransbigint The number of times that data is retransmitted. Note The polar_stat_network view is provided by thepolar_monitorplug-in. This plug-in is built into PolarDB for PostgreSQL. To activate this plug-in, execute the create extension polar_monitor statement.
- polar_proc_stat_network() function
- 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.Parameter Type Description tranchesmallint The ID of the lock. nametext The name of the lock. sh_acquire_countbigint The number of times that the system acquires a shared lock. ex_acquire_countbigint The number of times that the system acquires an exclusive lock. block_countbigint The number of blocks that occurred. lock_numsbigint The number of lightweight locks. wait_timebigint The total lock wait time. Note The polar_stat_lwlock view is provided by thepolar_monitor_preloadplug-in. This plug-in is built into PolarDB for PostgreSQL. To activate this plug-in, execute the create extension polar_monitor_preload statement. - Lock
- pg_locks
Parameter Type Description locktypetext The type of the lockable object. Valid values: relation, extend, page, tuple, transactionid, virtualxid, object, userlock, and advisory. databaseoid The 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. relationoid The 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. pageinteger The 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. tuplesmallint The 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. virtualxidtext The virtual ID of the transaction to be locked. If the object to be locked is not a virtual XID, the value is NULL. transactionidxid The ID of the transaction to be locked. If the object to be locked is not an XID, the value is NULL. classidoid The 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. objidoid The ID of the object to be locked within the system catalog. If the object is not a general database object, the value is NULL. objsubidsmallint The 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. virtualtransactiontext The virtual ID of the transaction that holds the lock or is waiting for the lock. pidinteger The 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. modetext The name of the lock mode that is held or desired by this process. grantedboolean If the lock is held, the value is true. If the lock is waited for, the value is false. fastpathboolean If 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_lockThe polar_stat_lock view provides lock statistics. The following table describes the parameters in this view.
Parameter Type Description idinteger The primary key of the table. lock_typetext The type of the lock. invalidnumeric Indicates that the lock is invalid. 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 blocks caused by locks. fastpath_countnumeric The number of fast-path locks on a local system. wait_timenumeric The lock wait time. Note The polar_stat_lock view is provided by thepolar_monitor_preloadplug-in. This plug-in is built into PolarDB for PostgreSQL. To activate this plug-in, execute thecreate extension polar_monitor_preloadstatement.
- pg_locks
- LWLock
- 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.Parameter Type Description slru_typetext The primary key of the table. slots_numberinteger The number of pages. valid_pagesinteger The number of the used pages. empty_pagesinteger The number of the empty pages. reading_pagesinteger The number of the pages on which the read operations are being performed. writing_pagesinteger The number of the pages on which the write operations are being performed. wait_readingsinteger The number of the wait events for read operations. wait_writingsinteger The number of the wait events for write operations. read_countbigint The number of the read operations. read_only_countbigint The number of the read-only operations. read_upgrade_countbigint The number of the read operations in the upgrade mode. victim_countbigint The number of times that data is evicted from caches. victim_write_countbigint The number of times that data is evicted from caches and then is written to disks. write_countbigint The number of the write operations. zero_countbigint The number of times that the cache data is cleared. flush_countbigint The number of the flush operations. truncate_countbigint The number of the truncate operations. storage_read_countbigint The number of times that you read data from disks. storage_write_countbigint The number of times that you write data to disks. Note The polar_stat_slru view is provided by thepolar_monitorplug-in. This plug-in is built into PolarDB for PostgreSQL. To activate this plug-in, execute thecreate extension polar_monitorstatement. - 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.
Parameter Type Description subtypetext The type of the cgroup. Valid values: IO, Memory, and CPU. infotypetext The information about the cgroup. countbigint The statistics about the used resources. Note The polar_stat_cgroup view is provided by thepolar_monitor_preloadandpolar_monitorplug-ins. These plug-ins are built into PolarDB for PostgreSQL. To activate the plug-ins, execute the create extension polar_monitor_preload and create extension polar_monitor statements. - polar_cgroup_quotaThe polar_cgroup_quota provides statistics about system resources and cgroup quotas. The following table describes the parameters in this view.
Parameter Type Description subtypetext The type of a cgroup. Valid values: IO, Memory, and CPU. infotypetext The information about cgroups. countbigint The quota of a cgroup. Note The polar_cgroup_quota view is provided by thepolar_monitorplug-in. This plug-in is built into PolarDB for PostgreSQL. To activate this plug-in, execute thecreate extension polar_monitorstatement.
- polar_stat_cgroup