XIDs and Snapshots
Name |
Description |
---|---|
xmin |
Earliest XID (txid) that is still active. All earlier transactions will either be committed and visible, or rolled back. |
xmax |
First as-yet-unassigned txid. All txids greater than or equal to this are not yet started as of the time of the snapshot, so they are invisible. |
xip_list |
Active txids at the time of the snapshot. The list includes only those active txids between xmin and xmax; there might be active txids higher than xmax. A txid that is greater than or equal to xmin and less than xmax and that is not in this list was already completed at the time of the snapshot, and is either visible or rolled back according to its commit status. The list does not include txids of subtransactions. |
The textual representation of txid_snapshot is xmin:xmax:xip_list.
For example, 10:20:10,14,15 means xmin=10, xmax=20, xip_list=10, 14, 15.
The following functions provide server transaction information in an exportable form. These functions are mainly used to determine which transactions were committed between two snapshots.
pgxc_is_committed(transaction_id)
Description: Specifies whether the given XID (gxid) of an ordinary table is committed or ignored. NULL indicates an unknown state (such as running, preparing, or freezing).
Return type: Boolean
pgxc_is_committed(transaction_id, bucketid)
Description: The hash bucket table is not supported in the current version in centralized mode. An error is reported when the function is called.
txid_current()
Description: Obtains the current XID.
Return type: bigint
gs_txid_oldestxmin()
Description: Obtains the minimum XID (specified by oldesxmin).
Return type: bigint
txid_current_snapshot()
Description: Obtains the current snapshot.
Return type: txid_snapshot
txid_snapshot_xip(txid_snapshot)
Description: Obtains in-progress XIDs in a snapshot.
Return type: setof bigint
txid_snapshot_xmax(txid_snapshot)
Description: Obtains xmax of snapshots.
Return type: bigint
txid_snapshot_xmin(txid_snapshot)
Description: Obtains xmin of snapshots.
Return type: bigint
txid_visible_in_snapshot(bigint, txid_snapshot)
Description: Specifies whether the XID is visible in a snapshot (do not use subtransaction IDs).
Return type: Boolean
get_local_prepared_xact()
Description: Obtains the two-phase residual transaction information of the current node, including the XID, GID of the two-phase transaction, prepared time, owner OID, database OID, and node name of the current node.
Return type: xid, text, timestamptz, oid, text
get_remote_prepared_xacts()
Description: Obtains the two-phase residual transaction information of all remote nodes, including the XID, GID of the two-phase transaction, prepared time, owner name, database name, and node name.
Return type: xid, text, timestamptz, name, text
global_clean_prepared_xacts(text, text)
Description: Concurrently cleans two-phase residual transactions. If this function is called, false is returned.
Return type: Boolean
gs_get_next_xid_csn()
Description: Returns the values of next_xid and next_csn on all nodes globally.
For details about the return values, see Table 2.
pg_control_system()
Description: Returns the status of the system control file.
Return type: SETOF record
pg_control_checkpoint()
Description: Returns the system checkpoint status
Return type: SETOF record
pv_builtin_functions
Description: Displays information about all built-in system functions.
Parameter: nan
Return type: 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, and oid oid.
pv_thread_memory_detail
Description: Returns the memory information of each thread. In the multi-tenancy scenario, all information is returned if this function is called in a non-PDB, and an empty list is returned if this function is called in a PDB.
Parameter: nan
Return type: threadid text, tid bigint, thrdtype text, contextname text, level smallint, parent text, totalsize bigint, freesize bigint, usedsize bigint
pg_relation_compression_ratio
Description: Queries the compression rate of a table. By default, 1.0 is returned.
Parameter: text
Return type: real
pg_relation_with_compression
Description: Specifies whether a table is compressed.
Parameter: text
Return type: Boolean
pg_stat_file_recursive
Description: Lists all files in a path. In the multi-tenancy scenario, this function is disabled in a PDB.
Parameter: location text
pg_shared_memory_detail
Description: Returns usage information about all generated shared memory contexts. For details about each column, see GS_SHARED_MEMORY_DETAIL.
Parameter: nan
Return type: contextname text, level smallint, parent text, totalsize bigint, freesize bigint, usedsize bigint
get_gtm_lite_status
Description: Returns the backup XID and CSN on the GTM for fault locating. This system function is not supported in GTM-FREE mode or centralized mode.
gs_stat_get_wlm_plan_operator_info
Description: Obtains operator plan information from the internal hash table.
Parameter: oid
Return type: datname text, queryid int8, plan_node_id int4, startup_time int8, total_time int8, actual_rows int8, max_peak_memory int4, query_dop int4, parent_node_id int4, left_child_id int4, right_child_id int4, operation text, orientation text, strategy text, options text, condition text, projection text
pg_stat_get_partition_tuples_hot_updated
Description: Returns statistics on the number of hot updated tuples in a partition with a specified partition ID.
Parameter: oid
Return type: bigint
gs_session_memory_detail_tp
Description: Returns the memory usage of the session. For details, see gs_session_memory_detail.
Parameter: nan
Return type: sessid text, sesstype text, contextname text, level smallint, parent text, totalsize bigint, freesize bigint, usedsize bigint
gs_thread_memory_detail
Description: Returns the memory information of each thread.
Parameter: nan
Return type: threadid text, tid bigint, thrdtype text, contextname text, level smallint, parent text, totalsize bigint, freesize bigint, usedsize bigint
pg_stat_get_wlm_session_iostat_info()
Description: Returns the session load I/O information.
Parameter: nan
Return type: threadid bigint, maxcurr_iops integer, mincurr_iops integer, maxpeak_iops integer, minpeak_iops integer, iops_limits integer, io_priority integer, and curr_io_limits integer
adm_hist_snapshot_func()
Description: Returns information about the snapshot execution time. To access this function, set the enable_wdr_snapshot parameter to on and obtain the permission to access the snapshot schema, snapshot table, and tables_snap_timestamp tables.
Parameter: nan
Return type: snap_id bigint, dbid oid, begin_interval_time timestamp(3), end_interval_time timestamp(3), flush_elapsed interval day(5) to second(1), begin_interval_time_tz timestamp(3) with time zone, end_interval_time_tz timestamp(3) with time zone
gs_get_current_version()
Description: Returns the current compilation mode based on the current compilation macro. 'P' is returned.
Parameter: nan
Return type: char
gs_get_kernel_info()
Description: Transaction information on DNs.
For details about the return values, see Table 3.
Name |
Type |
Description |
---|---|---|
node_name |
text |
Node name. |
module |
text |
Module name, including:
|
name |
text |
Name of the key data in the memory state, including:
|
value |
text |
Value of the key data in the memory state. |
Example:
gaussdb=# SELECT * FROM gs_get_kernel_info();
node_name | module | name | value
--------------+---------+-------------------------------+---------
datanode1 | XACT | startup_max_xid | 16488
datanode1 | XACT | recent_local_xmin | 15805
datanode1 | XACT | recent_global_xmin | 15805
datanode1 | STANDBY | standby_xmin | 0
datanode1 | STANDBY | standby_redo_cleanup_xmin | 0
datanode1 | STANDBY | standby_redo_cleanup_xmin_lsn | 0/0
datanode1 | XACT | local_csn_min | 6014225
datanode1 | XACT | replication_slot_xmin | 0
datanode1 | XACT | replication_slot_catalog_xmin | 0
datanode1 | UNDO | global_recycle_xid | 15805
datanode1 | XACT | global_frozen_xid | 0
datanode1 | XACT | recent_xmin | 15805
datanode1 | XACT | next_csn | 6014226
datanode1 | HOTPATH | hotpatch_additional_info |
datanode1 | FULL_SQL| stmt_session_discard_records | 0
datanode1 | FULL_SQL| stmt_shm_flush_discard_records| 0
datanode1 | XACT | idle_in_trans_timeout_records | 0
(17 row)
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot