<feed xmlns='http://www.w3.org/2005/Atom'>
<title>postgresql.git/src/include/executor/instrument.h, branch master</title>
<subtitle>This is the main PostgreSQL git repository.</subtitle>
<id>http://git.postgresql.org/cgit/postgresql.git/atom?h=master</id>
<link rel='self' href='http://git.postgresql.org/cgit/postgresql.git/atom?h=master'/>
<link rel='alternate' type='text/html' href='http://git.postgresql.org/cgit/postgresql.git/'/>
<updated>2026-04-07T20:33:34Z</updated>
<entry>
<title>Add EXPLAIN (IO) infrastructure with BitmapHeapScan support</title>
<updated>2026-04-07T20:33:34Z</updated>
<author>
<name>Tomas Vondra</name>
</author>
<published>2026-04-07T20:33:32Z</published>
<link rel='alternate' type='text/html' href='http://git.postgresql.org/cgit/postgresql.git/commit/?id=681daed93169ff5bed2796dd5c8c76ee2fae1ebd'/>
<id>urn:sha1:681daed93169ff5bed2796dd5c8c76ee2fae1ebd</id>
<content type='text'>
Allows collecting details about AIO / prefetch for scan nodes backed by
a ReadStream. This may be enabled by a new "IO" option in EXPLAIN, and
it shows information about the prefetch distance and I/O requests.

As of this commit this applies only to BitmapHeapScan, because that's
the only scan node using a ReadStream and collecting instrumentation
from workers in a parallel query. Support for SeqScan and TidRangeScan,
the other scan nodes using ReadStream, will be added in subsequent
commits.

The stats are collected only when required by EXPLAIN ANALYZE, with the
IO option (disabled by default). The amount of collected statistics is
very limited, but we don't want to clutter EXPLAIN with too much data.

The IOStats struct is stored in the scan descriptor as a field, next to
other fields used by table AMs. A pointer to the field is passed to the
ReadStream, and updated directly.

It's the responsibility of the table AM to allocate the struct (e.g. in
ambeginscan) whenever the flag SO_SCAN_INSTRUMENT flag is passed to the
scan, so that the executor and ReadStream has access to it.

The collected stats are designed for ReadStream, but are meant to be
reasonably generic in case a TAM manages I/Os in different ways.

Author: Tomas Vondra &lt;tomas@vondra.me&gt;
Reviewed-by: Melanie Plageman &lt;melanieplageman@gmail.com&gt;
Reviewed-by: Lukas Fittl &lt;lukas@fittl.com&gt;
Reviewed-by: Andres Freund &lt;andres@anarazel.de&gt;
Discussion: https://postgr.es/m/flat/a177a6dd-240b-455a-8f25-aca0b1c08c6e%40vondra.me
</content>
</entry>
<entry>
<title>instrumentation: Separate per-node logic from other uses</title>
<updated>2026-04-05T23:04:24Z</updated>
<author>
<name>Andres Freund</name>
</author>
<published>2026-04-05T21:18:00Z</published>
<link rel='alternate' type='text/html' href='http://git.postgresql.org/cgit/postgresql.git/commit/?id=5a79e78501f46bd3ac7fbd0ff84cf1e20dbafd19'/>
<id>urn:sha1:5a79e78501f46bd3ac7fbd0ff84cf1e20dbafd19</id>
<content type='text'>
Previously, different places (e.g. query "total time") were repurposing the
Instrumentation struct initially introduced for capturing per-node statistics
during execution. This overuse of the same struct is confusing, e.g. by
cluttering calls of InstrStartNode/InstrStopNode in unrelated code paths, and
prevents future refactorings.

Instead, simplify the Instrumentation struct to only track time and WAL/buffer
usage. Similarly, drop the use of InstrEndLoop outside of per-node
instrumentation - these calls were added without any apparent benefit since
the relevant fields were never read.

Introduce the NodeInstrumentation struct to carry forward the per-node
instrumentation information. WorkerInstrumentation is renamed to
WorkerNodeInstrumentation for clarity.

In passing, clarify that InstrAggNode is expected to only run after
InstrEndLoop (as it does in practice), and drop unused code.

This also fixes a consequence-less bug: Previously -&gt;async_mode was only set
when a non-zero instrument_option was passed. That turns out to be harmless
right now, as -&gt;async_mode only affects a timing related field.

