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 datid
oid The object identifier (OID) of the database. datname
name The database name. numbackends
integer 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_commit
bigint The total number of transactions that have been committed in the database. xact_rollback
bigint The total number of transactions that have been rolled back in the database. blks_read
bigint The total number of disk blocks that have been physically read in the database. blks_hit
bigint 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_returned
bigint The number of rows returned by queries in the database. tup_fetched
bigint The number of rows fetched by queries in the database. tup_inserted
bigint The number of rows inserted by queries in the database. tup_updated
bigint The number of rows updated by queries in the database. tup_deleted
bigint The number of rows deleted by queries in the database. conflicts
bigint The number of queries that are canceled due to the recovery of read-only node replay conflicts. temp_files
bigint The number of temporary files created by queries in the database. All temporary files are counted regardless of why the files are created and regardless of what the log_temp_files
settings are.temp_bytes
bigint The total amount of data written to temporary files by queries in the database. All temporary files are counted regardless of why the files are created and regardless of what the log_temp_files
settings are.deadlocks
bigint The number of deadlocks detected in the database. blk_read_time
double precision The amount of time spent by backend servers for reading data files in the database. (Unit: milliseconds) blk_write_time
double precision The time spent by backend servers for writing data files in the database. (Unit: milliseconds) stats_reset
timestamp 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_timed
bigint The number of checkpoints that have been performed. checkpoints_req
bigint The number of requested checkpoints that have been performed. checkpoint_write_time
double precision The amount of time spent in writing the file to disks during checkpoints. (Unit: milliseconds) checkpoint_sync_time
double precision The amount of time spent in synchronizing the file to disks during checkpoints. (Unit: milliseconds) buffers_checkpoint
bigint The number of buffers that are written during checkpoints. buffers_clean
bigint The number of buffers that are occupied by the background writer process. maxwritten_clean
bigint 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_backend
bigint The number of buffers that are directly written by a backend. buffers_backend_fsync
bigint 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_alloc
bigint The number of allocated buffers. stats_reset
timestamp 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 datid
oid The OID of the database. datname
name The database name. pid
integer The ID of the process. usesysid
oid The ID of the user. usename
name The user name. application_name
text The name of the application that is connected to the database. client_addr
inet The IP address of the client that is connected to the database. client_hostname
text The host name of the connected client. client_port
integer The port that is used for the communications between the client and the database. backend_start
timestamp The time when the process is started. xact_start
timestamp The time when the current transaction of the process is started. query_start
timestamp The start time when the SQL statement is executed. state_change
timestamp The time when the status of the process is last changed. wait_event_type
text 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_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. Thewait_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_event
text The name of the wait event. If the backend is not waiting for an event, NULL is returned. state
text The status of the process. backend_xid
xid The transaction identifier (XID) of the client. backend_xmin
xid The xmin value of the client. query
text The executed SQL statement. backend_type
text The type of the backend process. queryid
bigint The unique ID of the SQL statement. wait_object
text The wait object. This parameter is returned when the backend is waiting for an event. wait_type
text The type of the wait object. This parameter is returned when the backend is waiting for an event. wait_time_ms
double The wait time that is spent. This parameter is returned when the backend is waiting for an event. cpu_user
bigint The user CPU utilization of the backend server. cpu_sys
bigint The system CPU utilization of the backend server. rss
bigint The memory usage of the backend server. pfs_read_ps
bigint The cumulative sum of read operations on a Polar file system (PFS). pfs_write_ps
bigint The cumulative sum of write operations on a PFS. pfs_read_throughput
bigint The cumulative sum of the read throughput of a PFS. pfs_write_throughput
bigint The cumulative sum of the write throughput of a PFS. pfs_read_latency_ms
double The latency of the read operation on a PFS. pfs_write_latency_ms
double The latency of the write operation on a PFS. local_read_ps
bigint The cumulative sum of read operations on a local file system. local_write_ps
bigint The cumulative sum of write operations on a local file system. local_read_throughput
bigint The cumulative sum of the read throughput of a local file system. local_write_throughput
bigint The cumulative sum of the write throughput of a local file system. local_read_latency_ms
double The latency of the read operation on a local file system. local_write_latency_ms
double The latency of the write operation on a local file system. Wait eventsWait event type Wait event name Description LWLock
ShmemIndexLock 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. Lock
relation 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. BufferPin
BufferPin The program is waiting to pin a buffer. Activity
ArchiverMain 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. Client
ClientRead 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. Extension
Extension The program is waiting in an extension. IPC
BgWorkerShutdown 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. Timeout
BaseBackupThrottle 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. IO
BufFileRead 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_monitor
plug-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 pid
integer The ID of the process. backend_type
text The type of the backend process. cpu_user
bigint The user CPU utilization of the backend server. cpu_sys
bigint The system CPU utilization of the backend server. rss
bigint The memory usage of the backend server. local_read_ps
bigint The cumulative sum of read operations on a local file system. local_write_ps
bigint The cumulative sum of write operations on a local file system. local_read_throughput
bigint The cumulative sum of the read throughput of a local file system. local_write_throughput
bigint The cumulative sum of the write throughput of a local file system. local_read_latency_ms
double The latency of the read operation on a local file system. local_write_latency_ms
double The latency of the write operation on a local file system. Note The polar_stat_activity_rt view is provided by thepolar_monitor
plug-in. This plug-in is built into PolarDB for PostgreSQL. To activate this plug-in, execute thecreate extension polar_monitor
statement. - polar_deltaImportant
polar_delta
is a function used to query the incremental values of a view. This function is provided by thepolar_monitor
plug-in. This plug-in is built into PolarDB for PostgreSQL. To activate this plug-in, execute thecreate extension polar_monitor
statement.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 shmname
text The name of the shared memory. shmsize
bigint The size of the shared memory. (Unit: bytes) shmtype
text The type of the shared memory. Note The polar_stat_shmem view is provided by thepolar_monitor
plug-in. This plug-in is built into PolarDB for PostgreSQL. To activate this plug-in, execute thecreate 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.Parameter Type Description shmsize
bigint The size of the shared memory. (Unit: bytes) shmtype
text The type of the shared memory. Note The polar_stat_shmem_total_size view is provided by thepolar_monitor
plug-in. This plug-in is built into PolarDB for PostgreSQL. To activate this plug-in, execute thecreate 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
Parameter Type Description pid
integer The ID of the session process. name
text The name of the context-dependent memory. level
int The level of the context-dependent memory. nblocks
bigint The number of the occupied blocks. freechunks
bigint The number of the free blocks. totalspace
bigint The total memory. (Unit: bytes) freespace
bigint 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 pid
integer The ID of the process. name
text The name of the context-dependent memory. nblocks
bigint The number of the occupied blocks. freechunks
bigint The number of the free blocks. totalspace
bigint The total memory. (Unit: bytes) freespace
bigint The free memory. (Unit: bytes) Note The polar_backends_mcxt view is provided by thepolar_monitor
plug-in. This plug-in is built into PolarDB for PostgreSQL. To activate this plug-in, execute thecreate extension polar_monitor
statement.
- 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 filetype
text The type of the file. fileloc
text 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_count
numeric The number of times the file has been opened. open_latency_us
double The total latency for opening the file. (Unit: microseconds) close_count
numeric The number of times the file has been closed. read_count
numeric The number of times the file has been read. write_count
numeric The number of times the file has been written. read_throughput
numeric The read throughput of the file system. write_throughput
numeric The write throughput of the file system. read_latency_us
double The total latency for reading the file. (Unit: microseconds) write_latency_us
double The total latency for writing data to the file. (Unit: microseconds) seek_count
numeric The number of times that you called the seek() function. seek_latency_us
double The total latency for calling the seek() function. creat_count
numeric The number of times that you created a file. creat_latency_us
double The total latency for creating a file. fsync_count
numeric The number of times that you called the fsync() function. fsync_latency_us
double The total latency for calling the fsync() function. falloc_count
numeric The number of times that you called the fallocate() function. falloc_latency_us
double The total latency for calling the fallocate() function. Note The polar_stat_io_info view is provided by thepolar_monitor
plug-in. This plug-in is built into PolarDB for PostgreSQL. To activate this plug-in, execute thecreate extension polar_monitor
statement. - 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 iokind
text The type of the operation on a file. Valid values: fsync
,creat
,seek
,open
,read
,write
,falloc
.num_lessthan200us
numeric The number of times that the I/O latency is less than 200 microseconds. num_lessthan400us
numeric The number of times that the I/O latency is greater than 200 microseconds but less than 400 microseconds. num_lessthan600us
numeric The number of times that the I/O latency is greater than 400 microseconds but less than 600 microseconds. num_lessthan800us
numeric The number of times that the I/O latency is greater than 600 microseconds but less than 800 microseconds. num_lessthan1ms
numeric The number of times that the I/O latency is greater than 800 microseconds but less than 1 millisecond. num_lessthan10ms
numeric The number of times that the I/O latency is greater than 1 millisecond but less than 10 milliseconds. num_lessthan100ms
numeric The number of times that the I/O latency is greater than 10 milliseconds but less than 100 milliseconds. num_morethan100ms
numeric 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_monitor
plug-in. This plug-in is built into PolarDB for PostgreSQL. To activate this plug-in, execute thecreate extension polar_monitor
statement.
- 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 pid
bigint The ID of the process. send_bytes
bigint The total number of bytes sent. send_count
bigint The cumulative number of sending times. recv_bytes
bigint The total number of bytes received. recv_count
bigint The cumulative number of receiving times. sendq
bigint The length of the sending queue over the socket. recvq
bigint The length of the receiving queue over the socket. cwnd
bigint The length of the sliding window of the socket. rtt
bigint The round-trip time (RTT) of TCP packets. (Unit: microseconds) retrans
bigint The cumulative number of times that data is retransmitted. tcpinfo_update_time
bigint 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
, andretrans
metrics 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_count
bigint The number of times that the system sends network traffic. send_bytes
bigint The amount of outbound traffic. (Unit: bytes) recv_count
bigint The number of times that the system receives network traffic. recv_bytes
bigint The amount of inbound traffic. (Unit: bytes) retrans
bigint The number of times that data is retransmitted. Note The polar_stat_network view is provided by thepolar_monitor
plug-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 tranche
smallint The ID of the lock. name
text The name of the lock. sh_acquire_count
bigint The number of times that the system acquires a shared lock. ex_acquire_count
bigint The number of times that the system acquires an exclusive lock. block_count
bigint The number of blocks that occurred. lock_nums
bigint The number of lightweight locks. wait_time
bigint The total lock wait time. Note The polar_stat_lwlock view is provided by thepolar_monitor_preload
plug-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 locktype
text The type of the lockable object. Valid values: relation, extend, page, tuple, transactionid, virtualxid, object, userlock, and advisory. database
oid 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. relation
oid 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. page
integer 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. tuple
smallint 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. virtualxid
text The virtual ID of the transaction to be locked. If the object to be locked is not a virtual XID, the value is NULL. transactionid
xid The ID of the transaction to be locked. If the object to be locked is not an XID, the value is NULL. classid
oid 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. objid
oid 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. objsubid
smallint 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. virtualtransaction
text The virtual ID of the transaction that holds the lock or is waiting for the lock. pid
integer 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. mode
text The name of the lock mode that is held or desired by this process. granted
boolean If the lock is held, the value is true. If the lock is waited for, the value is false. fastpath
boolean 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 id
integer The primary key of the table. lock_type
text The type of the lock. invalid
numeric Indicates that the lock is invalid. accesssharelock
numeric The number of ACCESS SHARE locks. rowsharelock
numeric The number of ROW SHARE locks. rowexclusivelock
numeric The number of ROW EXCLUSIVE locks. shareupdateexclusivelock
numeric The number of SHARE UPDATE EXCLUSIVE locks. sharelock
numeric The number of SHARE locks. sharerowexclusivelock
numeric The number of SHARE ROW EXCLUSIVE locks. exclusivelock
numeric The number of EXCLUSIVE locks. accessexclusivelock
numeric The number of ACCESS EXCLUSIVE locks. block_count
numeric The number of blocks caused by locks. fastpath_count
numeric The number of fast-path locks on a local system. wait_time
numeric The lock wait time. Note The polar_stat_lock view is provided by thepolar_monitor_preload
plug-in. This plug-in is built into PolarDB for PostgreSQL. To activate this plug-in, execute thecreate extension polar_monitor_preload
statement.
- 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_type
text The primary key of the table. slots_number
integer The number of pages. valid_pages
integer The number of the used pages. empty_pages
integer The number of the empty pages. reading_pages
integer The number of the pages on which the read operations are being performed. writing_pages
integer The number of the pages on which the write operations are being performed. wait_readings
integer The number of the wait events for read operations. wait_writings
integer The number of the wait events for write operations. read_count
bigint The number of the read operations. read_only_count
bigint The number of the read-only operations. read_upgrade_count
bigint The number of the read operations in the upgrade mode. victim_count
bigint The number of times that data is evicted from caches. victim_write_count
bigint The number of times that data is evicted from caches and then is written to disks. write_count
bigint The number of the write operations. zero_count
bigint The number of times that the cache data is cleared. flush_count
bigint The number of the flush operations. truncate_count
bigint The number of the truncate operations. storage_read_count
bigint The number of times that you read data from disks. storage_write_count
bigint The number of times that you write data to disks. Note The polar_stat_slru view is provided by thepolar_monitor
plug-in. This plug-in is built into PolarDB for PostgreSQL. To activate this plug-in, execute thecreate 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.
Parameter Type Description subtype
text The type of the cgroup. Valid values: IO, Memory, and CPU. infotype
text The information about the cgroup. count
bigint The statistics about the used resources. Note The polar_stat_cgroup view is provided by thepolar_monitor_preload
andpolar_monitor
plug-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 subtype
text The type of a cgroup. Valid values: IO, Memory, and CPU. infotype
text The information about cgroups. count
bigint The quota of a cgroup. Note The polar_cgroup_quota view is provided by thepolar_monitor
plug-in. This plug-in is built into PolarDB for PostgreSQL. To activate this plug-in, execute thecreate extension polar_monitor
statement.
- polar_stat_cgroup