aboutsummaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2025-04-01 13:30:33 -0400
committerAndres Freund <andres@anarazel.de>2025-04-01 13:30:33 -0400
commit60f566b4f24362f54003569d5f6e24137bcd83fc (patch)
treea6ff02f2728f442acb851daf94597a58b4194ca1 /doc/src
parent46250cdcb037e302ec5f0734ea0d06e2d21193e0 (diff)
downloadpostgresql-60f566b4f24362f54003569d5f6e24137bcd83fc.tar.gz
postgresql-60f566b4f24362f54003569d5f6e24137bcd83fc.zip
aio: Add pg_aios view
The new view lists all IO handles that are currently in use and is mainly useful for PG developers, but may also be useful when tuning PG. Bumps catversion. Reviewed-by: Noah Misch <noah@leadboat.com> Discussion: https://postgr.es/m/uvrtrknj4kdytuboidbhwclo4gxhswwcpgadptsjvjqcluzmah%40brqs62irg4dt
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/system-views.sgml294
1 files changed, 294 insertions, 0 deletions
diff --git a/doc/src/sgml/system-views.sgml b/doc/src/sgml/system-views.sgml
index 3f5a306247e..e9a59af8c34 100644
--- a/doc/src/sgml/system-views.sgml
+++ b/doc/src/sgml/system-views.sgml
@@ -52,6 +52,11 @@
<tbody>
<row>
+ <entry><link linkend="view-pg-aios"><structname>pg_aios</structname></link></entry>
+ <entry>In-use asynchronous IO handles</entry>
+ </row>
+
+ <row>
<entry><link linkend="view-pg-available-extensions"><structname>pg_available_extensions</structname></link></entry>
<entry>available extensions</entry>
</row>
@@ -231,6 +236,295 @@
</table>
</sect1>
+ <sect1 id="view-pg-aios">
+ <title><structname>pg_aios</structname></title>
+
+ <indexterm zone="view-pg-aios">
+ <primary>pg_aios</primary>
+ </indexterm>
+
+ <para>
+ The <structname>pg_aios</structname> view lists all <xref
+ linkend="glossary-aio"/> handles that are currently in-use. An I/O handle
+ is used to reference an I/O operation that is being prepared, executed or
+ is in the process of completing. <structname>pg_aios</structname> contains
+ one row for each I/O handle.
+ </para>
+
+ <para>
+ This view is mainly useful for developers of
+ <productname>PostgreSQL</productname>, but may also be useful when tuning
+ <productname>PostgreSQL</productname>.
+ </para>
+
+ <table>
+ <title><structname>pg_aios</structname> Columns</title>
+ <tgroup cols="1">
+ <thead>
+ <row>
+ <entry role="catalog_table_entry"><para role="column_definition">
+ Column Type
+ </para>
+ <para>
+ Description
+ </para></entry>
+ </row>
+ </thead>
+
+ <tbody>
+ <row>
+ <entry role="catalog_table_entry"><para role="column_definition">
+ <structfield>pid</structfield> <type>int4</type>
+ </para>
+ <para>
+ Process ID of the server process that is issuing this I/O.
+ </para></entry>
+ </row>
+
+ <row>
+ <entry role="catalog_table_entry"><para role="column_definition">
+ <structfield>io_id</structfield> <type>int4</type>
+ </para>
+ <para>
+ Identifier of the I/O handle. Handles are reused once the I/O
+ completed (or if the handle is released before I/O is started). On reuse
+ <link linkend="view-pg-aios-io-generation">
+ <structname>pg_aios</structname>.<structfield>io_generation</structfield>
+ </link>
+ is incremented.
+ </para></entry>
+ </row>
+
+ <row>
+ <entry role="catalog_table_entry" id="view-pg-aios-io-generation"><para role="column_definition">
+ <structfield>io_generation</structfield> <type>int8</type>
+ </para>
+ <para>
+ Generation of the I/O handle.
+ </para></entry>
+ </row>
+
+ <row>
+ <entry role="catalog_table_entry"><para role="column_definition">
+ <structfield>state</structfield> <type>text</type>
+ </para>
+ <para>
+ State of the I/O handle:
+ <itemizedlist>
+ <listitem>
+ <para>
+ <literal>HANDED_OUT</literal>, referenced by code but not yet used
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>DEFINED</literal>, information necessary for execution is known
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>STAGED</literal>, ready for execution
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>SUBMITTED</literal>, submitted for execution
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>COMPLETED_IO</literal>, finished, but result has not yet been processed
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>COMPLETED_SHARED</literal>, shared completion processing completed
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>COMPLETED_LOCAL</literal>, backend local completion processing completed
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para></entry>
+ </row>
+
+ <row>
+ <entry role="catalog_table_entry"><para role="column_definition">
+ <structfield>operation</structfield> <type>text</type>
+ </para>
+ <para>
+ Operation performed using the I/O handle:
+ <itemizedlist>
+ <listitem>
+ <para>
+ <literal>invalid</literal>, not yet known
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>readv</literal>, a vectored read
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>writev</literal>, a vectored write
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para></entry>
+ </row>
+
+ <row>
+ <entry role="catalog_table_entry"><para role="column_definition">
+ <structfield>off</structfield> <type>int8</type>
+ </para>
+ <para>
+ Offset of the I/O operation.
+ </para></entry>
+ </row>
+
+ <row>
+ <entry role="catalog_table_entry"><para role="column_definition">
+ <structfield>length</structfield> <type>int8</type>
+ </para>
+ <para>
+ Length of the I/O operation.
+ </para></entry>
+ </row>
+
+ <row>
+ <entry role="catalog_table_entry"><para role="column_definition">
+ <structfield>target</structfield> <type>text</type>
+ </para>
+ <para>
+ What kind of object is the I/O targeting:
+ <itemizedlist spacing="compact">
+ <listitem>
+ <para>
+ <literal>smgr</literal>, I/O on relations
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para></entry>
+ </row>
+
+ <row>
+ <entry role="catalog_table_entry"><para role="column_definition">
+ <structfield>handle_data_len</structfield> <type>int2</type>
+ </para>
+ <para>
+ Length of the data associated with the I/O operation. For I/O to/from
+ <xref linkend="guc-shared-buffers"/> and <xref
+ linkend="guc-temp-buffers"/>, this indicates the number of buffers the
+ I/O is operating on.
+ </para></entry>
+ </row>
+
+ <row>
+ <entry role="catalog_table_entry"><para role="column_definition">
+ <structfield>raw_result</structfield> <type>int4</type>
+ </para>
+ <para>
+ Low-level result of the I/O operation, or NULL if the operation has not
+ yet completed.
+ </para></entry>
+ </row>
+
+ <row>
+ <entry role="catalog_table_entry"><para role="column_definition">
+ <structfield>result</structfield> <type>text</type>
+ </para>
+ <para>
+ High-level result of the I/O operation:
+ <itemizedlist>
+ <listitem>
+ <para>
+ <literal>UNKNOWN</literal> means that the result of the
+ operation is not yet known.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>OK</literal> means the I/O completed successfully.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>PARTIAL</literal> means that the I/O completed without
+ error, but did not process all data. Commonly callers will need to
+ retry and perform the remainder of the work in a separate I/O.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>WARNING</literal> means that the I/O completed without
+ error, but that execution of the IO triggered a warning. E.g. when
+ encountering a corrupted buffer with <xref
+ linkend="guc-zero-damaged-pages"/> enabled.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>ERROR</literal> means the I/O failed with an error.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para></entry>
+ </row>
+
+ <row>
+ <entry role="catalog_table_entry"><para role="column_definition">
+ <structfield>target_desc</structfield> <type>text</type>
+ </para>
+ <para>
+ Description of what the I/O operation is targeting.
+ </para></entry>
+ </row>
+
+ <row>
+ <entry role="catalog_table_entry"><para role="column_definition">
+ <structfield>f_sync</structfield> <type>bool</type>
+ </para>
+ <para>
+ Flag indicating whether the I/O is executed synchronously.
+ </para></entry>
+ </row>
+
+ <row>
+ <entry role="catalog_table_entry"><para role="column_definition">
+ <structfield>f_localmem</structfield> <type>bool</type>
+ </para>
+ <para>
+ Flag indicating whether the I/O references process local memory.
+ </para></entry>
+ </row>
+
+ <row>
+ <entry role="catalog_table_entry"><para role="column_definition">
+ <structfield>f_buffered</structfield> <type>bool</type>
+ </para>
+ <para>
+ Flag indicating whether the I/O is buffered I/O.
+ </para></entry>
+ </row>
+
+ </tbody>
+ </tgroup>
+ </table>
+
+ <para>
+ The <structname>pg_aios</structname> view is read-only.
+ </para>
+
+ <para>
+ By default, the <structname>pg_aios</structname> view can be read only by
+ superusers or roles with privileges of the
+ <literal>pg_read_all_stats</literal> role.
+ </para>
+ </sect1>
+
<sect1 id="view-pg-available-extensions">
<title><structname>pg_available_extensions</structname></title>