数据仓库服务 GAUSSDB(DWS)-统计信息函数:pg_xlogdump (tablename)

时间:2024-07-08 10:36:05

pg_xlogdump (tablename)

描述:在CN或者DN上执行,根据表名解析xlog文件并过滤。该函数仅8.3.0及以上集群版本支持。

返回值类型:record

返回信息如下:

名称

类型

描述

node_name

text

节点名称。

start_lsn

text

设定的起始LSN。

end_lsn

text

设定的终止LSN。

startlsn

text

xlog起始lsn。

endlsn

text

xlog终止lsn。

prelsn

text

前一条xlog起始lsn。

xid

xid

xlog事务id号。

datalen

int4

xlog数据长度,单位为byte。

totallen

int4

xlog长度,单位为byte。

type

text

xlog类型。

desc

text

xlog内容。

blkref

text

xlog关联的relfilenode。

  • 由于不同xlog类型xlogdescribe字段的长度不一致,pg_xlogdump()函数会对该字段进行裁剪,仅保留前64个字节。
  • 可以找到目标xlog后结合pg_xlog_display_one_lsn()函数查看完整xlog内容。

示例:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
SELECT * FROM pg_xlogdump(pg_class);
 node_name | startlsn  |  endlsn   |  prelsn   | xlog_tid | datalen | totallen | xlogtype |  xlogdescribe   |                      blkref
-----------+-----------+-----------+-----------+----------+---------+----------+----------+-----------------+---------------------------------------------------
 datanode1 | 0/2DFC660 | 0/2DFE1D0 | 0/2DFA610 |        0 |       2 |     7000 | Heap     | inplace: off 17 | blkrel #0: rel 1663/16324/15920, fork main, blk 2
 datanode1 | 0/2E02270 | 0/2E02D88 | 0/2E00220 |        0 |       2 |     2840 | Heap     | inplace: off 2  | blkrel #0: rel 1663/16324/15920, fork main, blk 0
 datanode1 | 0/2E06E60 | 0/2E06F68 | 0/2E06E28 |        0 |       2 |      264 | Heap     | inplace: off 10 | blkrel #0: rel 1663/16324/15920, fork main, blk 0
 datanode1 | 0/2E0FC08 | 0/2E0FD10 | 0/2E0EBB8 |        0 |       2 |      264 | Heap     | inplace: off 13 | blkrel #0: rel 1663/16324/15920, fork main, blk 0
 datanode1 | 0/2E12960 | 0/2E12A68 | 0/2E11960 |        0 |       2 |      264 | Heap     | inplace: off 15 | blkrel #0: rel 1663/16324/15920, fork main, blk 0
 datanode1 | 0/2E12C88 | 0/2E12D90 | 0/2E12B78 |        0 |       2 |      264 | Heap     | inplace: off 17 | blkrel #0: rel 1663/16324/15920, fork main, blk 0
 datanode1 | 0/2E13FF8 | 0/2E14118 | 0/2E13110 |        0 |       2 |      264 | Heap     | inplace: off 18 | blkrel #0: rel 1663/16324/15920, fork main, blk 0
 datanode1 | 0/2E169F8 | 0/2E185E0 | 0/2E169B0 |        0 |       2 |     7120 | Heap     | inplace: off 1  | blkrel #0: rel 1663/16324/15920, fork main, blk 1
 datanode1 | 0/2E188B8 | 0/2E189D0 | 0/2E185E0 |        0 |       2 |      280 | Heap     | inplace: off 2  | blkrel #0: rel 1663/16324/15920, fork main, blk 1
 datanode1 | 0/2E18BF8 | 0/2E18CE0 | 0/2E189D0 |        0 |       2 |      232 | Heap     | inplace: off 28 | blkrel #0: rel 1663/16324/15920, fork main, blk 1
 datanode1 | 0/2E18E80 | 0/2E18F88 | 0/2E18DC0 |        0 |       2 |      264 | Heap     | inplace: off 4  | blkrel #0: rel 1663/16324/15920, fork main, blk 1
 datanode1 | 0/2E19160 | 0/2E19268 | 0/2E19088 |        0 |       2 |      264 | Heap     | inplace: off 5  | blkrel #0: rel 1663/16324/15920, fork main, blk 1
 datanode1 | 0/2E19460 | 0/2E1B1D0 | 0/2E19388 |        0 |       2 |     7508 | Heap     | inplace: off 16 | blkrel #0: rel 1663/16324/15920, fork main, blk 6
 datanode1 | 0/2E1B1D0 | 0/2E1B2E8 | 0/2E19460 |        0 |       2 |      280 | Heap     | inplace: off 18 | blkrel #0: rel 1663/16324/15920, fork main, blk 6
 datanode1 | 0/2E1B2E8 | 0/2E1B3D0 | 0/2E1B1D0 |        0 |       2 |      232 | Heap     | inplace: off 30 | blkrel #0: rel 1663/16324/15920, fork main, blk 1
(15 rows)
support.huaweicloud.com/sqlreference-830-dws/dws_06_0065.html