]> begriffs open source - ai-pg/blob - full-docs/txt/pglogicalinspect.txt
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / txt / pglogicalinspect.txt
1
2 F.28. pg_logicalinspect — logical decoding components inspection #
3
4    F.28.1. Functions
5    F.28.2. Author
6
7    The pg_logicalinspect module provides SQL functions that allow you to
8    inspect the contents of logical decoding components. It allows the
9    inspection of serialized logical snapshots of a running PostgreSQL
10    database cluster, which is useful for debugging or educational
11    purposes.
12
13    By default, use of these functions is restricted to superusers and
14    members of the pg_read_server_files role. Access may be granted by
15    superusers to others using GRANT.
16
17 F.28.1. Functions #
18
19    pg_get_logical_snapshot_meta(filename text) returns record #
20           Gets logical snapshot metadata about a snapshot file that is
21           located in the server's pg_logical/snapshots directory. The
22           filename argument represents the snapshot file name. For
23           example:
24
25 postgres=# SELECT * FROM pg_ls_logicalsnapdir();
26 -[ RECORD 1 ]+-----------------------
27 name         | 0-40796E18.snap
28 size         | 152
29 modification | 2024-08-14 16:36:32+00
30
31 postgres=# SELECT * FROM pg_get_logical_snapshot_meta('0-40796E18.snap');
32 -[ RECORD 1 ]--------
33 magic    | 1369563137
34 checksum | 1028045905
35 version  | 6
36
37 postgres=# SELECT ss.name, meta.* FROM pg_ls_logicalsnapdir() AS ss,
38 pg_get_logical_snapshot_meta(ss.name) AS meta;
39 -[ RECORD 1 ]-------------
40 name     | 0-40796E18.snap
41 magic    | 1369563137
42 checksum | 1028045905
43 version  | 6
44
45           If filename does not match a snapshot file, the function raises
46           an error.
47
48    pg_get_logical_snapshot_info(filename text) returns record #
49           Gets logical snapshot information about a snapshot file that is
50           located in the server's pg_logical/snapshots directory. The
51           filename argument represents the snapshot file name. For
52           example:
53
54 postgres=# SELECT * FROM pg_ls_logicalsnapdir();
55 -[ RECORD 1 ]+-----------------------
56 name         | 0-40796E18.snap
57 size         | 152
58 modification | 2024-08-14 16:36:32+00
59
60 postgres=# SELECT * FROM pg_get_logical_snapshot_info('0-40796E18.snap');
61 -[ RECORD 1 ]------------+-----------
62 state                    | consistent
63 xmin                     | 751
64 xmax                     | 751
65 start_decoding_at        | 0/40796AF8
66 two_phase_at             | 0/40796AF8
67 initial_xmin_horizon     | 0
68 building_full_snapshot   | f
69 in_slot_creation         | f
70 last_serialized_snapshot | 0/0
71 next_phase_at            | 0
72 committed_count          | 0
73 committed_xip            |
74 catchange_count          | 2
75 catchange_xip            | {751,752}
76
77 postgres=# SELECT ss.name, info.* FROM pg_ls_logicalsnapdir() AS ss,
78 pg_get_logical_snapshot_info(ss.name) AS info;
79 -[ RECORD 1 ]------------+----------------
80 name                     | 0-40796E18.snap
81 state                    | consistent
82 xmin                     | 751
83 xmax                     | 751
84 start_decoding_at        | 0/40796AF8
85 two_phase_at             | 0/40796AF8
86 initial_xmin_horizon     | 0
87 building_full_snapshot   | f
88 in_slot_creation         | f
89 last_serialized_snapshot | 0/0
90 next_phase_at            | 0
91 committed_count          | 0
92 committed_xip            |
93 catchange_count          | 2
94 catchange_xip            | {751,752}
95
96           If filename does not match a snapshot file, the function raises
97           an error.
98
99 F.28.2. Author #
100
101    Bertrand Drouvot <bertranddrouvot.pg@gmail.com>