IPC:BtreePage

This event is specific to Parallel B-tree Index Scans, a feature that allows multiple CPU cores to work together to scan a single index in parallel.
This event occurs when a parallel worker process is waiting for the leader or other workers to coordinate which page of a B-tree index should be scanned next.
The process is waiting for the page number needed to continue a parallel B-tree scan to become available

When It Appears

  1. Parallel B-Tree Index Scans
    When max_parallel_workers_per_gather > 0 and the query planner chooses a parallel index scan
    During parallel index-only scans or parallel bitmap heap scans that involve B-tree indexes
    When multiple workers are actively scanning different parts of the same B-tree index simultaneously
  2. High Parallelism or Coordination Overhead
    With a high number of parallel workers (e.g., 8+ workers) competing for page allocation
    When the overhead of inter-process messaging becomes significant relative to the actual scan work
    On systems with many CPUs where parallel query is heavily utilized
  3. Short-Lived Worker Coordination
    Typically appears briefly during the scan's execution as workers continuously request and receive page numbers
    Can be more frequent with irregular index structures or when scanning indexes with high fragmentation

Related Wait Events

Often appears alongside other IPC waits like MessageQueueSend and MessageQueueReceive as parallel workers communicate via shared message queues

Tuning Tips

  1. Adjust Parallel Worker Settings
    Consider reducing max_parallel_workers_per_gather if IPC:BtreePage waits are excessive
    Balance parallelism with the overhead of inter-process communication
  2. Optimize Indexing Strategies
    Ensure B-tree indexes are well-maintained and not overly fragmented
    Regularly REINDEX or VACUUM to improve index structure and reduce scan times
    Consider using BRIN indexes for very large tables where appropriate, as they may reduce the need for parallel B-tree scans
    Consider partial indexes to limit the size of the index being scanned