# Workloads Diagnostic Library (The Elephant Cafe) This directory contains the comprehensive "Wait Event Library" for the **Learn You a Postgres** manuscript. Every file here represents a reason why the Postgres Elephant might be standing still (or "Sweating"). ## Source Material The categorization and technical descriptions in this library are derived from the official **PostgreSQL 18** Wait Event documentation: [PostgreSQL 18 Wait Event Table](https://www.postgresql.org/docs/current/monitoring-stats.html#WAIT-EVENT-TABLE) ## Categorization Methodology To make Postgres internals more approachable, we have organized the chaotic list of 400+ wait events into a single "Narrative Architecture" called the **Elephant Cafe**. | Manuscript Category | Postgres Internal Type | Metaphor | Technical Focus | | :--- | :--- | :--- | :--- | | **[[Activity/_Activity\|Activity]]** | `Activity` | **The Invisible Staff** | Background workers (Autovacuum, Checkpointer, WalWriter). | | **[[Client/_Client\|Client]]** | `Client` | **The Waiting Waiter** | Network latency and application-side delays. | | **[[CPU/_CPU\|CPU]]** | `CPU` | **The Sweat** | Internal processing, sorting, and spinning on locks. | | **[[IO/_IO\|IO]]** | `IO` | **The Sigh** | Physical disk reads/writes and memory eviction. | | **[[IPC/_IPC\|IPC]]** | `IPC` | **The Elephant Yell** | Parallel worker coordination and message queues. | | **[[Lock/_Lock\|Lock]]** | `Lock` | **The Iron Padlock** | Transactional (heavyweight) blocks on rows/tables. | | **[[LWLock/_LWLock\|LWLock]]** | `LWLock` | **The Shoulder Nudge** | Short-duration memory friction on shared data structures. | | **[[Timeout/_Timeout\|Timeout]]** | `Timeout` | **The Impatient Staff** | Delays and failed remote responses. | ## Structure - **Root**: Chapter indices and diagnostic flowcharts. - **Thematic Folders**: Thematic subdirectories that group specific internal wait events into their logical family (e.g., `IO/WAL/`, `LWLock/Buffers/`). ## Accuracy Note This library is maintained against the **PostgreSQL 18** (Bleeding Edge) specifications. Some events (like `IoWorkerMain` or `io_uring` IO events) may not be present in legacy versions (PG 15 or older).