potential: This standby server is now asynchronous, but can potentially become synchronous if one of current synchronous ones fails. Connection string used by this WAL receiver, with security-sensitive fields obfuscated. Number of transactions spilled to disk once the memory used by logical decoding to decode changes from WAL has exceeded logical_decoding_work_mem. pg_stat_get_backend_activity_start ( integer ) timestamp with time zone. also pending an I/O operation, The ratio between the size of the shared buffer pool (defined by the shared_buffers parameter) and the Waiting for a read during a file copy operation. Waiting for SLRU data to reach durable storage during a checkpoint or database shutdown. (For example, in psql you could issue \d+ pg_stat_activity.) Waiting for the control file to reach durable storage. Waiting to read or update background worker state. Waiting for a WAL file to reach durable storage. This is the only column in this view that returns a value reflecting current state; all other columns return the accumulated values since the last reset. Waiting to acquire a virtual transaction ID lock. Waiting for a relation data file to be truncated. All temporary files are counted, regardless of why the temporary file was created, and regardless of the log_temp_files setting. Waiting for a two phase state file to reach durable storage. However, these statistics do not give the entire story: due to the way in which PostgreSQL handles disk I/O, data that is not in the PostgreSQL buffer cache might still reside in the kernel's I/O cache, and might therefore still be fetched without requiring a physical read. In a bitmap scan the output of several indexes can be combined via AND or OR rules, so it is difficult to associate individual heap row fetches with specific indexes when a bitmap scan is used. PostgreSQL utilizes lightweight locks (LWLocks) to synchronize and control access to the buffer content. Waiting for truncate of mapping data during a logical rewrite. , LWTRANCHE_MXACTMEMBER_BUFFERS, LWTRANCHE_ASYNC_BUFFERS, LWTRANCHE_OLDSERXID_BUFFERS, LWTRANCHE_WAL_INSERT, LWTRANCHE_BUFFER_CONTENT, LWTRANCHE_BUFFER_IO_IN_PROGRESS, LWTRANCHE . Waiting for changes to a relation data file to reach durable storage. Waiting to access the serializable transaction conflict SLRU cache. Waiting to update the relation map file used to store catalog to filenode mapping. But if you want to see new results with each query, be sure to do the queries outside any transaction block. BufferPin: The server process is waiting to access to a data buffer during a period when no other process can be examining that buffer. Waiting to access the transaction status SLRU cache. From pg_stat_activity i noticed that the wait_event_type and wait_event of these queries is as follows: Waiting to read or update a process' fast-path lock information. Number of times WAL files were synced to disk via issue_xlog_fsync request (if fsync is on and wal_sync_method is either fdatasync, fsync or fsync_writethrough, otherwise zero). Current overall state of this backend. The pg_stat_bgwriter view will always have a single row, containing global data for the cluster. Waiting to read or write a data page in memory. Table28.26.pg_stat_database_conflicts View, Number of queries in this database that have been canceled due to dropped tablespaces, Number of queries in this database that have been canceled due to lock timeouts, Number of queries in this database that have been canceled due to old snapshots, Number of queries in this database that have been canceled due to pinned buffers, Number of queries in this database that have been canceled due to deadlocks. IO: The server process is waiting for a IO to complete. Name of the user logged into this backend, Name of the application that is connected to this backend. The pg_stat_database view will contain one row for each database in the cluster, showing database-wide statistics. Waiting in main loop of startup process for WAL to arrive, during streaming recovery. We recommend different actions depending on the causes of your wait event: Observe Amazon CloudWatch metrics for correlation between sharp decreases in the Therefore, a bitmap scan increments the pg_stat_all_indexes.idx_tup_read count(s) for the index(es) it uses, and it increments the pg_stat_all_tables.idx_tup_fetch count for the table, but it does not affect pg_stat_all_indexes.idx_tup_fetch. The reported lag times are not predictions of how long it will take for the standby to catch up with the sending server assuming the current rate of replay. Wait Events of Type BufferPin, Table28.8. OID of the user logged into this WAL sender process, Name of the user logged into this WAL sender process, Name of the application that is connected to this WAL sender. Waiting in main loop of background writer process background worker. Waiting for a write to the relation map file. Waiting to find or allocate space in shared memory. Last write-ahead log location already received and written to disk, but not flushed. Waiting for other Parallel Hash participants to finish hashing the inner relation. Waiting for a read from a relation data file. Waiting a new WAL segment created by copying an existing one to reach durable storage. Waiting for confirmation from a remote server during synchronous replication. This includes the sync time when wal_sync_method is either open_datasync or open_sync. See, One row per WAL sender process, showing statistics about replication to that sender's connected standby server. Number of index scans initiated on this index, Number of index entries returned by scans on this index, Number of live table rows fetched by simple index scans using this index. The columns wal_distance, block_distance and io_depth show current values, and the other columns show cumulative counters that can be reset with the pg_stat_reset_shared function. Table28.19.pg_stat_subscription_stats View, Number of times an error occurred while applying changes, Number of times an error occurred during the initial table synchronization. Amount of decoded transaction data spilled to disk while performing decoding of changes from WAL for this slot. Waiting for logical rewrite mappings to reach durable storage during a checkpoint. pg_stat_reset_subscription_stats ( oid ) void. Waiting for confirmation from remote server during synchronous replication. The pg_stat_wal_receiver view will contain only one row, showing statistics about the WAL receiver from that receiver's connected server. The per-table and per-index functions take a table or index OID. Waiting for a write of logical rewrite mappings. Lock: The backend is waiting for a heavyweight lock. The pg_stat_user_tables and pg_stat_sys_tables views contain the same information, but filtered to only show user and system tables respectively. pg_stat_get_activity, the underlying function of the pg_stat_activity view, returns a set of records containing all the available information about each backend process. The wait_event and state columns are independent. Waiting to read data from the client while establishing a GSSAPI session. The parameter track_counts controls whether statistics are collected about table and index accesses. > However, someone with deeper knowledge of page pinning and buffer manager > internals could certainly devise a better solution. Presently, accesses to tables and indexes in both disk-block and individual-row terms are counted. If the argument is NULL, reset statistics for all subscriptions. Waiting to elect a Parallel Hash participant to allocate more buckets. The argument can be one of CommitTs, MultiXactMember, MultiXactOffset, Notify, Serial, Subtrans, or Xact to reset the counters for only that entry. Several predefined views, listed in Table28.1, are available to show the current state of the system. For client backends, this is the time the client connected to the server. LWLock:buffer_mapping. Resets some cluster-wide statistics counters to zero, depending on the argument. It can be joined to pg_stat_activity or pg_stat_replication on the pid column to get more details about the connection. These times represent the commit delay that was (or would have been) introduced by each synchronous commit level, if the remote server was configured as a synchronous standby. (See Chapter19 for details about setting configuration parameters.). Per-Backend Statistics Functions, pg_stat_get_backend_idset () setof integer. Waiting to retrieve or store information about serializable transactions. Waiting for SLRU data to reach durable storage following a page write. * The BM_IO_IN_PROGRESS flag acts as a kind of lock, used to wait for I/O on a: buffer to complete (and in releases before 14, it was accompanied by a: per-buffer LWLock). The pg_stat_archiver view will always have a single row, containing data about the archiver process of the cluster. Waiting in WAL receiver to receive data from remote server. Returns the IP address of the client connected to this backend. When the server shuts down cleanly, a permanent copy of the statistics data is stored in the pg_stat subdirectory, so that statistics can be retained across server restarts. Waiting for logical replication remote server to send data for initial table synchronization. pg_stat_reset_single_table_counters ( oid ) void. Waiting for a barrier event to be processed by all backends. A snapshot is taken the first time cumulative statistics are accessed in a transaction if stats_fetch_consistency is set to snapshot. Thanks for letting us know we're doing a good job! Last write-ahead log location already received and flushed to disk, the initial value of this field being the first log location used when WAL receiver is started, Timeline number of last write-ahead log location received and flushed to disk, the initial value of this field being the timeline number of the first log location used when WAL receiver is started, last_msg_send_time timestamp with time zone, Send time of last message received from origin WAL sender, last_msg_receipt_time timestamp with time zone, Receipt time of last message received from origin WAL sender, Last write-ahead log location reported to origin WAL sender, Time of last write-ahead log location reported to origin WAL sender, Replication slot name used by this WAL receiver, Host of the PostgreSQL instance this WAL receiver is connected to. Waiting for a relation data file to be truncated. (See Chapter20 for details about setting configuration parameters.). The next use of statistical information will (when in snapshot mode) cause a new snapshot to be built or (when in cache mode) accessed statistics to be cached. Presently, the collector can count accesses to tables and indexes in both disk-block and individual-row terms. Waiting for a read during recheck of the data directory lock file. Waiting to get the start location of a scan on a table for synchronized scans. The following wait events are a subset of the list in Amazon Aurora PostgreSQL wait events. (For example, in psql you could issue \d+ pg_stat_activity.) BK_1935: "IObuffer_locks,ControlLock()"IOControlLockControlLockIOSlruSharedData. Sometimes it may be more convenient to obtain just a subset of this information. Number of scheduled checkpoints that have been performed, Number of requested checkpoints that have been performed, Total amount of time that has been spent in the portion of checkpoint processing where files are written to disk, in milliseconds, Total amount of time that has been spent in the portion of checkpoint processing where files are synchronized to disk, in milliseconds, Number of buffers written during checkpoints, Number of buffers written by the background writer, Number of times the background writer stopped a cleaning scan because it had written too many buffers, Number of buffers written directly by a backend, Number of times a backend had to execute its own fsync call (normally the background writer handles those even when the backend does its own write). Waiting to read or update sub-transaction information. Waiting for data to reach durable storage while assigning a new WAL sync method. See, One row for each tracked function, showing statistics about executions of that function. Waiting for a read of a logical mapping during reorder buffer management. Name of this database, or NULL for shared objects. Waiting to read or update multixact offset mappings. Alternatively, one can build custom views using the underlying cumulative statistics functions, as discussed in Section28.2.24.