Description: Checks whether the connection data buffered in the pool is consistent with pgxc_node.
Return type: boolean
Example:
1 2 3 4 5 | SELECT pgxc_pool_check(); pgxc_pool_check ----------------- t (1 row) |
Description: Updates the connection information buffered in the pool.
Return type: boolean
Example:
1 2 3 4 5 | SELECT pgxc_pool_reload(); pgxc_pool_reload ------------------ t (1 row) |
Description: Clears invalid backend threads on a CN. (These backend threads hold invalid pooler connections to standby DNs.)
Return type: record
Description: queries the memory usage of all nodes.
Return type: record
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | SELECT * FROM pg_nodes_memory(); node_name | used_memory | shared_buffer_cache | top_context_memory ----------------------+-------------+------------------------------------+------------------------------ dn_6003_6004 | 353 MB | 108 MB(Utilization: 512 MB/21.00%) | PgStat BackendStatus(101 MB) | | | TopMemoryContext(59 MB) | | | gs_signal(56 MB) dn_6005_6006 | 353 MB | 202 MB(Utilization: 512 MB/39.00%) | PgStat BackendStatus(101 MB) | | | TopMemoryContext(59 MB) | | | gs_signal(56 MB) dn_6001_6002 | 351 MB | 201 MB(Utilization: 512 MB/39.00%) | PgStat BackendStatus(101 MB) | | | TopMemoryContext(58 MB) | | | gs_signal(56 MB) cn_5001 | 79 MB | 48 MB(Utilization: 256 MB/19.00%) | CacheMemoryContext(22 MB) | | | PgStat BackendStatus(19 MB) | | | gs_signal(16 MB) cn_5002 | 77 MB | 95 MB(Utilization: 256 MB/37.00%) | CacheMemoryContext(21 MB) | | | PgStat BackendStatus(19 MB) | | | gs_signal(16 MB) cn_5003 | 67 MB | 50 MB(Utilization: 256 MB/19.00%) | CacheMemoryContext(26 MB) | | | gs_signal(16 MB) | | | TopMemoryContext(9732 KB) (18 rows) |
Description: Obtains the seed value of the previous query statement (internal use).
Return type: integer
Example:
1 2 3 4 5 | SELECT plan_seed(); plan_seed ----------- 0 (1 row) |
Description: Obtains the environment variable information about the current node.
Return type: record
Example:
1 2 3 4 5 | SELECT * FROM pg_stat_get_env(); node_name | host | process | port | installpath | datapath | log_directory -----------+-----------+---------+------+------------------+------------------------+-------------------------------------- cn_5003 | localhost | 28811 | 8000 | /DWS/manager/app | /DWS/data1/coordinator | /DWS/manager/log/Ruby/pg_log/cn_5003 (1 row) |
Description: Provides information about the status of all threads under the current node.
Return type: record
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | SELECT * FROM pg_stat_get_thread(); node_name | pid | lwpid | thread_name | creation_time -----------+-----------------+---------+--------------------+------------------------------- cn_5003 | 281471515199536 | 28930 | JobScheduler | 2023-01-04 07:03:16.086885+00 cn_5003 | 281471498418224 | 28931 | StatCollector | 2000-01-01 00:00:00+00 cn_5003 | 281471464855600 | 28933 | WDRSnapshot | 2023-01-04 07:03:16.086775+00 cn_5003 | 281471380949040 | 28938 | WorkloadMonitor | 2023-01-04 07:03:16.074454+00 cn_5003 | 281471414511664 | 28936 | workload | 2023-01-04 07:03:16.075457+00 cn_5003 | 281471364167728 | 28939 | WLMArbiter | 2023-01-04 07:03:16.076753+00 cn_5003 | 281471397730352 | 28937 | CalculateSpaceInfo | 2023-01-04 07:03:16.078981+00 cn_5003 | 281470777964592 | 1933534 | wlm | 2023-01-13 08:01:32.350808+00 cn_5003 | 281470889130032 | 1786064 | cn_5002 | 2023-01-13 07:01:50.173568+00 cn_5003 | 281471299672112 | 29006 | cm_agent | 2023-01-04 07:03:18.03415+00 cn_5003 | 281471222065200 | 29970 | cn_5002 | 2023-01-04 07:03:39.694702+00 cn_5003 | 281471238846512 | 1897367 | cn_5002 | 2023-01-04 20:01:40.611019+00 cn_5003 | 281470905911344 | 30053 | cn_5002 | 2023-01-04 07:03:44.065774+00 cn_5003 | 281470410537008 | 1933902 | cn_5002 | 2023-01-13 08:01:38.972574+00 cn_5003 | 281470872348720 | 1880248 | cn_5001 | 2023-01-13 07:39:24.231418+00 cn_5003 | 281471316453424 | 1883059 | cn_5001 | 2023-01-13 07:40:16.885667+00 cn_5003 | 281470845081648 | 1305053 | cn_5001 | 2023-01-13 03:40:17.366784+00 cn_5003 | 281470700357680 | 1500466 | wlm | 2023-01-13 05:02:05.714544+00 cn_5003 | 281470473455664 | 1883060 | cn_5001 | 2023-01-13 07:40:16.885963+00 cn_5003 | 281470717138992 | 32065 | cm_agent | 2023-01-04 07:04:23.906691+00 cn_5003 | 281470807328816 | 1977925 | gsql | 2023-01-13 08:20:04.509437+00 cn_5003 | 281470683576368 | 1835242 | cn_5001 | 2023-01-13 07:20:16.549546+00 cn_5003 | 281471584946224 | 28927 | Background writer | 2023-01-04 07:03:16.065631+00 cn_5003 | 281471633184816 | 28926 | CheckPointer | 2023-01-04 07:03:16.065872+00 cn_5003 | 281471548762160 | 28928 | Wal Writer | 2023-01-04 07:03:16.066366+00 cn_5003 | 281471448074288 | 28934 | TwoPhase Cleaner | 2023-01-04 07:03:16.071172+00 cn_5003 | 281471431292976 | 28935 | LWLock Monitor | 2023-01-04 07:03:16.072897+00 cn_5003 | 281470666795056 | 1210459 | CBM Writer | 2023-01-04 15:16:05.543143+00 (28 rows) |
Description: Provides information about the status of threads under all normal nodes in a cluster.
Return type: record
Description: Provides statistics on the number of SELECT/UPDATE/INSERT/DELETE/MERGE INTO statements executed by all users on the current node, response time, and the number of DDL, DML, and DCL statements.
Return type: record
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | SELECT * FROM pg_stat_get_sql_count(); node_name | user_name | select_count | update_count | insert_count | delete_count | mergeinto_count | ddl_count | dml_count | dcl_count | total_select_elapse | avg_select_elapse | max_select_el apse | min_select_elapse | total_update_elapse | avg_update_elapse | max_update_elapse | min_update_elapse | total_insert_elapse | avg_insert_elapse | max_insert_elapse | min_insert_elapse | total_delete_ela pse | avg_delete_elapse | max_delete_elapse | min_delete_elapse -----------+------------------------+--------------+--------------+--------------+--------------+-----------------+-----------+-----------+-----------+---------------------+-------------------+-------------- -----+-------------------+---------------------+-------------------+-------------------+-------------------+---------------------+-------------------+-------------------+-------------------+----------------- ----+-------------------+-------------------+------------------- cn_5003 | gs_role_read_all_stats | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 cn_5003 | gs_role_signal_backend | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 cn_5003 | gs_role_analyze_any | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 cn_5003 | gs_role_vacuum_any | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 cn_5003 | dbadmin | 641 | 0 | 3 | 0 | 0 | 18 | 651 | 5 | 19236129 | 30009 | 814 0206 | 357 | 0 | 0 | 0 | 0 | 70595 | 23531 | 62102 | 2750 | 0 | 0 | 0 | 0 cn_5003 | Ruby | 2078187 | 3263 | 22841 | 0 | 0 | 10436 | 2242517 | 16979 | 3753441293 | 1806 | 52 6891 | 191 | 67483165 | 20681 | 38076 | 15444 | 291598980 | 12766 | 35376 | 3791 | 0 | 0 | 0 | 0 cn_5003 | joe | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 cn_5003 | sea | 192 | 0 | 5 | 3 | 0 | 3 | 205 | 0 | 2561878 | 13343 | 68 1866 | 388 | 0 | 0 | 0 | 0 | 11349 | 2269 | 3241 | 1521 | 19 255 | 6418 | 10656 | 2798 cn_5003 | jj | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 cn_5003 | u1 | 2 | 0 | 2 | 0 | 0 | 1 | 4 | 0 | 3712 | 1856 | 2407 | 1305 | 0 | 0 | 0 | 0 | 5366 | 2683 | 3359 | 2007 | 0 | 0 | 0 | 0 (10 rows) |
Description: Provides statistics on the number of SELECT/UPDATE/INSERT/DELETE/MERGE INTO statements executed by all users on all nodes of the current cluster, response time, and the number of DDL, DML, and DCL statements.
Return type: record
Description: Provides statistics on the number of SELECT/UPDATE/INSERT/DELETE statements executed in all workload Cgroup on all CNs of the current cluster and the number of DDL, DML, and DCL statements.
Return type: record
Example:
1 2 3 4 5 6 7 | SELECT * FROM pgxc_get_workload_sql_count(); node_name | workload | select_count | update_count | insert_count | delete_count | ddl_count | dml_count | dcl_count -----------+--------------+--------------+--------------+--------------+--------------+-----------+-----------+----------- cn_5003 | default_pool | 2079352 | 3264 | 22858 | 3 | 10460 | 2243738 | 16988 cn_5001 | default_pool | 2201345 | 9 | 0 | 0 | 10474 | 2359633 | 10465 cn_5002 | default_pool | 3784696 | 0 | 103106 | 136 | 10438 | 4039090 | 10498 (3 rows) |
Description: Provides statistics on response time of SELECT/UPDATE/INSERT/DELETE statements executed in all workload Cgroup on all CNs of the current cluster.
Return type: record
Example:
1 2 3 4 5 6 7 8 9 10 11 12 | SELECT * FROM pgxc_get_workload_sql_elapse_time(); node_name | workload | total_select_elapse | max_select_elapse | min_select_elapse | avg_select_elapse | total_update_elapse | max_update_elapse | min_update_elapse | avg_update_elapse | total_insert_el apse | max_insert_elapse | min_insert_elapse | avg_insert_elapse | total_delete_elapse | max_delete_elapse | min_delete_elapse | avg_delete_elapse -----------+--------------+---------------------+-------------------+-------------------+-------------------+---------------------+-------------------+-------------------+-------------------+---------------- -----+-------------------+-------------------+-------------------+---------------------+-------------------+-------------------+------------------- cn_5003 | default_pool | 3776420502 | 8140206 | 0 | 1816 | 67505332 | 38076 | 0 | 20682 | 29178 9830 | 62102 | 0 | 12765 | 19255 | 10656 | 0 | 6418 cn_5001 | default_pool | 8599339496 | 3390159 | 0 | 3906 | 52789 | 18207 | 0 | 5865 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 cn_5002 | default_pool | 40483096221 | 2178781 | 0 | 10695 | 0 | 0 | 0 | 0 | 13310238 8148 | 2398854 | 0 | 1290752 | 2072031 | 52877 | 0 | 15236 (3 rows) |
Description: Provides information about Unique SQL statistics collected on the current node. If the node is a CN, the system returns the complete information about the Unique SQL statistics collected on the CN. That is, the system collects and summarizes the information about the Unique SQL statistics on other CNs and DNs. If the node is a DN, the Unique SQL statistics on the DN is returned. For details, see the GS_INSTR_UNIQUE_SQL view.
Return type: record
Description: Clears collected Unique SQL statistics. The input parameters are described as follows:
Return type: bool
Description: Provides complete information about Unique SQL statistics collected on all CNs in a cluster. This function can be executed only on CNs.
Return type: record
Description: Provides complete information about Unique SQL statements collected on all CNs in the cluster, except the CN on which the function is being executed. This function can be executed only on CNs.
Return type: record
Description: Provides the environment variable information about all nodes in a cluster.
Return type: record
Example:
1 2 3 4 5 6 7 8 9 10 | SELECT * FROM pgxc_get_node_env(); node_name | host | process | port | installpath | datapath | log_directory --------------+---------------+---------+-------+------------------+---------------------------+-------------------------------------- dn_6001_6002 | 172.16.102.5 | 24443 | 40000 | /DWS/manager/app | /DWS/data1/h0dn1/primary0 | /DWS/manager/log/Ruby/pg_log/dn_6001 dn_6003_6004 | 172.16.70.17 | 21823 | 40000 | /DWS/manager/app | /DWS/data1/h1dn1/primary0 | /DWS/manager/log/Ruby/pg_log/dn_6003 dn_6005_6006 | 172.16.120.50 | 22331 | 40000 | /DWS/manager/app | /DWS/data1/h2dn1/primary0 | /DWS/manager/log/Ruby/pg_log/dn_6005 cn_5003 | localhost | 28811 | 8000 | /DWS/manager/app | /DWS/data1/coordinator | /DWS/manager/log/Ruby/pg_log/cn_5003 cn_5001 | 172.16.102.5 | 30873 | 8000 | /DWS/manager/app | /DWS/data1/coordinator | /DWS/manager/log/Ruby/pg_log/cn_5001 cn_5002 | 172.16.70.17 | 29229 | 8000 | /DWS/manager/app | /DWS/data1/coordinator | /DWS/manager/log/Ruby/pg_log/cn_5002 (6 rows) |
Description: Provides the current load information about computing Node Groups on cloud.
Return type: record
Description: Queries for the blocking and waiting status of the backend threads and auxiliary threads in the current instance. For details about the returned results, see the PG_THREAD_WAIT_STATUS view. The input parameters are described as follows:
Return type: record
Description: Queries for the call hierarchy between threads generated by all SQL statements on each node in a cluster, as well as the block waiting status of each thread. For details about the returned results, see the PGXC_THREAD_WAIT_STATUS view. The type and meaning of the input parameter num_node_display are the same as those of the pg_stat_get_status function.
Return type: record
Description: Obtains the running status of the operating system on each node in a cluster. For details about the returned results, see "System Catalogs > System Views >PV_OS_RUN_INFO" in the Developer Guide.
Return type: record
Description: obtains the waiting status and events of the current instance. For details about the returned results, see "System Catalogs > System Views > GS_WAIT_EVENTS" in the Developer Guide. If the GUC parameter enable_track_wait_event is off, this function returns 0.
Return type: record
Description: queries statistics about waiting status and events on each node in a cluster. For details about the returned results, see "System Catalogs > System Views > PGXC_WAIT_EVENTS" in the Developer Guide. If the GUC parameter enable_track_wait_event is off, this function returns 0.
Return type: record
Description: queries statistics about backend write processes on each node in a cluster. For details about the returned results, see "System Catalogs > System Views > PG_STAT_BGWRITER" in the Developer Guide.
Return type: record
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | SELECT * FROM pgxc_stat_bgwriter(); node_name | checkpoints_timed | checkpoints_req | checkpoint_write_time | checkpoint_sync_time | buffers_checkpoint | buffers_clean | maxwritten_clean | buffers_backend | buffers_backend_fsync | buffers_ alloc | stats_reset --------------+-------------------+-----------------+-----------------------+----------------------+--------------------+---------------+------------------+-----------------+-----------------------+--------- ------+------------------------ dn_6001_6002 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2000-01-01 00:00:00+00 dn_6003_6004 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2000-01-01 00:00:00+00 dn_6005_6006 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2000-01-01 00:00:00+00 cn_5003 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2000-01-01 00:00:00+00 cn_5001 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2000-01-01 00:00:00+00 cn_5002 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2000-01-01 00:00:00+00 (6 rows) |
Description: queries information about the log synchronization status on each node in a cluster, such as the location where the logs are sent and received. For details about the returned results, see "System Catalogs > System Views > PG_STAT_REPLICATION" in the Developer Guide.
Return type: record
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | SELECT * FROM pgxc_stat_replication(); node_name | pid | usesysid | usename | application_name | client_addr | client_hostname | client_port | backend_start | state | sender_sent_location | receiver_wri te_location | receiver_flush_location | receiver_replay_location | sync_priority | sync_state --------------+-----------------+----------+---------+------------------------+---------------+-----------------+-------------+-------------------------------+-----------+----------------------+------------- ------------+-------------------------+--------------------------+---------------+------------ dn_6001_6002 | 281469637695536 | 10 | Ruby | WalSender to Standby | 172.16.70.17 | | 26084 | 2023-01-04 07:01:27.348647+00 | Streaming | 0/4940D6B8 | 0/4940D6B8 | 0/4940D6B8 | 0/4940D6B8 | 1 | Sync dn_6001_6002 | 281469304735792 | 10 | Ruby | WalSender to Secondary | 172.16.120.50 | | 35214 | 2023-01-04 07:01:29.51929+00 | Streaming | 0/4000000 | 0/4000000 | 0/4000000 | 0/4000000 | 0 | Sync dn_6003_6004 | 281469634050096 | 10 | Ruby | WalSender to Standby | 172.16.120.50 | | 13072 | 2023-01-04 07:01:26.28706+00 | Streaming | 0/493EF000 | 0/493EF000 | 0/493EF000 | 0/493EF000 | 1 | Sync dn_6003_6004 | 281469563295792 | 10 | Ruby | WalSender to Secondary | 172.16.102.5 | | 55068 | 2023-01-04 07:01:29.310595+00 | Streaming | 0/4000000 | 0/4000000 | 0/4000000 | 0/4000000 | 0 | Sync dn_6005_6006 | 281470349690928 | 10 | Ruby | WalSender to Standby | 172.16.102.5 | | 40376 | 2023-01-04 07:01:26.768434+00 | Streaming | 0/49415A70 | 0/49415A70 | 0/49415A70 | 0/49415A70 | 1 | Sync dn_6005_6006 | 281470010435632 | 10 | Ruby | WalSender to Secondary | 172.16.70.17 | | 33750 | 2023-01-04 07:01:29.499269+00 | Streaming | 0/4000000 | 0/4000000 | 0/4000000 | 0/4000000 | 0 | Sync (6 rows) |
Description: queries the replication status on each DN in a cluster. For details about the returned results, see "System Catalogs > System Views > PG_REPLICATION_SLOTS" in the Developer Guide.
Return type: record
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 | SELECT * FROM pgxc_replication_slots(); node_name | slot_name | plugin | slot_type | datoid | database | active | x_min | catalog_xmin | restart_lsn | dummy_standby --------------+-----------------+--------+-----------+--------+----------+--------+-------+--------------+-------------------+--------------- dn_6001_6002 | dn_6001_3002 | | physical | 0 | | t | | | | t dn_6001_6002 | dn_6001_6002 | | physical | 0 | | t | | | 0/49448720 | f dn_6001_6002 | gs_roach_common | | physical | 0 | | f | | 635143447 | FFFFFFFF/FFFFFFFF | f dn_6003_6004 | dn_6003_3003 | | physical | 0 | | t | | | | t dn_6003_6004 | dn_6003_6004 | | physical | 0 | | t | | | 0/4942B760 | f dn_6003_6004 | gs_roach_common | | physical | 0 | | f | | 634883623 | FFFFFFFF/FFFFFFFF | f dn_6005_6006 | dn_6005_3004 | | physical | 0 | | t | | | | t dn_6005_6006 | dn_6005_6006 | | physical | 0 | | t | | | 0/4944CE80 | f dn_6005_6006 | gs_roach_common | | physical | 0 | | f | | 635285455 | FFFFFFFF/FFFFFFFF | f (9 rows) |
Description: queries information about runtime parameters on each node in a cluster. For details about the returned results, see "System Catalogs > System Views > PG_SETTINGS" in the Developer Guide.
Return type: record
Description: queries the running time statistics of each node in a cluster and the time consumed in each execution phase. For details about the returned results, see "System Catalogs > System Views > PV_INSTANCE_TIME" in the Developer Guide.
Return type: record
Description: queries Xlog redo statistics on the current node. For details about the returned results, see "System Catalogs > System Views > PV_REDO_STAT" in the Developer Guide.
Return type: record
Example:
1 2 3 4 5 | SELECT * FROM pg_stat_get_redo_stat(); phywrts | phyblkwrt | writetim | avgiotim | lstiotim | miniotim | maxiowtm ---------+-----------+----------+----------+----------+----------+---------- 400171 | 552783 | 11040710 | 27 | 20 | 8 | 7401 (1 row) |
Description: queries the Xlog redo statistics of each node in a cluster. For details about the returned results, see "System Catalogs > System Views > PV_REDO_STAT" in the Developer Guide.
Return type: record
Example:
SELECT * FROM pgxc_redo_stat(); node_name | phywrts | phyblkwrt | writetim | avgiotim | lstiotim | miniotim | maxiowtm --------------+---------+-----------+----------+----------+----------+----------+---------- dn_6001_6002 | 698244 | 836088 | 17608019 | 25 | 15 | 8 | 13115 dn_6003_6004 | 661128 | 799636 | 16714302 | 25 | 21 | 8 | 8195 dn_6005_6006 | 698146 | 836178 | 18117951 | 25 | 24 | 8 | 8326 cn_5003 | 400206 | 552823 | 11041701 | 27 | 18 | 8 | 7401 cn_5001 | 380931 | 514233 | 10174114 | 26 | 19 | 8 | 7726 cn_5002 | 551727 | 687991 | 11859292 | 21 | 31 | 8 | 10310 (6 rows)
Description: Obtains the disk I/O statistics of the current instance. For details about the returned results, see "System Catalogs > System Views > GS_REL_IOSTAT" in the Developer Guide.
Return type: record
Description: queries the disk I/O statistics on each node in a cluster. For details about the returned result, see "System Catalogs > System Views > GS_REL_IOSTAT" in the Developer Guide.
Return type: record
Description: Obtains the time when statistics of the current instance were reset.
Return type: timestamptz
Description: queries the time when the statistics of each node in a cluster are reset. For details about the returned result, see "System Catalogs > System Views > GS_NODE_STAT_RESET_TIME" in the Developer Guide.
Return type: record
If any of the preceding events occurs, GaussDB(DWS) will record the time when the statistics are reset. You can query the time using the get_node_stat_reset_time function.
Description: Runs a specified SQL query statement on a data instance of a specified type and returns the query result to the current CN. This function is supported in 8.1.2 or later.
The function has two parameters:
The first parameter specifies the instances on which the SQL statement is executed. Currently, the valid input parameters are dn, datanode, cn, coordinator, and all. Other values will cause function execution errors. dn and datanode indicate that the statement is executed on all DNs. cn and coordinator indicate that the statement is executed on all CNs. all indicates that the statement is executed on all CNs and DNs.
The second parameter specifies the verification of the objects queried by the SQL statement that is to be sent to a remote node for execution. User tables, distributed tables, and user-defined functions with multiple result sets are not supported.
Return type: record
SELECT * FROM pgxc_parallel_query('all', 'select node_name, db_name, thread_name, query_id, tid, lwtid, ptid, tlevel, smpid, wait_status, wait_event from pg_thread_wait_status') AS (node_name text, db_name text, thread_name text, query_id bigint, tid bigint, lwtid integer , ptid integer, tlevel integer , smpid integer, wait_status text, wait_event text);
SELECT * FROM pgxc_parallel_query('cn', 'UPDATE pg_partition SET relpages = 0') AS (updated bigint);
Description: Creates a load analysis report. The input parameters are described as follows:
Description: Queries a specified view in a specified database. The query results of some views vary depending on databases. For example, the global_table_stat view is used to query the statistics of a table. The results of querying this view vary because tables in different databases are different. The wdr_xdb_query function can access the database specified by db_name in the current connection and query the view specified by view_name in the database. The input parameters are described as follows:
The return value type is record. The first column is snapshot_id bigint, and the second column is db_name text. The names, types, and sequences of other columns are the same as those of the views specified by view_name.
Example:
1 2 | SELECT snapshot_id, db_name, schemaname, relname, distribute_mode, seq_scan ,seq_tuple_read ,index_scan ,index_tuple_read ,tuple_inserted ,tuple_updated ,tuple_deleted ,tuple_hot_updated ,live_tuples ,dead_tuples from wdr_xdb_query('postgres'::text, 1, 'global_table_stat'::text) as i(snapshot_id bigint, db_name text, schemaname name, relname name, distribute_mode char, seq_scan bigint, seq_tuple_read bigint, index_scan bigint, index_tuple_read bigint, tuple_inserted bigint, tuple_updated bigint, tuplee_deleted bigint, tuple_hot_updated bigint, live_tuples bigint, dead_tuples bigint); |
Description: Forcibly clears VACUUM rewritten files in a specified column-store table to reclaim space.
Parameter: OID of a column-store table.
Return type: integer
Description: Forcibly clears VACUUM rewritten files in all specified column-store tables to reclaim space.
Return type: record