全局临时表函数

  • pg_get_gtt_relstats(relOid)

    描述:显示当前会话指定的全局临时表的基本信息。

    参数:全局临时表的OID。

    返回值类型:record

    示例:

    openGauss=# select * from pg_get_gtt_relstats(74069);
     relfilenode | relpages | reltuples | relallvisible | relfrozenxid | relminmxid 
    -------------+----------+-----------+---------------+--------------+------------
           74069 |       58 |     13000 |             0 |        11151 |          0
    (1 row)
    
  • pg_get_gtt_statistics(relOid, attnum, ''::text)

    描述:显示当前会话指定的全局临时表的单列统计信息。

    参数:全局临时表的OID和属性attnum。

    返回值类型:record

    示例:

    openGauss=# select * from pg_get_gtt_statistics(74069,1,''::text);
     starelid | starelkind | staattnum | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanu
    mbers4 | stanumbers5 |                                                                                                                                                                                                                      
                                              stavalues1                                                                                                                                                                                        
                                                                            | stavalues2 | stavalues3 | stavalues4 | stavalues5 | stadndistinct | staextinfo 
    ----------+------------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+------
    -------+-------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    ------------------------------------------------------------------------+------------+------------+------------+------------+---------------+------------
        74069 | c          |         1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 |             | {1}         |             |      
           |             | {1,130,260,390,520,650,780,910,1040,1170,1300,1430,1560,1690,1820,1950,2080,2210,2340,2470,2600,2730,2860,2990,3120,3250,3380,3510,3640,3770,3900,4030,4160,4290,4420,4550,4680,4810,4940,5070,5200,5330,5460,5590,57
    20,5850,5980,6110,6240,6370,6500,6630,6760,6890,7020,7150,7280,7410,7540,7670,7800,7930,8060,8190,8320,8450,8580,8710,8840,8970,9100,9230,9360,9490,9620,9750,9880,10010,10140,10270,10400,10530,10660,10790,10920,11050,11180,11310,11440,1
    1570,11700,11830,11960,12090,12220,12350,12480,12610,12740,12870,13000} |            |            |            |            |             0 | 
    (1 row)
    
  • pg_gtt_attached_pid(relOid)

    描述:显示正在使用指定全局临时表的所有线程pid。

    参数:全局临时表的OID。

    返回值类型:record

    示例:

    openGauss=# select * from pg_gtt_attached_pid(74069);
     relid |       pid       
    -------+-----------------
     74069 | 139648170456832
     74069 | 139648123270912
    (2 rows)
    
  • dbe_perf.get_global_full_sql_by_timestamp(start_timestamp timestamp, end_timestamp timestamp)

    描述:获取实例级的全量SQL(Full SQL)信息。

    返回值类型:record

    表 1 dbe_perf.get_global_full_sql_by_timestamp参数说明

    参数

    类型

    描述

    start_timestamp

    timestamp

    SQL启动时间范围的开始时间点。

    end_timestamp

    timestamp

    SQL启动时间范围的结束时间点。

  • dbe_perf.get_global_slow_sql_by_timestamp(start_timestamp timestamp, end_timestamp timestamp)

    描述:获取实例级的慢SQL(Slow SQL)信息。

    返回值类型:record

    表 2 dbe_perf.get_global_slow_sql_by_timestamp参数说明

    参数

    类型

    描述

    start_timestamp

    timestamp

    SQL启动时间范围的开始时间点。

    end_timestamp

    timestamp

    SQL启动时间范围的结束时间点。

  • statement_detail_decode(detail text, format text, pretty bool)

    解析全量/慢SQL语句中的details字段的信息。

    表 3 statement_detail_decode参数说明

    参数

    类型

    描述

    detail

    text

    SQL语句产生的事件的集合(不可读)。

    format

    text

    解析输出格式,取值为plaintext或json。

    pretty

    bool

    当format为plaintext时,是否以优雅的格式展示:
    • true表示通过“\n”分隔事件。
    • false表示通过“,”分隔事件。
  • pg_list_gtt_relfrozenxids()

    描述:显示各会话的冻结事务xid。

    pid=0的行,显示所有会话中最老的冻结事务xid。

    参数:无。

    返回值类型:record

    示例:

    openGauss=# select * from pg_list_gtt_relfrozenxids();
           pid       | relfrozenxid 
    -----------------+--------------
     139648123270912 |        11151
     139648170456832 |        11155
                   0 |        11151
    (3 rows)
    
意见反馈
编组 3备份
openGauss 2024-03-19 00:48:12
取消