On Mon, Jul 17, 2023 at 10:26 PM Andres Freund <andres@anarazel.de> wrote:
>
> Previously it was e.g. not really possible to distinguish that something like
> this:
>
> ┌────────────────┬─────────────────┬────────────┬───────┐
> │ backend_type │ wait_event_type │ wait_event │ count │
> ├────────────────┼─────────────────┼────────────┼───────┤
> │ client backend │ LWLock │ WALInsert │ 32 │
> │ client backend │ (null) │ (null) │ 9 │
> │ walwriter │ IO │ WALWrite │ 1 │
> │ client backend │ Client │ ClientRead │ 1 │
> │ client backend │ LWLock │ WALWrite │ 1 │
> └────────────────┴─────────────────┴────────────┴───────┘
>
> is a workload with a very different bottleneck than this:
>
> ┌────────────────┬─────────────────┬───────────────┬───────┐
> │ backend_type │ wait_event_type │ wait_event │ count │
> ├────────────────┼─────────────────┼───────────────┼───────┤
> │ client backend │ IPC │ WALWaitInsert │ 22 │
> │ client backend │ LWLock │ WALInsert │ 13 │
> │ client backend │ LWLock │ WALBufMapping │ 5 │
> │ walwriter │ (null) │ (null) │ 1 │
> │ client backend │ Client │ ClientRead │ 1 │
> │ client backend │ (null) │ (null) │ 1 │
> └────────────────┴─────────────────┴───────────────┴───────┘
>
> even though they are very different
>
> FWIW, the former is bottlenecked by the number of WAL insertion locks, the
> second is bottlenecked by copying WAL into buffers due to needing to flush
> them.
>
This gives a better idea of what's going on. +1 for separating these waits.
--
With Regards,
Amit Kapila.