更新时间:2024-06-07 GMT+08:00
分享

Enhanced Toast运维管理

通过gs_parse_page_bypath解析主表中的ToastPointer信息。

gaussdb=#  SELECT ctid,next_chunk,chunk_seq FROM pg_toast.pg_toast_part_17559;
 ctid  | next_chunk | chunk_seq
-------+------------+-----------
 (0,1) | (0,0)      |         1
 (0,2) | (0,1)      |         0
 (0,3) | (0,0)      |         1
 (0,4) | (0,3)      |         0
(4 rows)
gaussdb=#  SELECT gs_parse_page_bypath((SELECT * FROM pg_relation_filepath('test_toast')),0,'uheap',false);
                       gs_parse_page_bypath
------------------------------------------------------------------
 ${data_dir}/gs_log/dump/1663_13113_17603_0.page
(1 row)

解析文件1663_13113_17603_0.page中存储了ToastPointer的相关信息,具体如下:

Toast_Pointer:
 column_index: 1  
  toast_relation_oid: 17608    --线外存储表OID信息
  ctid: (4, 1)                 --线外存储数据链,头指针
  bucket id: -1                --bucket id信息
 column_index: 2
  toast_relation_oid: 17608
  ctid: (2, 1)                    
  bucket id: -1

Enhanced Toast数据查询,通过直接查询到的Enhanced Toast表数据可以判断其链式结构的完整性。

gaussdb=#  SELECT ctid,next_chunk,chunk_seq FROM pg_toast.pg_toast_part_17559;
 ctid  | next_chunk | chunk_seq
-------+------------+-----------
 (0,1) | (0,0)      |         1
 (0,2) | (0,1)      |         0
 (0,3) | (0,0)      |         1
 (0,4) | (0,3)      |         0
(4 rows)

分享:

    相关文档

    相关产品