华为云用户手册

  • pg_cancel_query(queryId int) 描述:取消一个后端的当前查询。该函数8.1.2及以上版本支持。 返回值类型:boolean 备注:pg_cancel_query向由query_id标识的后端进程发送一个查询取消(SIGINT)信号。一个活动的后端进程的query_id可以从pg_stat_activity视图的query_id字段找到。 示例: 1 2 3 4 5 6 7 8 9101112 SELECT query_id FROM pgxc_stat_activity WHERE stmt_type ='RESET'; query_id---------- 0 0(2 rows)SELECT pg_cancel_query(0); pg_cancel_query----------------- f(1 row)
  • pgxc_cancel_query(queryId int) 描述:取消当前集群下正在执行的查询。该函数8.1.2及以上版本支持。 返回值类型:boolean 备注:如果所有节点的查询均已取消,函数返回true,否则返回false。 示例: 1 2 3 4 5 6 7 8 9101112 SELECT query_id FROM pgxc_stat_activity WHERE stmt_type ='RESET'; query_id---------- 0 0(2 rows)SELECT pgxc_cancel_query(0); pgxc_cancel_query------------------- f(1 row)
  • pgxc_terminate_query(queryId int) 描述:终止当前集群下正在执行的查询。该函数8.1.2及以上版本支持。 返回值类型:boolean 示例: 1 2 3 4 5 6 7 8 91011 SELECT query_id FROM pgxc_stat_activity; query_id ----------------- 72339069014638631(1 rows)SELECT pgxc_terminate_query(72339069014638631); pgxc_terminate_query ---------------------- t(1 row)
  • checksum(expression) 描述:返回所有输入值的CHECKSUM值。使用该函数可以用来验证 GaussDB (DWS)数据库(不支持GaussDB(DWS)之外的其他数据库)的备份恢复或者数据迁移操作前后表中的数据是否相同。在备份恢复或者数据迁移操作前后都需要用户通过手工执行SQL命令的方式获取执行结果,通过对比获取的执行结果判断操作前后表中的数据是否相同。 对于大表,CHECKSUM函数可能会需要很长时间。 如果某两表的CHECKSUM值不同,则表明两表的内容是不同的。由于CHECKSUM函数中使用散列函数不能保证无冲突,因此两个不同内容的表可能会得到相同的CHECKSUM值,存在这种情况的可能性较小。对于列进行的CHECKSUM也存在相同的情况。 对于时间类型timestamp, timestamptz和smalldatetime,计算CHECKSUM值时请确保时区设置一致。 若计算某列的CHECKSUM值,且该列类型可以默认转为TEXT类型,则expression为列名。 若计算某列的CHECKSUM值,且该列类型不能默认转为TEXT类型,则expression为列名::TEXT。 若计算所有列的CHECKSUM值,则expression为表名::TEXT。 可以默认转换为TEXT类型的类型包括:char, name, int8, int2, int1, int4, raw, pg_node_tree, float4, float8, bpchar, varchar, nvarchar2, date, timestamp, timestamptz, numeric, smalldatetime,其他类型需要强制转换为TEXT。 返回类型:numeric 示例: 表中可以默认转为TEXT类型的某列的CHECKSUM值: 12345 SELECT CHECKSUM(inv_quantity_on_hand) FROM tpcds.inventory; checksum ------------------- 24417258945265247(1 row) 表中不能默认转为TEXT类型的某列的CHECKSUM值(注意此时CHECKSUM参数是列名::TEXT): 12345 SELECT CHECKSUM(inv_quantity_on_hand::TEXT) FROM tpcds.inventory; checksum ------------------- 24417258945265247(1 row) 表中所有列的CHECKSUM值。注意此时CHECKSUM参数是表名::TEXT,且表名前不加Schema: 12345 SELECT CHECKSUM(inventory::TEXT) FROM tpcds.inventory; checksum ------------------- 25223696246875800(1 row)
  • group_concat(expression [ORDER BY {col_name | expr} [ASC | DESC]] [SEPARATOR str_val]) 描述:将列数据使用指定的str_val分隔符,按照ORDER BY子句指定的排序方式拼接成字符串,ORDER BY子句必须指定排序方式,不支持ORDER BY 1的写法。 expression:必选,指定列名或基于列的有效表达式,不支持DISTINCT关键字和VARIADIC参数。 str_val:可选,指定的分隔符,可以是字符串常数或基于分组列的确定性表达式。缺省时表示分隔符为逗号。 返回类型:text group_concat函数仅8.1.2及以上版本支持。 示例: 默认分隔符为逗号: 12345 SELECT group_concat(sname) FROM group_concat_test; group_concat------------------------------------------ ADAMS,FORD,JONES,KING,MILLER,SCOTT,SMITH(1 row) group_concat函数支持自定义分隔符: 12345 SELECT group_concat(sname separator ';') from group_concat_test; group_concat------------------------------------------ ADAMS;FORD;JONES;KING;MILLER;SCOTT;SMITH(1 row) group_concat函数支持ORDER BY子句,将列数据进行有序拼接: 12345 SELECT group_concat(sname order by snumber separator ';') FROM group_concat_test; group_concat------------------------------------------ MILLER;FORD;SCOTT;SMITH;KING;JONES;ADAMS(1 row)
  • bit_or(expression) 描述:所有非NULL输入值的按位或(OR),如果全部输入值皆为NULL,那么结果也为NULL。 返回类型:和参数数据类型相同 示例: 12345 SELECT BIT_OR(inv_quantity_on_hand) FROM tpcds.inventory WHERE inv_warehouse_sk = 1; bit_or -------- 1023(1 row)
  • stddev(expression) 描述:stddev_samp的别名。 当入参类型为DOUBLE PRECISION时,入参取值范围为1.34E-154~1.34E+154,若数值超过取值范围则报错:value out of range: overflow。如果实际使用中不可避免入参超出范围,则使用cast函数强转该列类型为numeric。 返回类型:对于浮点类型的输入返回double precision,其他输入返回numeric。 示例: 12345 SELECT STDDEV(inv_quantity_on_hand) FROM tpcds.inventory WHERE inv_warehouse_sk = 1; stddev ------------------ 289.224359757315(1 row)
  • stddev_samp(expression) 描述:样本标准差。 当入参类型为DOUBLE PRECISION时,入参取值范围为1.34E-154~1.34E+154,若数值超过取值范围则报错:value out of range: overflow。如果实际使用中不可避免入参超出范围,则使用cast函数强转该列类型为numeric。 返回类型:对于浮点类型的输入返回double precision,其他输入返回numeric。 示例: 12345 SELECT STDDEV_SAMP(inv_quantity_on_hand) FROM tpcds.inventory WHERE inv_warehouse_sk = 1; stddev_samp ------------------ 289.224359757315(1 row)
  • variance(expexpression,ression) 描述:var_samp的别名。 当入参类型为DOUBLE PRECISION时,入参取值范围为1.34E-154~1.34E+154,若数值超过取值范围则报错:value out of range: overflow。如果实际使用中不可避免入参超出范围,则使用cast函数强转该列类型为numeric。 返回类型:对于浮点类型的输入返回double precision类型,其他输入返回numeric类型。 示例: 12345 SELECT VARIANCE(inv_quantity_on_hand) FROM tpcds.inventory WHERE inv_warehouse_sk = 1; variance -------------------- 83650.730277028768(1 row)
  • stddev_pop(expression) 描述:总体标准差。 当入参类型为DOUBLE PRECISION时,入参取值范围为1.34E-154~1.34E+154,若数值超过取值范围则报错:value out of range: overflow。如果实际使用中不可避免入参超出范围,则使用cast函数强转该列类型为numeric。 返回类型:对于浮点类型的输入返回double precision,其他输入返回numeric。 示例: 12345 SELECT STDDEV_POP(inv_quantity_on_hand) FROM tpcds.inventory WHERE inv_warehouse_sk = 1; stddev_pop ------------------ 289.224294957556(1 row)
  • var_pop(expression) 描述:总体方差(总体标准差的平方)。 当入参类型为DOUBLE PRECISION时,入参取值范围为1.34E-154~1.34E+154,若数值超过取值范围则报错:value out of range: overflow。如果实际使用中不可避免入参超出范围,则使用cast函数强转该列类型为numeric。 返回类型:对于浮点类型的输入返回double precision类型,其他输入返回numeric类型。 示例: 12345 SELECT VAR_POP(inv_quantity_on_hand) FROM tpcds.inventory WHERE inv_warehouse_sk = 1; var_pop -------------------- 83650.692793695475(1 row)
  • var_samp(expression) 描述:样本方差(样本标准差的平方)。 当入参类型为DOUBLE PRECISION时,入参取值范围为1.34E-154~1.34E+154,若数值超过取值范围则报错:value out of range: overflow。如果实际使用中不可避免入参超出范围,则使用cast函数强转该列类型为numeric。 返回类型:对于浮点类型的输入返回double precision类型,其他输入返回numeric类型。 示例: 12345 SELECT VAR_SAMP(inv_quantity_on_hand) FROM tpcds.inventory WHERE inv_warehouse_sk = 1; var_samp -------------------- 83650.730277028768(1 row)
  • bit_and(expression) 描述:所有非NULL输入值的按位与(AND),如果全部输入值皆为NULL,那么结果也为NULL 。 返回类型:和参数数据类型相同。 示例: 12345 SELECT BIT_AND(inv_quantity_on_hand) FROM tpcds.inventory WHERE inv_warehouse_sk = 1; bit_and --------- 0(1 row)
  • listagg(expression [, delimiter]) WITHIN GROUP(ORDER BY order-list) 描述:将聚集列数据按WITHIN GROUP指定的排序方式排列,并用delimiter指定的分隔符拼接成一个字符串。 expression:必选。指定聚集列名或基于列的有效表达式,不支持DISTINCT关键字和VARIADIC参数。 delimiter:可选。指定分隔符,可以是字符串常数或基于分组列的确定性表达式,缺省时表示分隔符为空。 order-list:必选。指定分组内的排序方式。 返回类型:text listagg是兼容Oracle 11g2的列转行聚集函数,可以指定OVER子句用作窗口函数。为了避免与函数本身WITHIN GROUP子句的ORDER BY造成二义性,listagg用作窗口函数时,OVER子句不支持ORDER BY的窗口排序或窗口框架。 示例: 聚集列是文本字符集类型: 1234567 SELECT deptno, listagg(ename, ',') WITHIN GROUP(ORDER BY ename) AS employees FROM emp GROUP BY deptno; deptno | employees --------+-------------------------------------- 10 | CLARK,KING,MILLER 20 | ADAMS,FORD,JONES,SCOTT,SMITH 30 | ALLEN,BLAKE,JAMES,MARTIN,TURNER,WARD(3 rows) 聚集列是整型: 1234567 SELECT deptno, listagg(mgrno, ',') WITHIN GROUP(ORDER BY mgrno NULLS FIRST) AS mgrnos FROM emp GROUP BY deptno; deptno | mgrnos --------+------------------------------- 10 | 7782,7839 20 | 7566,7566,7788,7839,7902 30 | 7698,7698,7698,7698,7698,7839(3 rows) 聚集列是浮点类型: 123456789 SELECT job, listagg(bonus, '($); ') WITHIN GROUP(ORDER BY bonus DESC) || '($)' AS bonus FROM emp GROUP BY job; job | bonus ------------+------------------------------------------------- CLERK | 10234.21($); 2000.80($); 1100.00($); 1000.22($) PRESIDENT | 23011.88($) ANALYST | 2002.12($); 1001.01($) MANAGER | 10000.01($); 2399.50($); 999.10($) SALESMAN | 1000.01($); 899.00($); 99.99($); 9.00($)(5 rows) 聚集列是时间类型: 1234567 SELECT deptno, listagg(hiredate, ', ') WITHIN GROUP(ORDER BY hiredate DESC) AS hiredates FROM emp GROUP BY deptno; deptno | hiredates --------+------------------------------------------------------------------------------------------------------------------------------ 10 | 1982-01-23 00:00:00, 1981-11-17 00:00:00, 1981-06-09 00:00:00 20 | 2001-04-02 00:00:00, 1999-12-17 00:00:00, 1987-05-23 00:00:00, 1987-04-19 00:00:00, 1981-12-03 00:00:00 30 | 2015-02-20 00:00:00, 2010-02-22 00:00:00, 1997-09-28 00:00:00, 1981-12-03 00:00:00, 1981-09-08 00:00:00, 1981-05-01 00:00:00(3 rows) 聚集列是时间间隔类型: 1234567 SELECT deptno, listagg(vacationTime, '; ') WITHIN GROUP(ORDER BY vacationTime DESC) AS vacationTime FROM emp GROUP BY deptno; deptno | vacationtime --------+------------------------------------------------------------------------------------ 10 | 1 year 30 days; 40 days; 10 days 20 | 70 days; 36 days; 9 days; 5 days 30 | 1 year 1 mon; 2 mons 10 days; 30 days; 12 days 12:00:00; 4 days 06:00:00; 24:00:00(3 rows) 分隔符缺省时,默认为空: 1234567 SELECT deptno, listagg(job) WITHIN GROUP(ORDER BY job) AS jobs FROM emp GROUP BY deptno; deptno | jobs --------+---------------------------------------------- 10 | CLERKMANAGERPRESIDENT 20 | ANALYSTANALYSTCLERKCLERKMANAGER 30 | CLERKMANAGERSALESMANSALESMANSALESMANSALESMAN(3 rows) listagg作为窗口函数时,OVER子句不支持ORDER BY的窗口排序,listagg列为对应分组的有序聚集: 1 2 3 4 5 6 7 8 9101112131415161718 SELECT deptno, mgrno, bonus, listagg(ename,'; ') WITHIN GROUP(ORDER BY hiredate) OVER(PARTITION BY deptno) AS employees FROM emp; deptno | mgrno | bonus | employees --------+-------+----------+------------------------------------------- 10 | 7839 | 10000.01 | CLARK; KING; MILLER 10 | | 23011.88 | CLARK; KING; MILLER 10 | 7782 | 10234.21 | CLARK; KING; MILLER 20 | 7566 | 2002.12 | FORD; SCOTT; ADAMS; SMITH; JONES 20 | 7566 | 1001.01 | FORD; SCOTT; ADAMS; SMITH; JONES 20 | 7788 | 1100.00 | FORD; SCOTT; ADAMS; SMITH; JONES 20 | 7902 | 2000.80 | FORD; SCOTT; ADAMS; SMITH; JONES 20 | 7839 | 999.10 | FORD; SCOTT; ADAMS; SMITH; JONES 30 | 7839 | 2399.50 | BLAKE; TURNER; JAMES; MARTIN; WARD; ALLEN 30 | 7698 | 9.00 | BLAKE; TURNER; JAMES; MARTIN; WARD; ALLEN 30 | 7698 | 1000.22 | BLAKE; TURNER; JAMES; MARTIN; WARD; ALLEN 30 | 7698 | 99.99 | BLAKE; TURNER; JAMES; MARTIN; WARD; ALLEN 30 | 7698 | 1000.01 | BLAKE; TURNER; JAMES; MARTIN; WARD; ALLEN 30 | 7698 | 899.00 | BLAKE; TURNER; JAMES; MARTIN; WARD; ALLEN(14 rows)
  • avg(expression) 描述:所有输入值的均值(算术平均)。 当入参类型为DOUBLE PRECISION时,入参取值范围为1.34E-154~1.34E+154,若数值超过取值范围则报错:value out of range: overflow。如果实际使用中不可避免入参超出范围,则使用cast函数强转该列类型为numeric。 返回类型: 对于任何整数类型输入,结果都是NUMBER类型。 对于任何浮点输入,结果都是DOUBLE PRECISION类型。 其他,和输入数据类型相同。 示例: 12345 SELECT AVG(inv_quantity_on_hand) FROM tpcds.inventory; avg ---------------------- 500.0387129084044604(1 row)
  • median(expression) 描述:所有输入值的中位数值。当前只支持数值类型和interval类型。其中空值不参与计算。 返回类型: 对于任何整型数据输入,结果都是NUMERIC类型。否则与输入数据类型相同。 Teradata兼容模式下,如果输入为整型,则返回的数据精度只有整数位。 示例: 12345 SELECT MEDIAN(inv_quantity_on_hand) FROM tpcds.inventory; median -------- 500(1 row)
  • sum(expression) 描述:所有输入行的expression总和。 返回类型: 通常情况下输入数据类型和输出数据类型是相同的,但以下情况会发生类型转换: 对于SMALLINT或INT输入,输出类型为BIGINT。 对于BIGINT输入,输出类型为NUMBER 。 对于浮点数输入,输出类型为DOUBLE PRECISION。 示例: 12345 SELECT SUM(ss_ext_tax) FROM tpcds.STORE_SALES; sum -------------- 213267594.69(1 row)
  • percentile_cont(const) within group(order by expression) 描述:返回一个对应于目标列排序中指定分位数的值,如有必要就在相邻的输入项之间插入值。其中空值不参与计算。 输入:const为在0-1之间的数值,expression当前只支持数值类型和interval类型。 返回类型: 对于任何整型数据输入,结果都是NUMERIC类型。否则与输入数据类型相同。 Teradata兼容模式下,如果输入为整型,则返回的数据精度只有整数位。 示例: 1 2 3 4 5 6 7 8 910 SELECT percentile_cont(0.3) within group(order by x) FROM (SELECT generate_series(1,5) AS x) AS t;percentile_cont-----------------2.2(1 row)SELECT percentile_cont(0.3) within group(order by x desc) FROM (SELECT generate_series(1,5) AS x) AS t;percentile_cont-----------------3.8(1 row)
  • array_agg(expression) 描述:将所有输入值(包括空)连接成一个数组。函数入参不支持数组形式。 返回类型:参数类型的数组。 示例: 创建表employeeinfo,并插入数据: 1 2 3 4 5 6 7 8 9101112 CREATE TABLE employeeinfo (empno smallint, ename varchar(20), job varchar(20), hiredate date,deptno smallint);INSERT INTO employeeinfo VALUES (7155, 'JACK', 'SALESMAN', '2018-12-01', 30);INSERT INTO employeeinfo VALUES (7003, 'TOM', 'FINANCE', '2016-06-15', 20);INSERT INTO employeeinfo VALUES (7357, 'MAX', 'SALESMAN', '2020-10-01', 30);SELECT * FROM employeeinfo; empno | ename | job | hiredate | deptno-------+-------+----------+---------------------+-------- 7155 | JACK | SALESMAN | 2018-12-01 00:00:00 | 30 7357 | MAX | SALESMAN | 2020-10-01 00:00:00 | 30 7003 | TOM | FINANCE | 2016-06-15 00:00:00 | 20(3 rows) 查询部门编号为30的所有员工姓名: 12345 SELECT array_agg(ename) FROM employeeinfo where deptno = 30; array_agg------------ {JACK,MAX}(1 row) 查询属于同一个部门的所有员工: 1 2 3 4 5 6 7 8 910111213 SELECT deptno, array_agg(ename) FROM employeeinfo group by deptno; deptno | array_agg--------+------------ 30 | {JACK,MAX} 20 | {TOM}(2 rows)SELECT distinct array_agg(ename) OVER (PARTITION BY deptno) FROM employeeinfo; array_agg------------ {TOM} {JACK,MAX}(2 rows) 查询所有的部门编号且去重: 123456 SELECT array_agg(distinct deptno) FROM employeeinfo group by deptno; array_agg----------- {20} {30}(2 rows) 查询所有的部门编号去重后按降序排列: 12345 SELECT array_agg(distinct deptno order by deptno desc) FROM employeeinfo; array_agg----------- {30,20}(1 row)
  • percentile_disc(const) within group(order by expression) 描述:返回第一个在排序中位置等于或者超过指定分数的输入值。 输入:const为在0-1之间的数值,expression当前只支持数值类型和interval类型。其中空值不参与计算。 返回类型:对于任何整型数据输入,结果都是NUMERIC类型。否则,与输入数据类型相同。 示例: 1 2 3 4 5 6 7 8 910 SELECT percentile_disc(0.3) within group(order by x) FROM (SELECT generate_series(1,5) AS x) AS t;percentile_disc-----------------2(1 row)SELECT percentile_disc(0.3) within group(order by x desc) FROM (SELECT generate_series(1,5) AS x) AS t;percentile_disc-----------------4(1 row)
  • pg_stat_get_wlm_node_resource_info(int4) 描述:显示所有DN资源的汇总信息。 返回值类型:record 函数返回字段如下: 名称 类型 描述 min_mem_util integer DN最小内存使用率。 max_mem_util integer DN最大内存使用率。 min_cpu_util integer DN最小CPU使用率。 max_cpu_util integer DN最大CPU使用率。 min_io_util integer DN最小IO使用率。 max_io_util integer DN最大IO使用率。 phy_usemem_rate integer 物理节点最大内存使用率。
  • gs_wlm_node_recover(boolean isForce) 描述:动态资源管理模式下,对CCN管控计数和作业信息进行更新恢复。该函数仅支持管理员执行,通常用于CN实例故障重启后的实例恢复,由集群管理组件(CM)调用,不建议用户直接调用。具体功能如下: CN执行:通知CCN清理该CN执行的作业信息和作业对应的管控计数信息。 CCN执行:重置管控计数信息,并从CN上获取最新的慢车道作业信息。 返回值类型:bool
  • gs_wlm_get_queryband_action(cstring) 描述:查询query_band关联行为和次序。 返回值类型:record 函数返回字段如下: 名称 类型 描述 qband cstring query_band键值对 respool_id Oid query band关联资源池OID respool text query band关联资源池名 priority text query band关联队列内优先级 qborder int4 query_band搜索次序 示例: 12345 SELECT * FROM gs_wlm_get_queryband_action('a=1');qband | respool_id | respool | priority | qborder-------+------------+---------+----------+--------- a=1 | 16388 | p1 | Medium | -1(1 row)
  • pgxc_cgroup_reload_conf(text) 描述:在某个节点上进行cgroup配置文件在线加载。入参为节点的IP地址。 返回值类型:record 函数返回字段如下: 名称 类型 描述 node_name text 实例名称 node_host text 实例所在节点的IP地址 result text cgroup在线加载是否成功 示例: 123456789 SELECT * FROM pgxc_cgroup_reload_conf('192.168.178.35'); node_name | node_host | result--------------+----------------+--------- cn_5001 | 192.168.178.35 | success dn_6007_6008 | 192.168.178.35 | success dn_6003_6004 | 192.168.178.35 | success dn_6001_6002 | 192.168.178.35 | success dn_6005_6006 | 192.168.178.35 | success(5 rows)
  • pgxc_cgroup_reload_conf() 描述:在系统所有实例上进行cgroup配置文件在线加载。 返回值类型:record 函数返回字段如下: 名称 类型 描述 node_name text 实例名称 node_host text 实例所在节点的IP地址 result text cgroup在线加载是否成功 示例: 1 2 3 4 5 6 7 8 910111213141516171819202122232425262728293031323334353637383940414243444546 SELECT * FROM pgxc_cgroup_reload_conf(); node_name | node_host | result--------------+-----------------+--------- dn_6025_6026 | 192.168.178.177 | success dn_6049_6050 | 192.168.179.79 | success dn_6051_6052 | 192.168.179.79 | success dn_6055_6056 | 192.168.179.79 | success dn_6067_6068 | 192.168.181.57 | success dn_6023_6024 | 192.168.178.39 | success dn_6009_6010 | 192.168.181.21 | success dn_6011_6012 | 192.168.181.21 | success dn_6015_6016 | 192.168.181.21 | success dn_6029_6030 | 192.168.178.177 | success dn_6031_6032 | 192.168.178.177 | success dn_6045_6046 | 192.168.179.45 | success cn_5001 | 192.168.178.35 | success cn_5003 | 192.168.178.39 | success dn_6061_6062 | 192.168.181.179 | success cn_5006 | 192.168.179.45 | success cn_5004 | 192.168.178.177 | success cn_5002 | 192.168.181.21 | success cn_5005 | 192.168.178.187 | success dn_6019_6020 | 192.168.178.39 | success dn_6007_6008 | 192.168.178.35 | success dn_6071_6072 | 192.168.181.57 | success dn_6003_6004 | 192.168.178.35 | success dn_6013_6014 | 192.168.181.21 | success dn_6035_6036 | 192.168.178.187 | success dn_6037_6038 | 192.168.178.187 | success dn_6001_6002 | 192.168.178.35 | success dn_6063_6064 | 192.168.181.179 | success dn_6005_6006 | 192.168.178.35 | success dn_6057_6058 | 192.168.181.179 | success dn_6069_6070 | 192.168.181.57 | success dn_6027_6028 | 192.168.178.177 | success dn_6059_6060 | 192.168.181.179 | success dn_6041_6042 | 192.168.179.45 | success dn_6043_6044 | 192.168.179.45 | success dn_6047_6048 | 192.168.179.45 | success dn_6033_6034 | 192.168.178.187 | success dn_6065_6066 | 192.168.181.57 | success dn_6021_6022 | 192.168.178.39 | success dn_6017_6018 | 192.168.178.39 | success dn_6039_6040 | 192.168.178.187 | success dn_6053_6054 | 192.168.179.79 | success(42 rows)
  • gs_cgroup_reload_conf() 描述:在当前实例上进行cgroup配置文件在线加载。 返回值类型:record 函数返回字段如下: 名称 类型 描述 node_name text 实例名称 node_host text 实例所在节点的IP地址 result text cgroup在线加载是否成功 示例: 1234 SELECT * FROM gs_cgroup_reload_conf(); node_name | node_host | result-----------+----------------+--------- cn_5001 | 192.168.178.35 | success
  • gs_wlm_set_queryband_action(cstring,cstring,int4) 描述:设置query_band关联行为和次序。 返回值类型:boolean 函数入参字段如下: 名称 类型 描述 qband cstring query_band键值对,长度上限为63个字符。 action cstring query_band关联行为。 order int4 query_band搜索次序,缺省参数,默认为-1。 示例: 1 2 3 4 5 6 7 8 910 SELECT * FROM gs_wlm_set_queryband_action('a=1','respool=p1'); gs_wlm_set_queryband_action----------------------------- t(1 row)SELECT * FROM gs_wlm_set_queryband_action('a=3','respool=p1;priority=rush',1); gs_wlm_set_queryband_action----------------------------- t(1 row)
  • gs_wlm_set_queryband_order(cstring,int4) 描述:设置query_band次序。 返回值类型:boolean 函数入参字段如下: 名称 类型 描述 qband cstring query_band键值对 order int4 query_band搜索次序,缺省参数,默认为-1 示例: 12345 SELECT * FROM gs_wlm_set_queryband_order('a=1',2); gs_wlm_set_queryband_action----------------------------- t(1 row)
  • pgxc_wlm_analyze_schema_space(cstring) 描述:在CN上查询某个逻辑集群下集群整体的Schema空间信息,入参为逻辑集群名称。 返回值类型:record 函数返回字段如下: 名称 类型 描述 schemaname text 模式名 databasename text 数据库名 nodegroup text 节点组名称 total_value bigint 该模式的集群空间总值 avg_value bigint 该模式的各实例空间平均值 skew_percent integer 倾斜率 extend_info text 提供信息包括:单实例空间最大值、单实例空间最小值以及最大最小空间所在的实例名 示例: 1 2 3 4 5 6 7 8 91011121314151617181920212223242526272829303132333435 SELECT * FROM pgxc_wlm_analyze_schema_space('group1'); schemaname | databasename | nodegroup | total_value | avg_value | skew_percent | extend_info--------------------+--------------+--------------+-------------+-----------+--------------+----------------------------------------------- pg_catalog | test1 | installation | 56819712 | 9469952 | 0 | min:9469952 datanode1,max:9469952 datanode1 public | postgres | installation | 150495232 | 25082538 | 0 | min:24903680 datanode6,max:25280512 datanode1 pg_toast | test1 | installation | 11157504 | 1859584 | 0 | min:1859584 datanode1,max:1859584 datanode1 cstore | test1 | installation | 0 | 0 | 0 | min:0 datanode1,max:0 datanode1 data_redis | postgres | installation | 1966080 | 327680 | 50 | min:0 datanode4,max:655360 datanode1 data_redis | test1 | installation | 0 | 0 | 0 | min:0 datanode1,max:0 datanode1 public | test1 | installation | 98304 | 16384 | 0 | min:16384 datanode1,max:16384 datanode1 dbms_om | postgres | installation | 0 | 0 | 0 | min:0 datanode1,max:0 datanode1 dbms_job | postgres | installation | 0 | 0 | 0 | min:0 datanode1,max:0 datanode1 dbms_om | test1 | installation | 0 | 0 | 0 | min:0 datanode1,max:0 datanode1 dbms_job | test1 | installation | 0 | 0 | 0 | min:0 datanode1,max:0 datanode1 sys | postgres | installation | 0 | 0 | 0 | min:0 datanode1,max:0 datanode1 sys | test1 | installation | 0 | 0 | 0 | min:0 datanode1,max:0 datanode1 utl_file | postgres | installation | 0 | 0 | 0 | min:0 datanode1,max:0 datanode1 utl_raw | postgres | installation | 0 | 0 | 0 | min:0 datanode1,max:0 datanode1 dbms_sql | postgres | installation | 0 | 0 | 0 | min:0 datanode1,max:0 datanode1 dbms_output | postgres | installation | 0 | 0 | 0 | min:0 datanode1,max:0 datanode1 dbms_random | postgres | installation | 0 | 0 | 0 | min:0 datanode1,max:0 datanode1 dbms_lob | postgres | installation | 0 | 0 | 0 | min:0 datanode1,max:0 datanode1 information_schema | postgres | installation | 1769472 | 294912 | 0 | min:294912 datanode1,max:294912 datanode1 information_schema | test1 | installation | 1769472 | 294912 | 0 | min:294912 datanode1,max:294912 datanode1 utl_file | test1 | installation | 0 | 0 | 0 | min:0 datanode1,max:0 datanode1 dbms_output | test1 | installation | 0 | 0 | 0 | min:0 datanode1,max:0 datanode1 dbms_random | test1 | installation | 0 | 0 | 0 | min:0 datanode1,max:0 datanode1 utl_raw | test1 | installation | 0 | 0 | 0 | min:0 datanode1,max:0 datanode1 dbms_sql | test1 | installation | 0 | 0 | 0 | min:0 datanode1,max:0 datanode1 dbms_lob | test1 | installation | 0 | 0 | 0 | min:0 datanode1,max:0 datanode1 pg_catalog | postgres | installation | 75431936 | 12571989 | 3 | min:12124160 datanode4,max:13049856 datanode1 redisuser | postgres | installation | 1884160 | 314026 | 50 | min:16384 datanode4,max:630784 datanode1 pg_toast | postgres | installation | 17154048 | 2859008 | 7 | min:2637824 datanode4,max:3080192 datanode1 cstore | postgres | installation | 15294464 | 2549077 | 5 | min:2408448 datanode1,max:2703360 datanode6(31 rows)
  • pgxc_wlm_get_schema_space(cstring) 描述:在CN上查询某个逻辑集群下各实例的Schema空间信息,入参为逻辑集群名称。 返回值类型:record 函数返回字段如下: 名称 类型 描述 schemaname text 模式名 schemaid oid 模式OID databasename text 数据库名 databaseid oid 数据库OID nodename text 实例名称 nodegroup text 节点组名称 usedspace bigint 已使用的空间大小 permspace bigint 空间上限值 示例: 1 2 3 4 5 6 7 8 9101112131415161718192021222324252627282930313233343536373839404142434445 SELECT * FROM pgxc_wlm_get_schema_space('group1'); schemaname | schemaid | databasename | databaseid | nodename | nodegroup | usedspace | permspace--------------------+----------+--------------+------------+--------------+--------------+-----------+----------- pg_catalog | 11 | test1 | 16384 | datanode1 | installation | 9469952 | -1 public | 2200 | postgres | 15253 | datanode1 | installation | 25280512 | -1 pg_toast | 99 | test1 | 16384 | datanode1 | installation | 1859584 | -1 cstore | 100 | test1 | 16384 | datanode1 | installation | 0 | -1 data_redis | 18106 | postgres | 15253 | datanode1 | installation | 655360 | -1 data_redis | 18116 | test1 | 16384 | datanode1 | installation | 0 | -1 public | 2200 | test1 | 16384 | datanode1 | installation | 16384 | -1 dbms_om | 3987 | postgres | 15253 | datanode1 | installation | 0 | -1 dbms_job | 3988 | postgres | 15253 | datanode1 | installation | 0 | -1 dbms_om | 3987 | test1 | 16384 | datanode1 | installation | 0 | -1 dbms_job | 3988 | test1 | 16384 | datanode1 | installation | 0 | -1 sys | 11693 | postgres | 15253 | datanode1 | installation | 0 | -1 sys | 11693 | test1 | 16384 | datanode1 | installation | 0 | -1 utl_file | 14644 | postgres | 15253 | datanode1 | installation | 0 | -1 utl_raw | 14669 | postgres | 15253 | datanode1 | installation | 0 | -1 dbms_sql | 14674 | postgres | 15253 | datanode1 | installation | 0 | -1 dbms_output | 14662 | postgres | 15253 | datanode1 | installation | 0 | -1 dbms_random | 14666 | postgres | 15253 | datanode1 | installation | 0 | -1 dbms_lob | 14701 | postgres | 15253 | datanode1 | installation | 0 | -1 information_schema | 14300 | postgres | 15253 | datanode1 | installation | 294912 | -1 information_schema | 14300 | test1 | 16384 | datanode1 | installation | 294912 | -1 utl_file | 14644 | test1 | 16384 | datanode1 | installation | 0 | -1 dbms_output | 14662 | test1 | 16384 | datanode1 | installation | 0 | -1 dbms_random | 14666 | test1 | 16384 | datanode1 | installation | 0 | -1 utl_raw | 14669 | test1 | 16384 | datanode1 | installation | 0 | -1 dbms_sql | 14674 | test1 | 16384 | datanode1 | installation | 0 | -1 dbms_lob | 14701 | test1 | 16384 | datanode1 | installation | 0 | -1 pg_catalog | 11 | postgres | 15253 | datanode1 | installation | 13049856 | -1 redisuser | 16387 | postgres | 15253 | datanode1 | installation | 630784 | -1 pg_toast | 99 | postgres | 15253 | datanode1 | installation | 3080192 | -1 cstore | 100 | postgres | 15253 | datanode1 | installation | 2408448 | -1 pg_catalog | 11 | test1 | 16384 | datanode2 | installation | 9469952 | -1 public | 2200 | postgres | 15253 | datanode2 | installation | 25214976 | -1 pg_toast | 99 | test1 | 16384 | datanode2 | installation | 1859584 | -1 cstore | 100 | test1 | 16384 | datanode2 | installation | 0 | -1 data_redis | 18106 | postgres | 15253 | datanode2 | installation | 655360 | -1 data_redis | 18116 | test1 | 16384 | datanode2 | installation | 0 | -1 public | 2200 | test1 | 16384 | datanode2 | installation | 16384 | -1 dbms_om | 3987 | postgres | 15253 | datanode2 | installation | 0 | -1 dbms_job | 3988 | postgres | 15253 | datanode2 | installation | 0 | -1 dbms_om | 3987 | test1 | 16384 | datanode2 | installation | 0 | -1 dbms_job | 3988 | test1 | 16384 | datanode2 | installation | 0 | -1
共100000条
提示

您即将访问非华为云网站,请注意账号财产安全