Author: Lukas Fittl &lt;lukas@fittl.com&gt;
Reviewed-by: Andres Freund &lt;andres@anarazel.de&gt;
Discussion: https://postgr.es/m/CAP53PkzdBK8VJ1fS4AZ481LgMN8f9mJiC39ZRHqkFUSYq6KWmg@mail.gmail.com
</content>
</entry>
<entry>
<title>instrumentation: Separate trigger logic from other uses</title>
<updated>2026-04-05T20:56:50Z</updated>
<author>
<name>Andres Freund</name>
</author>
<published>2026-04-05T20:47:12Z</published>
<link rel='alternate' type='text/html' href='http://git.postgresql.org/cgit/postgresql.git/commit/?id=7d9b74df53e9268bd638274f1415ebfeecf0de51'/>
<id>urn:sha1:7d9b74df53e9268bd638274f1415ebfeecf0de51</id>
<content type='text'>
Introduce TriggerInstrumentation to capture trigger timing and firings
(previously counted in "ntuples"), to aid a future refactoring that
splits out all Instrumentation fields beyond timing and WAL/buffers into
more specific structs.

In passing, drop the "n" argument to InstrAlloc, as all remaining callers need
exactly one Instrumentation struct.  The duplication between InstrAlloc() and
InstrInit(), as well as the conditional initialization of async_mode will be
addressed in a subsequent commit.

Author: Lukas Fittl &lt;lukas@fittl.com&gt;
Reviewed-by: Andres Freund &lt;andres@anarazel.de&gt;
Discussion: https://www.postgresql.org/message-id/flat/CAP53PkzdBK8VJ1fS4AZ481LgMN8f9mJiC39ZRHqkFUSYq6KWmg@mail.gmail.com
</content>
</entry>
<entry>
<title>instrumentation: Keep time fields as instrtime, convert in callers</title>
<updated>2026-01-09T18:38:00Z</updated>
<author>
<name>Andres Freund</name>
</author>
<published>2026-01-09T17:10:53Z</published>
<link rel='alternate' type='text/html' href='http://git.postgresql.org/cgit/postgresql.git/commit/?id=e5a5e0a90750d665cab417322b9f85c806430d85'/>
<id>urn:sha1:e5a5e0a90750d665cab417322b9f85c806430d85</id>
<content type='text'>
Previously the instrumentation logic always converted to seconds, only for
many of the callers to do unnecessary division to get to milliseconds. As an
upcoming refactoring will split the Instrumentation struct, utilize instrtime
always to keep things simpler. It's also a bit faster to not have to first
convert to a double in functions like InstrEndLoop(), InstrAggNode().

Author: Lukas Fittl &lt;lukas@fittl.com&gt;
Reviewed-by: Andres Freund &lt;andres@anarazel.de&gt;
Discussion: https://postgr.es/m/CAP53PkzZ3UotnRrrnXWAv=F4avRq9MQ8zU+bxoN9tpovEu6fGQ@mail.gmail.com
</content>
</entry>
<entry>
<title>Update copyright for 2026</title>
<updated>2026-01-01T18:24:10Z</updated>
<author>
<name>Bruce Momjian</name>
</author>
<published>2026-01-01T18:24:10Z</published>
<link rel='alternate' type='text/html' href='http://git.postgresql.org/cgit/postgresql.git/commit/?id=451c43974f8e199097d97624a4952ad0973cea61'/>
<id>urn:sha1:451c43974f8e199097d97624a4952ad0973cea61</id>
<content type='text'>
Backpatch-through: 14
</content>
</entry>
<entry>
<title>Add wal_fpi_bytes to pg_stat_wal and pg_stat_get_backend_wal()</title>
<updated>2025-10-28T07:21:51Z</updated>
<author>
<name>Michael Paquier</name>
</author>
<published>2025-10-28T07:21:51Z</published>
<link rel='alternate' type='text/html' href='http://git.postgresql.org/cgit/postgresql.git/commit/?id=f9a09aa2952039a9956b44d929b9df74d62a4cd4'/>
<id>urn:sha1:f9a09aa2952039a9956b44d929b9df74d62a4cd4</id>
<content type='text'>
This new counter, called "wal_fpi_bytes", tracks the total amount in
bytes of full page images (FPIs) generated in WAL.  This data becomes
available globally via pg_stat_wal, and for backend statistics via
pg_stat_get_backend_wal().

Previously, this information could only be retrieved with pg_waldump or
pg_walinspect, which may not be available depending on the environment,
and are expensive to execute.  It offers hints about how much FPIs
impact the WAL generated, which could be a large percentage for some
workloads, as well as the effects of wal_compression or page holes.

Bump catalog version.
Bump PGSTAT_FILE_FORMAT_ID, due to the addition of wal_fpi_bytes in
PgStat_WalCounters.

