IO wait events for COPY FROM/TO PROGRAM or file

From: Nikolay Samokhvalov <nik(at)postgres(dot)ai>
To: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: IO wait events for COPY FROM/TO PROGRAM or file
Date: 2026-01-08 21:53:17
Message-ID: CAM527d_iDzz0Kqyi7HOfqa-Xzuq29jkR6AGXqfXLqA5PR5qsng@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

Following up on the discussion about wait event coverage for COPY
operations [1], here's a tiny patch that adds two new IO wait events:
- COPY_DATA_READ: COPY FROM blocking on file/program read
- COPY_DATA_WRITE: COPY TO blocking on file/program write

This enables diagnosing for cases like:
- storage I/O bottlenecks during bulk loads slow exports to files (COPY
FROM/TO '/path/to/file')
- pipe buffer congestion in ETL pipelines (COPY FROM/TO PROGRAM)

Note: as it turned out, COPY FROM/TO STDIN/STDOUT already have coverage via
Client/ClientRead and Client/ClientWrite at the protocol layer (thus,
pg_dump/pg_restore are already covered). So only file/program cases needed
instrumentation.

[1]
https://www.postgresql.org/message-id/flat/CAM527d9PkaSj-gNjLZqjJXnqaWTD8kHPtm2Yj8-1Gh_0pTRgDA%40mail.gmail.com

Nikx

Attachment Content-Type Size
v1-0001-Add-IO-wait-events-for-COPY-file-program-operations.patch application/octet-stream 3.6 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2026-01-08 22:04:14 Re: POC: enable logical decoding when wal_level = 'replica' without a server restart
Previous Message Robert Haas 2026-01-08 20:58:54 Re: pg_plan_advice