]> begriffs open source - ai-pg/blob - full-docs/html/pglogicalinspect.html
Include latest toc output
[ai-pg] / full-docs / html / pglogicalinspect.html
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>F.28. pg_logicalinspect — logical decoding components inspection</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="pgfreespacemap.html" title="F.27. pg_freespacemap — examine the free space map" /><link rel="next" href="pgoverexplain.html" title="F.29. pg_overexplain — allow EXPLAIN to dump even more details" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">F.28. pg_logicalinspect — logical decoding components inspection</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="pgfreespacemap.html" title="F.27. pg_freespacemap — examine the free space map">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="contrib.html" title="Appendix F. Additional Supplied Modules and Extensions">Up</a></td><th width="60%" align="center">Appendix F. Additional Supplied Modules and Extensions</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="pgoverexplain.html" title="F.29. pg_overexplain — allow EXPLAIN to dump even more details">Next</a></td></tr></table><hr /></div><div class="sect1" id="PGLOGICALINSPECT"><div class="titlepage"><div><div><h2 class="title" style="clear: both">F.28. pg_logicalinspect — logical decoding components inspection <a href="#PGLOGICALINSPECT" class="id_link">#</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="sect2"><a href="pglogicalinspect.html#PGLOGICALINSPECT-FUNCS">F.28.1. Functions</a></span></dt><dt><span class="sect2"><a href="pglogicalinspect.html#PGLOGICALINSPECT-AUTHOR">F.28.2. Author</a></span></dt></dl></div><a id="id-1.11.7.38.2" class="indexterm"></a><p>
3   The <code class="filename">pg_logicalinspect</code> module provides SQL functions
4   that allow you to inspect the contents of logical decoding components. It
5   allows the inspection of serialized logical snapshots of a running
6   <span class="productname">PostgreSQL</span> database cluster, which is useful
7   for debugging or educational purposes.
8  </p><p>
9   By default, use of these functions is restricted to superusers and members of
10   the <code class="literal">pg_read_server_files</code> role. Access may be granted by
11   superusers to others using <code class="command">GRANT</code>.
12  </p><div class="sect2" id="PGLOGICALINSPECT-FUNCS"><div class="titlepage"><div><div><h3 class="title">F.28.1. Functions <a href="#PGLOGICALINSPECT-FUNCS" class="id_link">#</a></h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt id="PGLOGICALINSPECT-FUNCS-PG-GET-LOGICAL-SNAPSHOT-META"><span class="term">
13      <code class="function">pg_get_logical_snapshot_meta(filename text) returns record</code>
14     </span> <a href="#PGLOGICALINSPECT-FUNCS-PG-GET-LOGICAL-SNAPSHOT-META" class="id_link">#</a></dt><dd><p>
15       Gets logical snapshot metadata about a snapshot file that is located in
16       the server's <code class="filename">pg_logical/snapshots</code> directory.
17       The <em class="replaceable"><code>filename</code></em> argument represents the snapshot
18       file name.
19       For example:
20 </p><pre class="screen">
21 postgres=# SELECT * FROM pg_ls_logicalsnapdir();
22 -[ RECORD 1 ]+-----------------------
23 name         | 0-40796E18.snap
24 size         | 152
25 modification | 2024-08-14 16:36:32+00
26
27 postgres=# SELECT * FROM pg_get_logical_snapshot_meta('0-40796E18.snap');
28 -[ RECORD 1 ]--------
29 magic    | 1369563137
30 checksum | 1028045905
31 version  | 6
32
33 postgres=# SELECT ss.name, meta.* FROM pg_ls_logicalsnapdir() AS ss,
34 pg_get_logical_snapshot_meta(ss.name) AS meta;
35 -[ RECORD 1 ]-------------
36 name     | 0-40796E18.snap
37 magic    | 1369563137
38 checksum | 1028045905
39 version  | 6
40 </pre><p>
41      </p><p>
42       If <em class="replaceable"><code>filename</code></em> does not match a snapshot file, the
43       function raises an error.
44      </p></dd><dt id="PGLOGICALINSPECT-FUNCS-PG-GET-LOGICAL-SNAPSHOT-INFO"><span class="term">
45      <code class="function">pg_get_logical_snapshot_info(filename text) returns record</code>
46     </span> <a href="#PGLOGICALINSPECT-FUNCS-PG-GET-LOGICAL-SNAPSHOT-INFO" class="id_link">#</a></dt><dd><p>
47       Gets logical snapshot information about a snapshot file that is located in
48       the server's <code class="filename">pg_logical/snapshots</code> directory.
49       The <em class="replaceable"><code>filename</code></em> argument represents the snapshot
50       file name.
51       For example:
52 </p><pre class="screen">
53 postgres=# SELECT * FROM pg_ls_logicalsnapdir();
54 -[ RECORD 1 ]+-----------------------
55 name         | 0-40796E18.snap
56 size         | 152
57 modification | 2024-08-14 16:36:32+00
58
59 postgres=# SELECT * FROM pg_get_logical_snapshot_info('0-40796E18.snap');
60 -[ RECORD 1 ]------------+-----------
61 state                    | consistent
62 xmin                     | 751
63 xmax                     | 751
64 start_decoding_at        | 0/40796AF8
65 two_phase_at             | 0/40796AF8
66 initial_xmin_horizon     | 0
67 building_full_snapshot   | f
68 in_slot_creation         | f
69 last_serialized_snapshot | 0/0
70 next_phase_at            | 0
71 committed_count          | 0
72 committed_xip            |
73 catchange_count          | 2
74 catchange_xip            | {751,752}
75
76 postgres=# SELECT ss.name, info.* FROM pg_ls_logicalsnapdir() AS ss,
77 pg_get_logical_snapshot_info(ss.name) AS info;
78 -[ RECORD 1 ]------------+----------------
79 name                     | 0-40796E18.snap
80 state                    | consistent
81 xmin                     | 751
82 xmax                     | 751
83 start_decoding_at        | 0/40796AF8
84 two_phase_at             | 0/40796AF8
85 initial_xmin_horizon     | 0
86 building_full_snapshot   | f
87 in_slot_creation         | f
88 last_serialized_snapshot | 0/0
89 next_phase_at            | 0
90 committed_count          | 0
91 committed_xip            |
92 catchange_count          | 2
93 catchange_xip            | {751,752}
94 </pre><p>
95      </p><p>
96       If <em class="replaceable"><code>filename</code></em> does not match a snapshot file, the
97       function raises an error.
98      </p></dd></dl></div></div><div class="sect2" id="PGLOGICALINSPECT-AUTHOR"><div class="titlepage"><div><div><h3 class="title">F.28.2. Author <a href="#PGLOGICALINSPECT-AUTHOR" class="id_link">#</a></h3></div></div></div><p>
99    Bertrand Drouvot <code class="email">&lt;<a class="email" href="mailto:bertranddrouvot.pg@gmail.com">bertranddrouvot.pg@gmail.com</a>&gt;</code>
100   </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="pgfreespacemap.html" title="F.27. pg_freespacemap — examine the free space map">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="contrib.html" title="Appendix F. Additional Supplied Modules and Extensions">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="pgoverexplain.html" title="F.29. pg_overexplain — allow EXPLAIN to dump even more details">Next</a></td></tr><tr><td width="40%" align="left" valign="top">F.27. pg_freespacemap — examine the free space map </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="40%" align="right" valign="top"> F.29. pg_overexplain — allow EXPLAIN to dump even more details</td></tr></table></div></body></html>