云数据库 GAUSSDB-系统信息函数:事务ID和快照
事务ID和快照
txid_snapshot的文本表示为:xmin:xmax:xip_list。
示例:10:20:10,14,15意思为:xmin=10, xmax=20, xip_list=10, 14, 15。
以下的函数在一个输出形式中提供服务器事务信息。这些函数的主要用途是为了确定在两个快照之间有哪个事务提交。
- pgxc_is_committed(transaction_id)
描述:如果提交或忽略给定的XID(gxid)。NULL表示的状态是未知的(运行、准备、冻结等)。
返回类型:bool
- txid_current()
返回类型:bigint
- gs_txid_oldestxmin()
返回类型:bigint
- txid_current_snapshot()
返回类型:txid_snapshot
- txid_snapshot_xip(txid_snapshot)
返回类型:setof bigint
- txid_snapshot_xmax(txid_snapshot)
返回类型:bigint
- txid_snapshot_xmin(txid_snapshot)
返回类型:bigint
- txid_visible_in_snapshot(bigint, txid_snapshot)
返回类型:Boolean
- get_local_prepared_xact()
描述:获取当前节点两阶段残留事务信息,包括事务id,两阶段gid名称,prepared的时间,owner的oid,database的oid及当前节点的node_name。
返回类型:xid, text, timestamptz, oid, oid,text
- get_remote_prepared_xacts()
描述:获取所有远程节点两阶段残留事务信息,包括事务id,两阶段gid名称,prepared的时间,owner的名称,database的名称及node_name。
返回类型:xid, text, timestamptz, name, name,text
- global_clean_prepared_xacts(text, text)
描述:并发清理两阶段残留事务,仅gs_clean工具调用该函数进行清理,其他情况下调用均返回false。
返回类型:Boolean
- pgxc_stat_get_wal_senders()
描述:返回集群中所有主DN的发送日志的信息和其对应的备DN的接收日志的信息。仅支持system admin或monitor admin权限用户使用。
返回值如下:表13 pgxc_stat_get_wal_senders返回参数说明 字段名
描述
nodename
实例名。
sender_pid
发送日志的线程pid。
local_role
实例角色。
peer_role
接收端的实例的角色。
peer_state
接收端的实例的状态。
state
实例间同步的状态。
sender_sent_location
发送端发送日志的位置。
sender_write_location
发送端写日志的位置。
sender_flush_location
发送端刷盘日志的位置。
sender_replay_location
当前实例的日志位置。如果是主DN,则该位置和
sender_flush_location相同;否则该位置为当前实例日志回放到的位置。
receiver_received_location
接收端日志接收到的位置。
receiver_write_location
接收端日志写的位置。
receiver_flush_location
接收端日志刷盘的位置。
receiver_replay_location
接收端日志回放的位置。
- pgxc_stat_get_wal_senders_status()
描述:返回所有节点事务日志接收状态。仅支持system admin或monitor admin权限用户使用。
返回值如下:
表14 pgxc_stat_get_wal_senders_status返回参数说明 字段名
描述
nodename
主节点名。
source_ip
主节点IP。
source_port
主节点端口。
dest_ip
备节点IP。
dest_port
备节点端口。
sender_pid
发送线程PID。
local_role
主节点类型。
peer_role
备节点类型。
peer_state
备节点状态。
state
wal sender状态。
sender_sent_location
主节点发送位置。
sender_write_location
主节点落盘位置。
sender_replay_location
主节点redo位置。
receiver_received_location
备节点接收位置。
receiver_write_location
备节点落盘位置。
receiver_flush_location
备节点flush磁盘位置。
receiver_replay_location
备节点redo位置。
- gs_get_next_xid_csn()
描述:返回全局所有节点上的next_xid和next_csn值。
返回值如下:
表15 gs_get_next_xid_csn返回参数说明 字段名
描述
nodename
节点名称。
next_xid
当前节点下一个事务id号。
next_csn
当前节点下一个csn号。
- simsearch_lib_load_status()
返回值类型:SETOF record
- simsearch_gpu_vector_status()
返回值类型:SETOF record
由于规格变更,当前版本已经不再支持该函数,请不要使用。
- pg_control_system()
返回类型:SETOF record
- pg_control_checkpoint()
返回类型:SETOF record
- get_prepared_pending_xid
参数:nan
返回值类型:text
- pg_clean_region_info
参数:nan
返回值类型:character varying
- pg_get_delta_info
参数:rel text, schema_name text
返回值类型:part_name text, live_tuple bigint, data_size bigint, blocknum bigint
- pgxc_get_delta_info
描述:从全部dn获取delta info。仅sysadmin和monitor admin用户可以访问。
参数:rel text, schema_name text
返回值类型:part_name text, live_tuple bigint, data_size bigint, blocknum bigint
- pg_get_replication_slot_name
参数:nan
返回值类型:text
- pg_get_running_xacts
参数:nan
返回值类型:handle integer, gxid xid, state tinyint, node text, xmin xid, vacuum boolean, timeline bigint, prepare_xid xid, pid bigint, next_xid xid
- pg_get_variable_info
参数:nan
返回值类型:node_name text, nextOid oid, nextXid xid, oldestXid xid, xidVacLimit xid, oldestXidDB oid, lastExtend CS NLogpage xid, startExtendCSNLogpage xid, nextCommitSeqNo xid, latestCompletedXid xid, startupMaxXid xid
- pg_get_xidlimit
参数:nan
返回值类型:nextXid xid, oldestXid xid, xidVacLimit xid, xidWarnLimit xid, xidStopLimit xid, xidWrapLimit xid, oldestXidDB oid
- pg_stat_file_recursive
参数:location text
返回值类型:path text, filename text, size bigint, isdir boolean
- pg_stat_get_activity_for_temptable
参数:nan
返回值类型:datid oid, timelineid integer, tempid integer, sessionid bigint
- pg_stat_get_activity_ng
参数:pid bigint
返回值类型:datid oid, pid bigint, sessionid bigint, node_group text
- pg_stat_get_cgroup_info
参数:nan
返回值类型:cgroup_name text, percent integer, usage_percent integer, shares bigint, usage bigint, cpuset text, relpath text, valid text, node_group text
- pg_stat_get_realtime_info_internal
描述:返回实时信息,当前该接口已不可用,返回FailedToGetSessionInfo。
参数:oid, oid, bigint, cstring, oid
返回值类型:text
- pg_stat_get_session_wlmstat
参数:pid integer
返回值类型:datid oid, threadid bigint, sessionid bigint, threadpid integer, usesysid oid, appname text, query text, priority bigint, block_time bigint, elapsed_time bigint, total_cpu_time bigint, skew_percent integer, statement_mem integer, active_points integer, dop_value integer, current_cgroup text, current_status text, enqueue_state text, attribute text, is_plana boolean, node_group text, srespool name
- pg_stat_get_wlm_instance_info
参数:nan
返回值类型:instancename text, timestamp timestamp with time zone, used_cpu integer, free_memory integer, used_memory integer, io_await double precision, io_util double precision, disk_read double precision, disk_write double precision, process_read bigint, process_write bigint, logical_read bigint, logical_write bigint, read_counts bigint, write_counts bigint
- pg_stat_get_wlm_instance_info_with_cleanup
参数:nan
返回值类型:instancename text, timestamp timestamp with time zone, used_cpu integer, free_memory integer, used_memory integer, io_await double precision, io_util double precision, disk_read double precision, disk_write double precision, process_read bigint, process_write bigint, logical_read bigint, logical_write bigint, read_counts bigint, write_counts bigint
- pg_stat_get_wlm_node_resource_info
参数:nan
返回值类型:min_mem_util integer, max_mem_util integer, min_cpu_util integer, max_cpu_util integer, min_io_util integer, max_io_util integer, used_mem_rate integer
- pg_stat_get_wlm_operator_info
参数:nan
返回值类型:queryid bigint, pid bigint, plan_node_id integer, plan_node_name text, start_time timestamp with time zone, duration bigint, query_dop integer, estimated_rows bigint, tuple_processed bigint, min_peak_memory integer, max_peak_memory integer, average_peak_memory integer, memory_skew_percent integer, min_spill_size integer, max_spill_size integer, average_spill_size integer, spill_skew_percent integer, min_cpu_time bigint, max_cpu_time bigint, total_cpu_time bigint, cpu_skew_percent integer, warning text
- pg_stat_get_wlm_realtime_operator_info
参数:nan
返回值类型:queryid bigint, pid bigint, plan_node_id integer, plan_node_name text, start_time timestamp with time zone, duration bigint, status text, query_dop integer, estimated_rows bigint, tuple_processed bigint, min_peak_memory integer, max_peak_memory integer, average_peak_memory integer, memory_skew_percent integer, min_spill_size integer, max_spill_size integer, average_spill_size integer, spill_skew_percent integer, min_cpu_time bigint, max_cpu_time bigint, total_cpu_time bigint, cpu_skew_percent integer, warning text
- pg_stat_get_wlm_realtime_session_info
参数:nan
返回值类型:nodename text, threadid bigint, block_time bigint, duration bigint, estimate_total_time bigint, estimate_left_time bigint, schemaname text, query_band text, spill_info text, control_group text, estimate_memory integer, min_peak_memory integer, max_peak_memory integer, average_peak_memory integer, memory_skew_percent integer, min_spill_size integer, max_spill_size integer, average_spill_size integer, spill_skew_percent integer, min_dn_time bigint, max_dn_time bigint, average_dn_time bigint, dntime_skew_percent integer, min_cpu_time bigint, max_cpu_time bigint, total_cpu_time bigint, cpu_skew_percent integer, min_peak_iops integer, max_peak_iops integer, average_peak_iops integer, iops_skew_percent integer, warning text, query text, query_plan text, cpu_top1_node_name text, cpu_top2_node_name text, cpu_top3_node_name text, cpu_top4_node_name text, cpu_top5_node_name text, mem_top1_node_name text, mem_top2_node_name text, mem_top3_node_name text, mem_top4_node_name text, mem_top5_node_name text, cpu_top1_value bigint, cpu_top2_value bigint, cpu_top3_value bigint, cpu_top4_value bigint, cpu_top5_value bigint, mem_top1_value bigint, mem_top2_value bigint, mem_top3_value bigint, mem_top4_value bigint, mem_top5_value bigint, top_mem_dn text, top_cpu_dn text
- pg_stat_get_wlm_session_info_internal
参数:oid, bigint, bigint, oid
返回值类型:SETOF text
- pg_stat_get_wlm_session_iostat_info
参数:nan
返回值类型:threadid bigint, maxcurr_iops integer, mincurr_iops integer, maxpeak_iops integer, minpeak_iops integer, iops_limits integer, io_priority integer, curr_io_limits integer
- pg_stat_get_wlm_statistics
参数:nan
返回值类型:statement text, block_time bigint, elapsed_time bigint, total_cpu_time bigint, qualification_time bigint, skew_percent integer, control_group text, status text, action text
- pg_test_err_contain_err
参数:integer
返回值类型:void
- pv_session_memory_detail_tp
描述:返回会话的内存使用情况,参考pv_session_memory_detail。
参数:nan
返回值类型:sessid text, sesstype text, contextname text, level smallint, parent text, totalsize bigint, freesize bigint, usedsize bigint
- gs_get_table_distribution
参数:table_name text, schema_name text
返回值类型:text
- pv_builtin_functions
参数:nan
返回值类型:proname name, pronamespace oid, proowner oid, prolang oid, procost real, prorows real, provariadic oid, protransform regproc, proisagg boolean, proiswindow boolean, prosecdef boolean, proleakproof boolean, proisstrict boolean, proretset boolean, provolatile "char", pronargs smallint, pronargdefaults smallint, prorettype oid, proargtypes oidvector, proallargtypes integer[], proargmodes "char"[], proargnames text[], proargdefaults pg_node_tree, prosrc text, probin text, proconfig text[], proacl aclitem[], prodefaultargpos int2vector, fencedmode boolean, proshippable boolean, propackage boolean, oid oid
- pv_thread_memory_detail
参数:nan
返回值类型:threadid text, tid bigint, thrdtype text, contextname text, level smallint, parent text, totalsize bigint, freesize bigint, usedsize bigint
- pg_shared_memory_detail
描述:返回所有已产生的共享内存上下文的使用信息,各列描述请参考SHARED_MEMORY_DETAIL。
参数:nan
返回值类型:contextname text, level smallint, parent text, totalsize bigint, freesize bigint, usedsize bigint
- pgxc_get_running_xacts
描述:返回集群中各个节点运行事务的信息,字段内容和PGXC_RUNNING_XA CTS 相同。只有system admin和monitor admin用户有权限查看。
参数:nan
返回值类型:setof record
- pgxc_snapshot_status()
描述:在GTM模式下,返回GTM中关键内存信息状态,用来支持问题定位,GTM-Free、GTM-Lite不支持本函数。
参数:nan
返回值类型:xmin xid, xmax xid, xcnt int, oldestxmin xid, next_xid xid, timeline int, active_thread_num int, max_active_thread_num int, snapshot_num int, snapshot_totalsize bigint
返回值描述如下:
表16 get_gtm_lite_status返回参数说明 字段名
描述
xmin
GTM上当前最小的活跃事务id。
xmax
GTM上当前提交的最大的事务id + 1,大于等于该值的事务id是活跃的。
xcnt
GTM上当前活跃事务个数。
oldestxmin
GTM上最老被访问的事务id号。
next_xid
GTM上下一个分配的事务id号。
timeline
GTM上当前的时间线。
active_thread_num
GTM上当前活跃的工作线程数。
max_active_thread_num
GTM上1分钟内工作线程数峰值。
snapshot_num
GTM上1分钟内下发的快照个数。
snapshot_totalsize
GTM上1分钟内下发快照总大小。
- get_gtm_lite_status()
描述:返回GTM上的backupXid和csn号,用来支持问题定位,GTM-FREE模式下不支持使用本系统函数。
返回值如下:表17 get_gtm_lite_status返回参数说明 字段名
描述
backup_xid
GTM上的备份Xid值。
csn
GTM当前下发的最新的csn号。
- 云硬盘快照是什么_云硬盘快照应用场景_快照和备份的区别
- GaussDB递归_层次递归查询函数_高斯数据库递归-华为云
- GaussDB数据库云备份_华为GaussDB_高斯数据库云备份
- GaussDB内存_云数据库GaussDB内存_高斯数据库内存-华为云
- GaussDB内核_GaussDB数据库内核_高斯数据库内核_华为云
- GaussDB考试_GaussDB数据库考试_高斯数据库考试_华为云
- GaussDB数据库安全_GaussDB收费吗_高斯数据库安全
- GaussDB架构_GaussDB数据库架构_高斯数据库架构-华为云
- GaussDB列转行_gaussdb是关系型数据库吗_高斯数据库列转行_华为云
- GaussDB数据库函数_GaussDB函数和操作符_高斯数据库函数-华为云