=== Applying patches on top of PostgreSQL commit ID 9018c7d37bb464cd53567c0b553a6f49b50bec78 === /etc/rc.d/jail: WARNING: Per-jail configuration via jail_* variables is obsolete. Please consider migrating to /etc/jail.conf. Sun Apr 19 18:52:25 UTC 2026 On branch cf/6433 nothing to commit, working tree clean === using 'git am' to apply patch ./v9a-0001-Add-pg_stat_io_histogram-view-to-provide-more-det.patch === Applying: Add pg_stat_io_histogram view to provide more detailed insight into IO profile Using index info to reconstruct a base tree... M configure M configure.ac M doc/src/sgml/config.sgml M doc/src/sgml/monitoring.sgml M doc/src/sgml/wal.sgml M meson.build M src/backend/catalog/system_views.sql M src/backend/utils/activity/pgstat.c M src/backend/utils/activity/pgstat_backend.c M src/backend/utils/activity/pgstat_io.c M src/backend/utils/adt/pgstatfuncs.c M src/include/catalog/pg_proc.dat M src/include/pgstat.h M src/include/port/pg_bitutils.h M src/include/utils/pgstat_internal.h M src/test/regress/expected/rules.out M src/tools/pgindent/typedefs.list Falling back to patching base and 3-way merge... Auto-merging src/tools/pgindent/typedefs.list Auto-merging src/test/regress/expected/rules.out CONFLICT (content): Merge conflict in src/test/regress/expected/rules.out Auto-merging src/include/utils/pgstat_internal.h Auto-merging src/include/port/pg_bitutils.h Auto-merging src/include/pgstat.h Auto-merging src/include/catalog/pg_proc.dat CONFLICT (content): Merge conflict in src/include/catalog/pg_proc.dat Auto-merging src/backend/utils/adt/pgstatfuncs.c Auto-merging src/backend/utils/activity/pgstat_io.c Auto-merging src/backend/utils/activity/pgstat_backend.c Auto-merging src/backend/utils/activity/pgstat.c Auto-merging src/backend/catalog/system_views.sql Auto-merging meson.build Auto-merging doc/src/sgml/wal.sgml Auto-merging doc/src/sgml/monitoring.sgml CONFLICT (content): Merge conflict in doc/src/sgml/monitoring.sgml Auto-merging doc/src/sgml/config.sgml Auto-merging configure.ac Auto-merging configure error: Failed to merge in the changes. hint: Use 'git am --show-current-patch=diff' to see the failed patch Patch failed at 0001 Add pg_stat_io_histogram view to provide more detailed insight into IO profile When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort". === using patch(1) to apply patch ./v9a-0001-Add-pg_stat_io_histogram-view-to-provide-more-det.patch === patching file configure Hunk #1 succeeded at 16054 (offset 42 lines). patching file configure.ac Hunk #1 succeeded at 1881 (offset 18 lines). patching file doc/src/sgml/config.sgml Hunk #1 succeeded at 9067 (offset 227 lines). Hunk #2 succeeded at 9101 (offset 227 lines). patching file doc/src/sgml/monitoring.sgml Hunk #1 succeeded at 518 (offset 9 lines). Hunk #2 succeeded at 745 (offset 19 lines). Hunk #3 succeeded at 3410 with fuzz 1 (offset 114 lines). patching file doc/src/sgml/wal.sgml Hunk #1 succeeded at 950 (offset 118 lines). patching file meson.build Hunk #1 succeeded at 2056 (offset 10 lines). patching file src/backend/catalog/system_views.sql Hunk #1 succeeded at 1282 (offset 27 lines). patching file src/backend/utils/activity/pgstat.c Hunk #1 succeeded at 105 (offset 1 line). Hunk #2 succeeded at 691 (offset 18 lines). Hunk #3 succeeded at 1678 (offset 34 lines). patching file src/backend/utils/activity/pgstat_backend.c Hunk #1 succeeded at 168 (offset 1 line). Hunk #2 succeeded at 205 (offset 1 line). patching file src/backend/utils/activity/pgstat_io.c patching file src/backend/utils/adt/pgstatfuncs.c Hunk #3 succeeded at 1640 (offset -4 lines). patching file src/include/catalog/pg_proc.dat Hunk #1 succeeded at 6069 with fuzz 2 (offset 28 lines). patching file src/include/pgstat.h Hunk #1 succeeded at 326 (offset 1 line). Hunk #2 succeeded at 350 (offset 1 line). Hunk #3 succeeded at 545 (offset 19 lines). Hunk #4 succeeded at 651 (offset 15 lines). patching file src/include/port/pg_bitutils.h patching file src/include/utils/pgstat_internal.h Hunk #1 succeeded at 608 with fuzz 2 (offset 8 lines). patching file src/test/recovery/t/029_stats_restart.pl patching file src/test/regress/expected/rules.out Hunk #1 FAILED at 1952. 1 out of 1 hunk FAILED -- saving rejects to file src/test/regress/expected/rules.out.rej patching file src/tools/pgindent/typedefs.list Hunk #1 succeeded at 3835 (offset 57 lines). Unstaged changes after reset: M configure M configure.ac M doc/src/sgml/config.sgml M doc/src/sgml/monitoring.sgml M doc/src/sgml/wal.sgml M meson.build M src/backend/catalog/system_views.sql M src/backend/utils/activity/pgstat.c M src/backend/utils/activity/pgstat_backend.c M src/backend/utils/activity/pgstat_io.c M src/backend/utils/adt/pgstatfuncs.c M src/include/catalog/pg_proc.dat M src/include/pgstat.h M src/include/port/pg_bitutils.h M src/include/utils/pgstat_internal.h M src/test/recovery/t/029_stats_restart.pl M src/tools/pgindent/typedefs.list Removing src/test/regress/expected/rules.out.rej === using 'git apply' to apply patch ./v9a-0001-Add-pg_stat_io_histogram-view-to-provide-more-det.patch === Applied patch to 'configure' cleanly. Applied patch to 'configure.ac' cleanly. Applied patch to 'doc/src/sgml/config.sgml' cleanly. Applied patch to 'doc/src/sgml/monitoring.sgml' with conflicts. Applied patch to 'doc/src/sgml/wal.sgml' cleanly. Applied patch to 'meson.build' cleanly. Applied patch to 'src/backend/catalog/system_views.sql' cleanly. Applied patch to 'src/backend/utils/activity/pgstat.c' cleanly. Applied patch to 'src/backend/utils/activity/pgstat_backend.c' cleanly. Applied patch to 'src/backend/utils/activity/pgstat_io.c' cleanly. Applied patch to 'src/backend/utils/adt/pgstatfuncs.c' cleanly. Applied patch to 'src/include/catalog/pg_proc.dat' with conflicts. Applied patch to 'src/include/pgstat.h' cleanly. Applied patch to 'src/include/port/pg_bitutils.h' cleanly. Applied patch to 'src/include/utils/pgstat_internal.h' cleanly. Applied patch to 'src/test/recovery/t/029_stats_restart.pl' cleanly. Applied patch to 'src/test/regress/expected/rules.out' with conflicts. Applied patch to 'src/tools/pgindent/typedefs.list' cleanly. U doc/src/sgml/monitoring.sgml U src/include/catalog/pg_proc.dat U src/test/regress/expected/rules.out diff --cc doc/src/sgml/monitoring.sgml index 08d5b824552,f0fa759f532..00000000000 --- a/doc/src/sgml/monitoring.sgml +++ b/doc/src/sgml/monitoring.sgml @@@ -510,11 -510,13 +510,21 @@@ postgres 27093 0.0 0.0 30096 275 ++<<<<<<< ours + pg_stat_lockpg_stat_lock + + One row for each lock type, containing cluster-wide locks statistics. + See + pg_stat_lock for details. ++======= + pg_stat_io_histogrampg_stat_io_histogram + + One row for each combination of backend type, context, target object, + IO operation type and latency bucket (in microseconds) containing + cluster-wide I/O statistics. + See + pg_stat_io_histogram for details. ++>>>>>>> theirs @@@ -3302,21 -3296,42 +3314,60 @@@ description | Waiting for a newly initi ++<<<<<<< ours + + + <structname>pg_stat_lock</structname> + + + pg_stat_lock + + + + The pg_stat_lock view will contain one row for each + lock type, showing cluster-wide locks statistics. + + + + <structname>pg_stat_lock</structname> View ++======= + + <structname>pg_stat_io_histogram</structname> + + + pg_stat_io_histogram + + + + The pg_stat_io_histogram view will contain one row for each + combination of backend type, target I/O object, and I/O context, IO operation + type, bucket latency cluster-wide I/O statistics. Combinations which do not make sense + are omitted. + + + + The view shows measured perceived I/O latency by the backend, not the kernel or device + one. This is important distinction when troubleshooting, as the I/O latency observed by + the backend might get affected by: + + + OS scheduler decisions and available CPU resources. + With AIO, it might include time to service other IOs from the queue. That will often inflate IO latency. + In case of writing, additional filesystem journaling operations. + + + + + + Currently, I/O on relations (e.g. tables, indexes) and WAL activity are + tracked. However, relation I/O which bypasses shared buffers + (e.g. when moving a table from one tablespace to another) is currently + not tracked. + + +
+ <structname>pg_stat_io_histogram</structname> View ++>>>>>>> theirs @@@ -3334,11 -3349,15 +3385,22 @@@ ++<<<<<<< ours + locktype text + + + Type of the lockable object. See + pg_locks for details. ++======= + backend_type text + + + Type of backend (e.g. background worker, autovacuum worker). See + pg_stat_activity for more information + on backend_types. Some + backend_types do not accumulate I/O operation + statistics and will not be included in the view. @@@ -3346,38 -3365,159 +3408,189 @@@ + object text + + + Target object of an I/O operation. Possible values are: + + + + relation: Permanent relations. + + + + + temp relation: Temporary relations. + + + + + wal: Write Ahead Logs. + + + ++>>>>>>> theirs + + + + + + + ++<<<<<<< ours + waits bigint + + + Number of times a lock of this type had to wait because of a + conflicting lock. Only incremented when the lock was successfully + acquired after waiting longer than . + ++======= + context text + + + The context of an I/O operation. Possible values are: + + + + + normal: The default or standard + context for a type of I/O operation. For + example, by default, relation data is read into and written out from + shared buffers. Thus, reads and writes of relation data to and from + shared buffers are tracked in context + normal. + + + + + init: I/O operations performed while creating the + WAL segments are tracked in context + init. + + + + + vacuum: I/O operations performed outside of shared + buffers while vacuuming and analyzing permanent relations. Temporary + table vacuums use the same local buffer pool as other temporary table + I/O operations and are tracked in context + normal. + + + + + bulkread: Certain large read I/O operations + done outside of shared buffers, for example, a sequential scan of a + large table. + + + + + bulkwrite: Certain large write I/O operations + done outside of shared buffers, such as COPY. + + + ++>>>>>>> theirs ++<<<<<<< ours + wait_time bigint + + + Total time spent waiting for locks of this type, in milliseconds. + Only incremented when the lock was successfully acquired after waiting + longer than . + ++======= + io_type text + + + The type of I/O operation. Possible values are: + + + + + evict: eviction from shared buffers cache. + + + + + fsync: synchronization of modified kernel's + filesystem page cache with storage device. + + + + + hit: shared buffers cache lookup hit. + + + + + reuse: reuse of existing buffer in case of + reusing limited-space ring buffer (applies to bulkread, + bulkwrite, or vacuum contexts). + + + + + writeback: advise kernel that the described dirty + data should be flushed to disk preferably asynchronously. + + + + + extend: add new zeroed blocks to the end of file. + + + + + read: self explanatory. + + + + + write: self explanatory. + + + ++>>>>>>> theirs ++<<<<<<< ours + fastpath_exceeded bigint + + + Number of times a lock of this type could not be acquired via fast path + because the fast path slot limit was exceeded. Increasing + can reduce this number. ++======= + bucket_latency_us int4range + + + The latency bucket (in microseconds). + + + + + + + + bucket_count bigint + + + Number of times latency of the I/O operation hit this specific bucket (with + up to bucket_latency_us microseconds). ++>>>>>>> theirs @@@ -3395,6 -3535,43 +3608,46 @@@
++<<<<<<< ours ++======= + + + Some backend types never perform I/O operations on some I/O objects and/or + in some I/O contexts. These rows might display zero bucket counts for such + specific operations. + + + + pg_stat_io_histogram can be used to identify + I/O storage issues + For example: + + + + Presence of abnormally high latency for fsyncs might + indicate I/O saturation, oversubscription or hardware connectivity issues. + + + + + Unusually high latency for fsyncs on standby's startup + backend type, might be responsible for high duration of commits in + synchronous replication setups. + + + + + + + + Columns tracking I/O wait time will only be non-zero when + is enabled. The user should be + careful when referencing these columns in combination with their + corresponding I/O operations in case track_io_timing + was not enabled for the entire time since the last stats reset. + + ++>>>>>>> theirs
diff --cc src/include/catalog/pg_proc.dat index fa9ae79082b,5a13ca9b8a3..00000000000 --- a/src/include/catalog/pg_proc.dat +++ b/src/include/catalog/pg_proc.dat @@@ -6061,13 -6041,14 +6061,24 @@@ proargnames => '{backend_type,object,context,reads,read_bytes,read_time,writes,write_bytes,write_time,writebacks,writeback_time,extends,extend_bytes,extend_time,hits,evictions,reuses,fsyncs,fsync_time,stats_reset}', prosrc => 'pg_stat_get_io' }, ++<<<<<<< ours +{ oid => '9375', descr => 'statistics: per lock type statistics', + proname => 'pg_stat_get_lock', prorows => '10', proretset => 't', + provolatile => 'v', proparallel => 'r', prorettype => 'record', + proargtypes => '', proallargtypes => '{text,int8,int8,int8,timestamptz}', + proargmodes => '{o,o,o,o,o}', + proargnames => '{locktype,waits,wait_time,fastpath_exceeded,stats_reset}', + prosrc => 'pg_stat_get_lock' }, ++======= + { oid => '6149', descr => 'statistics: per backend type IO latency histogram', + proname => 'pg_stat_get_io_histogram', prorows => '30', proretset => 't', + provolatile => 'v', proparallel => 'r', prorettype => 'record', + proargtypes => '', + proallargtypes => '{text,text,text,text,int4range,int8,timestamptz}', + proargmodes => '{o,o,o,o,o,o,o}', + proargnames => '{backend_type,object,context,io_type,bucket_latency_us,bucket_count,stats_reset}', + prosrc => 'pg_stat_get_io_histogram' }, ++>>>>>>> theirs { oid => '6386', descr => 'statistics: backend IO statistics', proname => 'pg_stat_get_backend_io', prorows => '5', proretset => 't', diff --cc src/test/regress/expected/rules.out index a65a5bf0c4f,02f14d6219d..00000000000 --- a/src/test/regress/expected/rules.out +++ b/src/test/regress/expected/rules.out @@@ -1967,12 -1952,14 +1967,23 @@@ pg_stat_io| SELECT backend_type fsync_time, stats_reset FROM pg_stat_get_io() b(backend_type, object, context, reads, read_bytes, read_time, writes, write_bytes, write_time, writebacks, writeback_time, extends, extend_bytes, extend_time, hits, evictions, reuses, fsyncs, fsync_time, stats_reset); ++<<<<<<< ours +pg_stat_lock| SELECT locktype, + waits, + wait_time, + fastpath_exceeded, + stats_reset + FROM pg_stat_get_lock() l(locktype, waits, wait_time, fastpath_exceeded, stats_reset); ++======= + pg_stat_io_histogram| SELECT backend_type, + object, + context, + io_type, + bucket_latency_us, + bucket_count, + stats_reset + FROM pg_stat_get_io_histogram() b(backend_type, object, context, io_type, bucket_latency_us, bucket_count, stats_reset); ++>>>>>>> theirs pg_stat_progress_analyze| SELECT s.pid, s.datid, d.datname,