华为云用户手册

  • pg_rm_residualfiles(filepath) 描述:用于删除当前实例中指定残留文件列表中的文件。该函数为实例级函数,与当前所在的数据库无关,可以在任意实例上运行。 参数类型:text 返回值类型:record 函数返回字段如下: 表1 pg_rm_residualfiles(filepath)返回字段 名称 类型 描述 result bool 是否已经完成删除。 示例: 12345 SELECT * FROM pg_rm_residualfiles('pgrf_20200908160211441599'); result -------- t(1 row) 残留文件只有在调用pg_verify_residualfiles()进行verify后才能被真正删除。 删除动作不区分数据库,指定文件中所有已经verify的文件都会被删除。 如果指定文件中记录的所有文件都已经被删除,指定文件会被移除并备份到$PGDATA/pg_residualfile/backup目录下。
  • pg_rm_residualfiles() 描述:用于删除当前实例中所有的残留文件列表中的文件。该函数为实例级函数,与当前所在的数据库无关,可以在任意实例上运行。 参数类型:无 返回值类型:record 函数返回字段如下: 表2 pg_rm_residualfiles()返回字段 名称 类型 描述 result bool 是否已经完成删除。 filepath text 残留文件记录路径。 notes text 注释。 示例: 12345 SELECT * FROM pg_rm_residualfiles(); result | filepath | notes --------+---------------------------+------- t | pgrf_20200908160211441546 | (1 row) 残留文件只有在调用pg_verify_residualfiles()进行验证后才能被真正删除。 删除动作不区分数据库,指定文件中所有已经验证的文件都会被删除。 如果指定文件中记录的所有文件都已经被删除,指定文件会被移除并备份到$PGDATA/pg_residualfile/backup目录下。
  • version() 描述:版本信息。version返回一个描述服务器版本信息的字符串。 返回值类型:text 示例: 12345 SELECT version(); version --------------------------------------------------------------------------------------------------------------------------------------- PostgreSQL 9.2.4 gsql (( GaussDB 8.1.3 build 39137c2d) compiled at 2022-04-01 15:43:11 commit 3629 last mr 5138 release) on x86_64-unknown-linux-gnu, compiled by g++ (GCC) 5.4.0, 64-bit(1 row)
  • current_schema[()] 描述:当前模式的名字。current_schema返回在搜索路径中第一个顺位有效的模式名。(如果搜索路径为空则返回NULL,没有有效的模式名也返回NULL)。如果创建表或者其他命名对象时没有声明目标模式,则将使用这些对象的模式。 返回值类型:name 示例: 12345 SELECT current_schema(); current_schema---------------- public(1 row)
  • current_schemas(boolean) 描述:current_schemas(boolean)返回搜索路径中所有模式名字的数组。布尔选项决定像pg_catalog这样隐含包含的系统模式是否包含在返回的搜索路径中。 返回值类型:name[] 示例: 12345 SELECT current_schemas(true); current_schemas--------------------- {pg_catalog,public}(1 row) 搜索路径可以通过运行时设置更改。命令是: 1 SET search_path TO schema [, schema, ...]
  • pg_conf_load_time() 描述:配置加载时间。pg_conf_load_time返回最后加载服务器配置文件的时间戳。 返回值类型:timestamp with time zone 示例: 12345 SELECT pg_conf_load_time(); pg_conf_load_time ------------------------------ 2017-09-01 16:05:23.89868+08(1 row)
  • pg_postmaster_start_time() 描述:数据库实例启动时间。pg_postmaster_start_time返回数据库实例启动时的timestamp with time zone。 返回值类型:timestamp with time zone 示例: 12345 SELECT pg_postmaster_start_time(); pg_postmaster_start_time ------------------------------ 2017-08-30 16:02:54.99854+08(1 row)
  • pg_my_temp_schema() 描述:pg_my_temp_schema返回当前会话中临时模式的OID,如果不存在(没有创建临时表)的话则返回0。如果给定的OID是其它会话中临时模式的OID,pg_is_other_temp_schema则返回true。 返回值类型:oid 示例: 12345 SELECT pg_my_temp_schema(); pg_my_temp_schema ------------------- 0(1 row)
  • current_user 描述:当前执行环境下的用户名。current_user是用于表示权限检查的用户标识。通常用来表示会话用户,但是可以通过SET ROLE改变。在函数执行的过程中随着属性SECURITY DEFINER的改变,其值也会改变。 返回值类型:name 示例: 12345 SELECT current_user; current_user-------------- dbadmin(1 row)
  • pgxc_version() 描述:Postgres-XC版本信息。 返回值类型:text 示例: 12345 SELECT pgxc_version(); pgxc_version ------------------------------------------------------------------------------------------------------------- Postgres-XC 1.1 on x86_64-unknown-linux-gnu, based on PostgreSQL 9.2.4, compiled by g++ (GCC) 5.4.0, 64-bit(1 row)
  • && 描述:两个roaringbitmap如果有交集返回true,否则返回false。 返回值类型:bool 示例: 1 2 3 4 5 6 7 8 910 SELECT rb_build('{2,3,4}') && rb_build('{2,3}');?column?----------t(1 row)SELECT rb_build('{2,3,4}') && rb_build('{7,8,9}');?column?----------f(1 row)
  • = 描述:比较两个roaringbitmap是否相等。 返回值类型:bool 示例: 1 2 3 4 5 6 7 8 910 SELECT rb_build('{1,2,3}') = rb_build('{1,2,3}');?column?----------t(1 row)SELECT rb_build('{2,3}') = rb_build('{1,2,3}');?column?----------f(1 row)
  • ts_token_type(parser_name text, OUT tokid integer, OUT alias text, OUT description text) 描述:获取分析器定义的记号类型。 返回类型:setof record 示例: 1 2 3 4 5 6 7 8 9101112131415161718192021222324252627 SELECT ts_token_type('default'); ts_token_type -------------------------------------------------------------- (1,asciiword,"Word, all ASCII") (2,word,"Word, all letters") (3,numword,"Word, letters and digits") (4,email,"Email address") (5,url,URL) (6,host,Host) (7,sfloat,"Scientific notation") (8,version,"Version number") (9,hword_numpart,"Hyphenated word part, letters and digits") (10,hword_part,"Hyphenated word part, all letters") (11,hword_asciipart,"Hyphenated word part, all ASCII") (12,blank,"Space symbols") (13,tag,"XML tag") (14,protocol,"Protocol head") (15,numhword,"Hyphenated word, letters and digits") (16,asciihword,"Hyphenated word, all ASCII") (17,hword,"Hyphenated word, all letters") (18,url_path,"URL path") (19,file,"File or path name") (20,float,"Decimal notation") (21,int,"Signed integer") (22,uint,"Unsigned integer") (23,entity,"XML entity")(23 rows)
  • ts_stat(sqlquery text, [ weights text, ] OUT word text, OUT ndoc integer, OUT nentry integer) 描述:获取tsvector列的统计数据。 返回类型:setof record 示例: 123456 SELECT ts_stat('select ''hello world''::tsvector'); ts_stat ------------- (world,1,1) (hello,1,1)(2 rows)
  • ts_token_type(parser_oid oid, OUT tokid integer, OUT alias text, OUT description text) 描述:获取分析器定义的记号类型。 返回类型:setof record 示例: 1 2 3 4 5 6 7 8 9101112131415161718192021222324252627 SELECT ts_token_type(3722); ts_token_type -------------------------------------------------------------- (1,asciiword,"Word, all ASCII") (2,word,"Word, all letters") (3,numword,"Word, letters and digits") (4,email,"Email address") (5,url,URL) (6,host,Host) (7,sfloat,"Scientific notation") (8,version,"Version number") (9,hword_numpart,"Hyphenated word part, letters and digits") (10,hword_part,"Hyphenated word part, all letters") (11,hword_asciipart,"Hyphenated word part, all ASCII") (12,blank,"Space symbols") (13,tag,"XML tag") (14,protocol,"Protocol head") (15,numhword,"Hyphenated word, letters and digits") (16,asciihword,"Hyphenated word, all ASCII") (17,hword,"Hyphenated word, all letters") (18,url_path,"URL path") (19,file,"File or path name") (20,float,"Decimal notation") (21,int,"Signed integer") (22,uint,"Unsigned integer") (23,entity,"XML entity")(23 rows)
  • ts_parse(parser_name text, document text, OUT tokid integer, OUT token text) 描述:测试一个解析。 返回类型:setof record 示例: 12345678 SELECT ts_parse('default', 'foo - bar'); ts_parse ----------- (1,foo) (12," ") (12,"- ") (1,bar)(4 rows)
  • ts_debug([ config regconfig, ] document text, OUT alias text, OUT description text, OUT token text, OUT dictionaries regdictionary[], OUT dictionary regdictionary, OUT lexemes text[]) 描述:测试一个配置。 返回类型:setof record 示例: 123456789 SELECT ts_debug('english', 'The Brightest supernovaes'); ts_debug ----------------------------------------------------------------------------------- (asciiword,"Word, all ASCII",The,{english_stem},english_stem,{}) (blank,"Space symbols"," ",{},,) (asciiword,"Word, all ASCII",Brightest,{english_stem},english_stem,{brightest}) (blank,"Space symbols"," ",{},,) (asciiword,"Word, all ASCII",supernovaes,{english_stem},english_stem,{supernova})(5 rows)
  • ts_parse(parser_oid oid, document text, OUT tokid integer, OUT token text) 描述:测试一个解析。 返回类型:setof record 示例: 12345678 SELECT ts_parse(3722, 'foo - bar'); ts_parse ----------- (1,foo) (12," ") (12,"- ") (1,bar)(4 rows)
  • hll_hash_integer(integer, int32) 描述:对integer类型数据计算哈希值,并设置hashseed(即改变哈希策略)。 返回值类型:hll_hashval 示例: 12345 SELECT hll_hash_integer(0, 10); hll_hash_integer -------------------- 183371090322255134(1 row)
  • hll_hash_smallint(smallint, int32) 描述:设置hash seed(即改变哈希策略)同时对smallint类型数据计算哈希值。 返回值类型:hll_hashval 示例: 12345 SELECT hll_hash_smallint(100::smallint, 10); hll_hash_smallint --------------------- 8349353095166695771(1 row)
  • hll_hash_any(anytype) 描述:对任意类型数据计算哈希值。 返回值类型:hll_hashval 示例: 1 2 3 4 5 6 7 8 91011 SELECT hll_hash_any(1); hll_hash_any ---------------------- -8604791237420463362(1 row)SELECT hll_hash_any('08:00:2b:01:02:03'::macaddr); hll_hash_any ---------------------- -4883882473551067169(1 row)
  • hll_hash_bigint(bigint, int32) 描述:对bigint类型数据计算哈希值,并设置hashseed(即改变哈希策略)。 返回值类型:hll_hashval 示例: 12345 SELECT hll_hash_bigint(100::bigint, 10); hll_hash_bigint --------------------- 4631120266694327276(1 row)
  • hll_hash_bytea(bytea, int32) 描述:对bytea类型数据计算哈希值,并设置hashseed(即改变哈希策略)。 返回值类型:hll_hashval 示例: 12345 SELECT hll_hash_bytea(E'\\x', 10); hll_hash_bytea --------------------- 6574525721897061910(1 row)
  • 内置函数 HLL(HyperLogLog)有一系列内置函数用于内部对数据进行处理,一般情况下不建议用户使用。 表1 内置函数 函数名称 功能描述 hll_in 以string格式接收hll数据。 hll_out 以string格式发送hll数据。 hll_recv 以bytea格式接收hll数据。 hll_send 以bytea格式发送hll数据。 hll_trans_in 以string格式接收hll_trans_type数据。 hll_trans_out 以string格式发送hll_trans_type数据。 hll_trans_recv 以bytea形式接收hll_trans_type数据。 hll_trans_send 以bytea形式发送hll_trans_type数据。 hll_typmod_in 接收typmod类型数据。 hll_typmod_out 发送typmod类型数据。 hll_hashval_in 接收hll_hashval类型数据。 hll_hashval_out 发送hll_hashval类型数据。 hll_add_trans0 类似于hll_add所提供的功能,通常在分布式聚合运算的第一阶段DN上使用。 hll_union_trans 类似hll_union所提供的功能,在分布式聚合运算的第一阶段DN上使用。 hll_union_collect 类似于hll_union所提供的功能,在分布式聚合运算第二阶段CN上使用,汇总各个DN上的结果。 hll_pack 在分布式聚合运算第三阶段CN上使用,把自定义hll_trans_type类型最后转换成hll类型。 hll 用于hll类型转换成hll类型,根据输入参数会设定指定参数。 hll_hashval 用于bigint类型转换成hll_hashval类型。 hll_hashval_int4 用于int4类型转换成hll_hashval类型。 父主题: HLL函数和操作符
  • pgxc_get_residualfiles() 描述:pg_get_residualfiles()的CN统一查询函数。该函数为集群级函数,与当前所在的数据库无关,在CN实例上运行。 参数类型:无 返回值类型:record 函数返回字段如下: 表2 pgxc_get_residualfiles()返回字段 名称 类型 描述 nodename text 节点名称。 isverified bool 是否已经验证。 isdeleted bool 是否已经被删除。 dbname text 所属数据库名称。 residualfile text 数据文件路径。 filepath text 残留文件记录路径。 notes text 注释。 示例: 12345678 SELECT * FROM pgxc_get_residualfiles(); nodename | isverified | isdeleted | dbname | residualfile | filepath | notes --------------+------------+-----------+----------+-------------------+---------------------------+------- cn_5001 | f | f | postgres | base/15092/32803 | pgrf_20200910170129360401 | dn_6001_6002 | f | f | db2 | base/49155/114691 | pgrf_20200908160211441546 | dn_6001_6002 | f | f | db2 | base/49155/114694 | pgrf_20200908160211441546 | dn_6001_6002 | f | f | db2 | base/49155/114696 | pgrf_20200908160211441546 | (4 rows)
  • pg_get_residualfiles() 描述:用于获取当前节点的所有残留文件记录。该函数为实例级函数,与当前所在的数据库无关,可以在任意实例上运行。 参数类型:无 返回值类型:record 函数返回字段如下: 表1 pg_get_residualfiles()返回字段 名称 类型 描述 isverified bool 是否已经验证。 isdeleted bool 是否已经被删除。 dbname text 所属数据库名称。 residualfile text 数据文件路径。 filepath text 残留文件记录路径。 notes text 注释。 示例: 1234567 SELECT * FROM pg_get_residualfiles(); isverified | isdeleted | dbname | residualfile | filepath | notes ------------+-----------+--------+-------------------+---------------------------+------- f | f | db2 | base/49155/114691 | pgrf_20200908160211441546 | f | f | db2 | base/49155/114694 | pgrf_20200908160211441546 | f | f | db2 | base/49155/114696 | pgrf_20200908160211441546 | (3 rows)
  • rb_xor_cardinality_agg(roaringbitmap) 描述:将分组内的roaringbitmap按照异或的逻辑合并后的基数。 示例: 1 2 3 4 5 6 7 8 91011121314 SELECT a, rb_xor_cardinality_agg(b) FROM r1 GROUP BY a ORDER BY 1; a | rb_xor_cardinality_agg----+------------------------ 1 | 0 2 | 1 3 | 1 4 | 1 5 | 1 6 | 1 7 | 1 8 | 1 9 | 1 10 | 1(10 rows)
  • rb_and_agg(roaringbitmap) 描述:将分组内的roaringbitmap数据按照交的操作聚合成一个roaringbitmap集合。 示例: 1 2 3 4 5 6 7 8 9101112131415161718 CREATE TABLE r1(a int ,b roaringbitmap);INSERT INTO r1 SELECT a, rb_build_agg(b) FROM t1 GROUP BY a;INSERT INTO t1 SELECT generate_series(1,10),generate_series(1,20,4);INSERT INTO r1 SELECT a, rb_build_agg(b) FROM t1 GROUP BY a;SELECT a, rb_to_array(rb_and_agg(b)) FROM r1 GROUP BY a ORDER BY a; a | rb_to_array----+------------- 1 | {1} 2 | {3} 3 | {5} 4 | {7} 5 | {9} 6 | {11} 7 | {13} 8 | {15} 9 | {17}10 | {19}(10 rows)
  • rb_or_agg(roaringbitmap) 描述:将分组内的roaringbitmap按照并的逻辑组合成一个roaringbitmap。 示例: 1 2 3 4 5 6 7 8 91011121314 SELECT a, rb_to_array(rb_or_agg(b)) FROM r1 GROUP BY a ORDER BY a; a | rb_to_array----+------------- 1 | {1} 2 | {3,5} 3 | {5,9} 4 | {7,13} 5 | {9,17} 6 | {1,11} 7 | {5,13} 8 | {9,15} 9 | {13,17} 10 | {17,19}(10 rows)
  • rb_or_cardinality_agg(roaringbitmap) 描述:将分组内的roaringbitmap按照并集计算后的基数。 示例: 1 2 3 4 5 6 7 8 91011121314 SELECT a, rb_or_cardinality_agg(b) FROM r1 GROUP BY a ORDER BY 1; a | rb_or_cardinality_agg----+----------------------- 1 | 1 2 | 2 3 | 2 4 | 2 5 | 2 6 | 2 7 | 2 8 | 2 9 | 2 10 | 2(10 rows)
共100000条
提示

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