Author: Shinya Kato &lt;shinya11.kato@gmail.com&gt;
Reviewed-by: Michael Paquier &lt;michael@paquier.xyz&gt;
Discussion: https://postgr.es/m/CAOzEurQtZEAfg6P0kU3Wa-f9BWQOi0RzJEMPN56wNTOmJLmfaQ@mail.gmail.com
</content>
</entry>
<entry>
<title>Move wal_buffers_full from PgStat_PendingWalStats to WalUsage</title>
<updated>2025-02-17T04:14:28Z</updated>
<author>
<name>Michael Paquier</name>
</author>
<published>2025-02-17T04:14:28Z</published>
<link rel='alternate' type='text/html' href='http://git.postgresql.org/cgit/postgresql.git/commit/?id=eaf502747bacee0122668eb1ba3979f86b8d8342'/>
<id>urn:sha1:eaf502747bacee0122668eb1ba3979f86b8d8342</id>
<content type='text'>
wal_buffers_full has been introduced in pg_stat_wal in 8d9a935965f, as
some information providing metrics for the tuning of the GUC
wal_buffers.  WalUsage has been introduced before that in df3b181499.

Moving this field is proving to be beneficial for several reasons:
- This information can now be made available in more layers, providing
more granularity than just pg_stat_wal, on a per-query basis: EXPLAIN,
pgss and VACUUM/ANALYZE logs.
- A patch is under discussion to provide statistics for WAL at backend
level, and this move simplifies a bit the handling of pending
statistics.  The remaining data in PgStat_PendingWalStats now relates to
write/sync counters and times, with equivalents present in pg_stat_io,
that backend statistics are able to already track.  So this should cut
all the dependencies between PgStat_PendingWalStats and WAL stats at
backend level.

As of this change, wal_buffers_full only shows in pg_stat_wal.

Author: Bertrand Drouvot
Reviewed-by: Ilia Evdokimov
Discussion: https://postgr.es/m/Z6SOha5YFFgvpwQY@ip-10-97-1-34.eu-west-3.compute.internal
</content>
</entry>
<entry>
<title>Update copyright for 2025</title>
<updated>2025-01-01T16:21:55Z</updated>
<author>
<name>Bruce Momjian</name>
</author>
<published>2025-01-01T16:21:55Z</published>
<link rel='alternate' type='text/html' href='http://git.postgresql.org/cgit/postgresql.git/commit/?id=50e6eb731d98ab6d0e625a0b87fb327b172bbebd'/>
<id>urn:sha1:50e6eb731d98ab6d0e625a0b87fb327b172bbebd</id>
<content type='text'>
Backpatch-through: 13
</content>
</entry>
<entry>
<title>Update copyright for 2024</title>
<updated>2024-01-04T01:49:05Z</updated>
<author>
<name>Bruce Momjian</name>
</author>
<published>2024-01-04T01:49:05Z</published>
<link rel='alternate' type='text/html' href='http://git.postgresql.org/cgit/postgresql.git/commit/?id=29275b1d177096597675b5c6e7e7c9db2df8f4df'/>
<id>urn:sha1:29275b1d177096597675b5c6e7e7c9db2df8f4df</id>
<content type='text'>
Reported-by: Michael Paquier

Discussion: https://postgr.es/m/ZZKTDPxBBMt3C0J9@paquier.xyz

Backpatch-through: 12
</content>
</entry>
<entry>
<title>Add local_blk_{read|write}_time I/O timing statistics for local blocks</title>
<updated>2023-10-19T04:39:38Z</updated>
<author>
<name>Michael Paquier</name>
</author>
<published>2023-10-19T04:39:38Z</published>
<link rel='alternate' type='text/html' href='http://git.postgresql.org/cgit/postgresql.git/commit/?id=295c36c0c1fa7b6befd0a3525c7f109e838c9448'/>
<id>urn:sha1:295c36c0c1fa7b6befd0a3525c7f109e838c9448</id>
<content type='text'>
There was no I/O timing statistics for counting read and write timings
on local blocks, contrary to the counterparts for temp and shared
blocks.  This information is available when track_io_timing is enabled.

The output of EXPLAIN is updated to show this information.  An update of
pg_stat_statements is planned next.

Author: Nazir Bilal Yavuz
Reviewed-by: Robert Haas, Melanie Plageman
Discussion: https://postgr.es/m/CAN55FZ19Ss279mZuqGbuUNxka0iPbLgYuOQXqAKewrjNrp27VA@mail.gmail.com
</content>
</entry>
</feed>
