云服务器内容精选
-
date_part date_part函数是在传统的Ingres函数的基础上制作的(该函数等效于SQL标准函数extract): date_part('field', source) 这里的field参数必须是一个字符串,而不是一个名称。有效的field与extract一样,详细信息请参见EXTRACT。 示例: 1 2 3 4 5 openGauss=# SELECT date_part('day', TIMESTAMP '2001-02-16 20:38:40'); date_part ----------- 16 (1 row) 1 2 3 4 5 openGauss=# SELECT date_part('hour', INTERVAL '4 hours 3 minutes'); date_part ----------- 4 (1 row)
-
EXTRACT EXTRACT(field FROM source) extract函数从日期或时间的数值里抽取子域,比如年、小时等。source必须是一个timestamp、time或interval类型的值表达式(类型为date的表达式转换为timestamp,因此也可以用)。field是一个标识符或者字符串,它指定从源数据中抽取的域。extract函数返回类型为double precision的数值。field的取值范围如下所示。 century 世纪。 第一个世纪从0001-01-01 00:00:00 AD开始。这个定义适用于所有使用阳历的国家。没有0世纪,直接从公元前1世纪到公元1世纪。 示例: 1 2 3 4 5 openGauss=# SELECT EXTRACT(CENTURY FROM TIMESTAMP '2000-12-16 12:21:13'); date_part ----------- 20 (1 row) day 如果source为timestamp,表示月份里的日期(1-31)。 1 2 3 4 5 openGauss=# SELECT EXTRACT(DAY FROM TIMESTAMP '2001-02-16 20:38:40'); date_part ----------- 16 (1 row) 如果source为interval,表示天数。 1 2 3 4 5 openGauss=# SELECT EXTRACT(DAY FROM INTERVAL '40 days 1 minute'); date_part ----------- 40 (1 row) decade 年份除以10。 1 2 3 4 5 openGauss=# SELECT EXTRACT(DECADE FROM TIMESTAMP '2001-02-16 20:38:40'); date_part ----------- 200 (1 row) dow 每周的星期几,星期天(0)到星期六(6)。 1 2 3 4 5 openGauss=# SELECT EXTRACT(DOW FROM TIMESTAMP '2001-02-16 20:38:40'); date_part ----------- 5 (1 row) doy 一年的第几天(1~365/366)。 1 2 3 4 5 openGauss=# SELECT EXTRACT(DOY FROM TIMESTAMP '2001-02-16 20:38:40'); date_part ----------- 47 (1 row) epoch 如果source为timestamp with time zone,表示自1970-01-01 00:00:00-00 UTC以来的秒数(结果可能是负数); 如果source为date和timestamp,表示自1970-01-01 00:00:00-00当地时间以来的秒数; 如果source为interval,表示时间间隔的总秒数。 1 2 3 4 5 openGauss=# SELECT EXTRACT(EPOCH FROM TIMESTAMP WITH TIME ZONE '2001-02-16 20:38:40.12-08'); date_part -------------- 982384720.12 (1 row) 1 2 3 4 5 openGauss=# SELECT EXTRACT(EPOCH FROM INTERVAL '5 days 3 hours'); date_part ----------- 442800 (1 row) 将epoch值转换为时间戳的方法。 1 2 3 4 5 openGauss=# SELECT TIMESTAMP WITH TIME ZONE 'epoch' + 982384720.12 * INTERVAL '1 second' AS RESULT; result --------------------------- 2001-02-17 12:38:40.12+08 (1 row) hour 小时域(0-23)。 1 2 3 4 5 openGauss=# SELECT EXTRACT(HOUR FROM TIMESTAMP '2001-02-16 20:38:40'); date_part ----------- 20 (1 row) isodow 一周的第几天(1-7)。 星期一为1,星期天为7。 除了星期天外,都与dow相同。 1 2 3 4 5 openGauss=# SELECT EXTRACT(ISODOW FROM TIMESTAMP '2001-02-18 20:38:40'); date_part ----------- 7 (1 row) isoyear 日期中的ISO 8601标准年(不适用于间隔)。 每个带有星期一开始的周中包含1月4日的ISO年,所以在年初的1月或12月下旬的ISO年可能会不同于阳历的年。详细信息请参见后续的week描述。 1 2 3 4 5 openGauss=# SELECT EXTRACT(ISOYEAR FROM DATE '2006-01-01'); date_part ----------- 2005 (1 row) 1 2 3 4 5 openGauss=# SELECT EXTRACT(ISOYEAR FROM DATE '2006-01-02'); date_part ----------- 2006 (1 row) microseconds 秒域(包括小数部分)乘以1,000,000。 1 2 3 4 5 openGauss=# SELECT EXTRACT(MICROSECONDS FROM TIME '17:12:28.5'); date_part ----------- 28500000 (1 row) millennium 千年。 20世纪(19xx年)里面的年份在第二个千年里。第三个千年从2001年1月1日零时开始。 1 2 3 4 5 openGauss=# SELECT EXTRACT(MILLENNIUM FROM TIMESTAMP '2001-02-16 20:38:40'); date_part ----------- 3 (1 row) milliseconds 秒域(包括小数部分)乘以1000。请注意它包括完整的秒。 1 2 3 4 5 openGauss=# SELECT EXTRACT(MILLISECONDS FROM TIME '17:12:28.5'); date_part ----------- 28500 (1 row) minute 分钟域(0-59)。 1 2 3 4 5 openGauss=# SELECT EXTRACT(MINUTE FROM TIMESTAMP '2001-02-16 20:38:40'); date_part ----------- 38 (1 row) month 如果source为timestamp,表示一年里的月份数(1-12)。 1 2 3 4 5 openGauss=# SELECT EXTRACT(MONTH FROM TIMESTAMP '2001-02-16 20:38:40'); date_part ----------- 2 (1 row) 如果source为interval,表示月的数目,然后对12取模(0-11)。 1 2 3 4 5 openGauss=# SELECT EXTRACT(MONTH FROM INTERVAL '2 years 13 months'); date_part ----------- 1 (1 row) quarter 该天所在的该年的季度(1-4)。 1 2 3 4 5 openGauss=# SELECT EXTRACT(QUARTER FROM TIMESTAMP '2001-02-16 20:38:40'); date_part ----------- 1 (1 row) second 秒域,包括小数部分(0-59)。 1 2 3 4 5 openGauss=# SELECT EXTRACT(SECOND FROM TIME '17:12:28.5'); date_part ----------- 28.5 (1 row) timezone 与UTC的时区偏移量,单位为秒。正数对应UTC东边的时区,负数对应UTC西边的时区。 timezone_hour 时区偏移量的小时部分。 timezone_minute 时区偏移量的分钟部分。 week 该天在所在的年份里是第几周。ISO 8601定义一年的第一周包含该年的一月四日(ISO-8601 的周从星期一开始)。换句话说,一年的第一个星期四在第一周。 在ISO定义里,一月的头几天可能是前一年的第52或者第53周,十二月的后几天可能是下一年第一周。比如,2005-01-01是2004年的第53周,而2006-01-01是2005年的第52周,2012-12-31是2013年的第一周。建议isoyear字段和week一起使用以得到一致的结果。 1 2 3 4 5 openGauss=# SELECT EXTRACT(WEEK FROM TIMESTAMP '2001-02-16 20:38:40'); date_part ----------- 7 (1 row) year 年份域。 1 2 3 4 5 openGauss=# SELECT EXTRACT(YEAR FROM TIMESTAMP '2001-02-16 20:38:40'); date_part ----------- 2001 (1 row)
-
TIMESTAMPDIFF TIMESTAMPDIFF(unit , timestamp_expr1, timestamp_expr2) timestampdiff函数是计算两个日期时间之间(timestamp_expr2-timestamp_expr1)的差值,并以unit形式返回结果。timestamp_expr1,timestamp_expr2必须是一个timestamp、timestamptz、date类型的值表达式。unit表示的是两个日期差的单位。 该函数仅在 GaussDB 兼容MY类型时(即dbcompatibility = 'B')有效,其他类型不支持该函数。等效于timestamp_diff(text, timestamp, timestamp)。 year 年份。 1 2 3 4 5 openGauss=# SELECT TIMESTAMPDIFF(YEAR, '2018-01-01', '2020-01-01'); timestamp_diff ---------------- 2 (1 row)
-
时间/日期函数 age(timestamp, timestamp) 描述:将两个参数相减,并以年、月、日作为返回值。若相减值为负,则函数返回亦为负,入参可以都带timezone或都不带timezone。 返回值类型:interval 示例: 1 2 3 4 5 openGauss=# SELECT age(timestamp '2001-04-10', timestamp '1957-06-13'); age ------------------------- 43 years 9 mons 27 days (1 row) age(timestamp) 描述:当前时间和参数相减,入参可以带或者不带timezone。 返回值类型:interval 示例: 1 2 3 4 5 openGauss=# SELECT age(timestamp '1957-06-13'); age ------------------------- 60 years 2 mons 18 days (1 row) clock_timestamp() 描述:实时时钟的当前时间戳。 返回值类型:timestamp with time zone 示例: 1 2 3 4 5 openGauss=# SELECT clock_timestamp(); clock_timestamp ------------------------------- 2017-09-01 16:57:36.636205+08 (1 row) current_date 描述:当前日期。 返回值类型:date 示例: 1 2 3 4 5 openGauss=# SELECT current_date; date ------------ 2017-09-01 (1 row) current_time 描述:当前时间。 返回值类型:time with time zone 示例: 1 2 3 4 5 openGauss=# SELECT current_time; timetz -------------------- 16:58:07.086215+08 (1 row) current_timestamp 描述:当前日期及时间。 返回值类型:timestamp with time zone 示例: 1 2 3 4 5 openGauss=# SELECT current_timestamp; pg_systimestamp ------------------------------ 2017-09-01 16:58:19.22173+08 (1 row) pg_systimestamp() 描述:当前日期和时间(当前语句的开始)。 返回值类型:timestamp with time zone 示例: 1 2 3 4 5 openGauss=# SELECT pg_systimestamp(); pg_systimestamp ------------------------------- 2015-10-14 11:21:28.317367+08 (1 row) date_part(text, timestamp) 描述:获取日期/时间值中子域的值,例如年或者小时的值。等效于extract(field from timestamp)。 timestamp类型:abstime、date、interval、reltime、time with time zone、time without time zone、timestamp with time zone、timestamp without time zone。 返回值类型:double precision 示例: 1 2 3 4 5 openGauss=# SELECT date_part('hour', timestamp '2001-02-16 20:38:40'); date_part ----------- 20 (1 row) timestamp_diff(text, timestamp, timestamp) 描述:计算两个日期时间之间的差值,截取到参数text指定的精度。在兼容B数据库模式下,该函数功能与TIMESTAMPDIFF(unit , timestamp_expr1, timestamp_expr2)相同。 返回值类型:int64 示例: 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 39 40 41 42 43 44 45 openGauss=# SELECT timestamp_diff('year','2018-01-01','2020-04-01'); timestamp_diff ---------------- 2 (1 row) openGauss=# SELECT timestamp_diff('month','2018-01-01','2020-04-01'); timestamp_diff ---------------- 27 (1 row) openGauss=# SELECT timestamp_diff('quarter','2018-01-01','2020-04-01'); timestamp_diff ---------------- 9 (1 row) openGauss=# SELECT timestamp_diff('week','2018-01-01','2020-04-01'); timestamp_diff ---------------- 117 (1 row) openGauss=# SELECT timestamp_diff('day','2018-01-01','2020-04-01'); timestamp_diff ---------------- 821 (1 row) openGauss=# SELECT timestamp_diff('hour','2018-01-01 10:10:10','2018-01-01 12:12:12'); timestamp_diff ---------------- 2 (1 row) openGauss=# SELECT timestamp_diff('minute','2018-01-01 10:10:10','2018-01-01 12:12:12'); timestamp_diff ---------------- 122 (1 row) openGauss=# SELECT timestamp_diff('second','2018-01-01 10:10:10','2018-01-01 10:12:12'); timestamp_diff ---------------- 122 (1 row) openGauss=# SELECT timestamp_diff('microsecond','2018-01-01 10:10:10','2018-01-01 10:12:12'); timestamp_diff ---------------- 122000000 (1 row) date_part(text, interval) 描述:获取日期/时间值中子域的值。获取月份值时,如果月份值大于12,则取与12的模。等效于extract(field from timestamp)。 返回值类型:double precision 示例: 1 2 3 4 5 openGauss=# SELECT date_part('month', interval '2 years 3 months'); date_part ----------- 3 (1 row) date_trunc(text, timestamp) 描述:截取到参数text指定的精度。 返回值类型:interval、timestamp with time zone、timestamp without time zone 示例: 1 2 3 4 5 openGauss=# SELECT date_trunc('hour', timestamp '2001-02-16 20:38:40'); date_trunc --------------------- 2001-02-16 20:00:00 (1 row) trunc(timestamp) 描述:默认按天截取。 示例: 1 2 3 4 openGauss=# SELECT trunc(timestamp '2001-02-16 20:38:40'); trunc --------------------- 2001-02-16 00:00:00 (1 row) trunc(arg1, arg2) 描述:截取到arg2指定的精度。 arg1类型:interval、timestamp with time zone、timestamp without time zone arg2类型:text 返回值类型:interval、timestamp with time zone、timestamp without time zone 示例: 1 2 3 4 openGauss=# SELECT trunc(timestamp '2001-02-16 20:38:40', 'hour'); trunc --------------------- 2001-02-16 20:00:00 (1 row) daterange(arg1, arg2) 描述:获取时间边界信息。arg1和arg2的类型为date。 返回值类型:daterange 示例: 1 2 3 4 5 openGauss=# SELECT daterange('2000-05-06','2000-08-08'); daterange ------------------------- [2000-05-06,2000-08-08) (1 row) daterange(arg1, arg2, text) 描述:获取时间边界信息。arg1和arg2的类型为date,text类型为text。 返回值类型:daterange 示例: 1 2 3 4 5 openGauss=# SELECT daterange('2000-05-06','2000-08-08','[]'); daterange ------------------------- [2000-05-06,2000-08-09) (1 row) extract(field from timestamp) 描述:获取小时的值。 返回值类型:double precision 示例: 1 2 3 4 5 openGauss=# SELECT extract(hour from timestamp '2001-02-16 20:38:40'); date_part ----------- 20 (1 row) extract(field from interval) 描述:获取月份的值。如果大于12,则取与12的模。 返回值类型:double precision 示例: 1 2 3 4 5 openGauss=# SELECT extract(month from interval '2 years 3 months'); date_part ----------- 3 (1 row) isfinite(date) 描述:测试是否为有效日期。 返回值类型:Boolean 示例: 1 2 3 4 5 openGauss=# SELECT isfinite(date '2001-02-16'); isfinite ---------- t (1 row) isfinite(timestamp) 描述:测试判断是否为有效时间。 返回值类型:Boolean 示例: 1 2 3 4 5 openGauss=# SELECT isfinite(timestamp '2001-02-16 21:28:30'); isfinite ---------- t (1 row) isfinite(interval) 描述:测试是否为有效区间。 返回值类型:Boolean 示例: 1 2 3 4 5 openGauss=# SELECT isfinite(interval '4 hours'); isfinite ---------- t (1 row) justify_days(interval) 描述:将时间间隔以月(30天为一月)为单位。 返回值类型:interval 示例: 1 2 3 4 5 openGauss=# SELECT justify_days(interval '35 days'); justify_days -------------- 1 mon 5 days (1 row) justify_hours(interval) 描述:将时间间隔以天(24小时为一天)为单位。 返回值类型:interval 示例: 1 2 3 4 5 openGauss=# SELECT JUSTIFY_HOURS(INTERVAL '27 HOURS'); justify_hours ---------------- 1 day 03:00:00 (1 row) justify_interval(interval) 描述:结合justify_days和justify_hours,调整interval。 返回值类型:interval 示例: 1 2 3 4 5 openGauss=# SELECT JUSTIFY_INTERVAL(INTERVAL '1 MON -1 HOUR'); justify_interval ------------------ 29 days 23:00:00 (1 row) localtime 描述:当前时间。 返回值类型:time 示例: 1 2 3 4 5 openGauss=# SELECT localtime AS RESULT; result ---------------- 16:05:55.664681 (1 row) localtimestamp 描述:当前日期及时间。 返回值类型:timestamp 示例: 1 2 3 4 5 openGauss=# SELECT localtimestamp; timestamp ---------------------------- 2017-09-01 17:03:30.781902 (1 row) now() 描述:当前日期及时间。 返回值类型:timestamp with time zone 示例: 1 2 3 4 5 openGauss=# SELECT now(); now ------------------------------- 2017-09-01 17:03:42.549426+08 (1 row) timenow() 描述:当前日期及时间。 返回值类型:timestamp with time zone 示例: 1 2 3 4 5 openGauss=# select timenow(); timenow ------------------------ 2020-06-23 20:36:56+08 (1 row) numtodsinterval(num, interval_unit) 描述:将数字转换为interval类型。num为numeric类型数字,interval_unit为固定格式字符串('DAY' | 'HOUR' | 'MINUTE' | 'SECOND')。 可以通过设置GUC参数IntervalStyle为a,兼容该函数interval输出格式。 示例: 1 2 3 4 5 6 7 8 9 10 11 12 13 openGauss=# SELECT numtodsinterval(100, 'HOUR'); numtodsinterval ----------------- 100:00:00 (1 row) openGauss=# SET intervalstyle = a; SET openGauss=# SELECT numtodsinterval(100, 'HOUR'); numtodsinterval ------------------------------- +000000004 04:00:00.000000000 (1 row) pg_sleep(seconds) 描述:服务器线程延迟时间,单位为秒。 返回值类型:void 示例: 1 2 3 4 5 openGauss=# SELECT pg_sleep(10); pg_sleep ---------- (1 row) statement_timestamp() 描述:当前日期和时间(当前语句的开始)。 返回值类型:timestamp with time zone 示例: 1 2 3 4 5 openGauss=# SELECT statement_timestamp(); statement_timestamp ------------------------------- 2017-09-01 17:04:39.119267+08 (1 row) sysdate 描述:当前日期及时间。 返回值类型:timestamp 示例: 1 2 3 4 5 openGauss=# SELECT sysdate; sysdate --------------------- 2017-09-01 17:04:49 (1 row) timeofday() 描述:当前日期及时间(像clock_timestamp,但是返回时为text)。 返回值类型:text 示例: 1 2 3 4 5 openGauss=# SELECT timeofday(); timeofday ------------------------------------- Fri Sep 01 17:05:01.167506 2017 CS T (1 row) transaction_timestamp() 描述:当前日期及时间,与current_timestamp等效。 返回值类型:timestamp with time zone 示例: 1 2 3 4 5 openGauss=# SELECT transaction_timestamp(); transaction_timestamp ------------------------------- 2017-09-01 17:05:13.534454+08 (1 row) add_months(d,n) 描述:用于计算时间点d再加上n个月的时间。 d:timestamp类型的值,以及可以隐式转换为timestamp类型的值。 n:INTEGER类型的值,以及可以隐式转换为INTEGER类型的值。 返回值类型:timestamp 示例: 1 2 3 4 5 openGauss=# SELECT add_months(to_date('2017-5-29', 'yyyy-mm-dd'), 11) FROM sys_dummy; add_months --------------------- 2018-04-29 00:00:00 (1 row) last_day(d) 描述:用于计算时间点d当月最后一天的时间。 返回值类型:timestamp 示例: 1 2 3 4 5 openGauss=# SELECT last_day(to_date('2017-01-01', 'YYYY-MM-DD')) AS cal_result; cal_result --------------------- 2017-01-31 00:00:00 (1 row)
-
时间日期操作符 用户在使用时间和日期操作符时,对应的操作数请使用明确的类型前缀修饰,以确保数据库在解析操作数的时候能够与用户预期一致,不会产生用户非预期的结果。 比如下面示例没有明确数据类型就会出现异常错误。 1 2 3 4 5 6 7 openGauss=# SELECT date '2001-10-01' - '7' AS RESULT; ERROR: GAUSS-10416: invalid input syntax for type timestamp: "7" SQLSTATE: 22007 LINE 1: SELECT date '2001-10-01' - '7' AS RESULT; ^ CONTEXT: referenced column: result
-
Global SysCache特性函数 gs_gsc_table_detail(database_id default NULL, rel_id default NULL) 描述:查看数据库里全局系统缓存的表元数据。调用该函数的用户需要具有SYSADMIN权限。 参数:指定需要查看全局系统缓存的数据库和表,database_id默认值NULL或者-1表示所有的数据库,0表示共享表,其他数字表示指定数据库及共享表,rel_id表示指定表的oid,默认值NULL或者-1表示所有的表,其他值表示指定的表,database_id不存在会报错,rel_id不存在结果为空。 返回值类型:Tuple 示例: select * from gs_gsc_table_detail(-1) limit 1; database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo --------------+---------------+--------+-------------------------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+-----------+--------- 0 | | 2676 | pg_authid_rolname_index | 11 | 0 | 0 | 10 | 403 | 0 | 1664 | f | t | i | 1 | f | f | n | f | 'rolname' | (1 row) gs_gsc_catalog_detail(database_id default NULL, rel_id default NULL) 描述:查看数据库里全局系统缓存的系统表行信息。调用该函数的用户需要具有SYSADMIN权限。 参数:指定需要查看全局系统缓存的数据库和表,database_id默认值NULL或者-1表示所有的数据库,0表示共享表,其他数字表示指定数据库及共享表,rel_id表示指定表的id,仅包含所有有系统缓存的系统表,默认值NULL或者-1表示所有的表,其他值表示指定的表,database_id不存在会报错,rel_id不存在结果为空。 返回值类型:Tuple 示例: openGauss=# select * from gs_gsc_catalog_detail(16574, 1260); database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount -------------+---------------+--------+-----------+----------+--------+--------+----------+-----------+------------+---------- 0 | | 1260 | pg_authid | 10 | (0, 9) | (0, 9) | 10507 | 26 | 531311568 | 10 0 | | 1260 | pg_authid | 11 | (0, 4) | (0, 4) | 2313 | 26 | 365368336 | 1 0 | | 1260 | pg_authid | 11 | (0, 9) | (0, 9) | 10507 | 26 | 3911517328 | 10 0 | | 1260 | pg_authid | 11 | (0, 7) | (0, 7) | 2313 | 26 | 1317799983 | 1 0 | | 1260 | pg_authid | 11 | (0, 5) | (0, 5) | 2313 | 26 | 3664347448 | 1 0 | | 1260 | pg_authid | 11 | (0, 1) | (0, 1) | 2313 | 26 | 276477273 | 1 0 | | 1260 | pg_authid | 11 | (0, 3) | (0, 3) | 2313 | 26 | 2465837659 | 1 0 | | 1260 | pg_authid | 11 | (0, 8) | (0, 8) | 2313 | 26 | 3205288035 | 1 0 | | 1260 | pg_authid | 11 | (0, 6) | (0, 6) | 2313 | 26 | 131811687 | 1 0 | | 1260 | pg_authid | 11 | (0, 2) | (0, 2) | 2313 | 26 | 1226484587 | 1 (10 rows) gs_gsc_clean(database_id default NULL) 描述:清理global syscache的缓存,需要注意,正在使用中的数据不会被清理。调用该函数的用户需要具有SYSADMIN权限。 参数:指定需要清理全局系统缓存的数据库,默认值NULL或者-1表示强制清理所有的数据库全局系统缓存,0表示只淘汰共享表的全局系统缓存,其他数字表示淘汰指定数据库以及共享表的全局系统缓存,database_id不存在会报错。 返回值类型:bool 示例: openGauss=# select * from gs_gsc_clean(); gs_gsc_clean -------------- t (1 row) gs_gsc_dbstat_info(database_id default NULL) 描述:获取本地节点的GSC的内存统计信息,包括tuple、relation、partition的缓存查询,命中,加载、失效、占用空间信息,DB级别的淘汰信息,线程引用信息,内存占用信息。可以用于定位性能问题,例如当发现hits/searches数组远小于1时,可能是global_syscache_threshold设置太小,导致查询命中率下降。调用该函数的用户需要具有SYSADMIN权限。 参数:指定需要查看的数据库全局系统缓存统计信息,NULL或者-1表示查看所有的数据库,0表示只查看共享表信息,其他数字表示查看指定的数据库和共享表的信息。不合法的输入值,database_id不存在会报错。 返回值类型:Tuple 示例: openGauss=# select * from gs_gsc_dbstat_info(); database_id | database_name | tup_searches | tup_hits | tup_miss | tup_count | tup_dead | tup_memory | rel_searches | rel_hits | rel_mis s | rel_count | rel_dead | rel_memory | part_searches | part_hits | part_miss | part_count | part_dead | part_memory | total_memory | swa pout_count | refcount -------------+---------------+--------------+----------+----------+-----------+----------+------------+--------------+----------+-------- --+-----------+----------+------------+---------------+-----------+-----------+------------+-----------+-------------+--------------+---- -----------+---------- 0 | | 300 | 235 | 31 | 22 | 2 | 9752 | 598 | 108 | 1 8 | 18 | 0 | 77720 | 0 | 0 | 0 | 0 | 0 | 0 | 752912 | 0 | 0 16574 | testdb | 3368 | 2289 | 329 | 273 | 0 | 92593 | 1113 | 524 | 4 8 | 48 | 0 | 340456 | 0 | 0 | 0 | 0 | 0 | 0 | 4124792 | 0 | 10 (2 rows) 父主题: 函数和操作符
-
兼容PostgreSQL的函数和操作符 下述列表为GaussDB的内建函数和操作符兼容PostgreSQL。 _pg_char_max_length _pg_char_octet_length _pg_datetime_precision _pg_expandarray _pg_index_position _pg_interval_type _pg_numeric_precision _pg_numeric_precision_radix _pg_numeric_scale _pg_truetypid _pg_truetypmod abbrev abs abstime abstimeeq abstimege abstimegt abstimein abstimele abstimelt abstimene abstimeout abstimerecv abstimesend aclcontains acldefault aclexplode aclinsert aclitemeq aclitemin aclitemout aclremove acos age akeys any_in any_out anyarray_in anyarray_out anyarray_recv anyarray_send anyelement_in anyelement_out anyenum_in anyenum_out anynonarray_in anynonarray_out anyrange_in anyrange_out anytextcat area areajoinsel areasel array_agg array_agg_finalfn array_agg_transfn array_append array_cat array_dims array_eq array_fill array_ge array_gt array_in array_larger array_le array_length array_lower array_lt array_ndims array_ne array_out array_prepend array_recv array_send array_smaller array_to_json array_to_string array_typanalyze array_upper arraycontained arraycontains arraycontjoinsel arraycontsel arrayoverlap ascii asin atan atan2 avals avg big5_to_euc_tw big5_to_mic big5_to_utf8 bit bit_and bit_in bit_length bit_or bit_out bit_recv bit_send bitand bitcat bitcmp biteq bitge bitgt bitle bitlt bitne bitnot bitor bitshiftleft bitshiftright bittypmodin bittypmodout bitxor bool bool_and bool_or booland_statefunc booleq boolge boolgt boolin boolle boollt boolne boolor_statefunc boolout boolrecv boolsend box box_above box_above_eq box_add box_below box_below_eq box_center box_contain box_contain_pt box_contained box_distance box_div box_eq box_ge box_gt box_in box_intersect box_le box_left box_lt box_mul box_out box_overabove box_overbelow box_overlap box_overleft box_overright box_recv box_right box_same box_send box_sub bpchar bpchar_larger bpchar_pattern_ge bpchar_pattern_gt bpchar_pattern_le bpchar_pattern_lt bpchar_smaller bpchar_sortsupport bpcharcmp bpchareq bpcharge bpchargt bpchariclike bpcharicnlike bpcharicregexeq bpcharicregexne bpcharin bpcharle bpcharlike bpcharlt bpcharne bpcharnlike bpcharout bpcharrecv bpcharregexeq bpcharregexne bpcharsend bpchartypmodin bpchartypmodout broadcast btabstimecmp btarraycmp btbeginscan btboolcmp btbpchar_pattern_cmp btbuild btbuildempty btbulkdelete btcanreturn btcharcmp btcostestimate btendscan btfloat48cmp btfloat4cmp btfloat4sortsupport btfloat84cmp btfloat8cmp btfloat8sortsupport btgetbitmap btgettuple btinsert btint24cmp btint28cmp btint2cmp btint2sortsupport btint42cmp btint48cmp btint4cmp btint4sortsupport btint82cmp btint84cmp btint8cmp btint8sortsupport btmarkpos btnamecmp btnamesortsupport btoidcmp btoidsortsupport btoidvectorcmp btoptions btrecordcmp btreltimecmp btrescan btrestrpos btrim bttext_pattern_cmp bttextcmp bttextsortsupport bttidcmp bttintervalcmp btvacuumcleanup bytea_sortsupport bytea_string_agg_finalfn bytea_string_agg_transfn byteacat byteacmp byteaeq byteage byteagt byteain byteale bytealike bytealt byteane byteanlike byteaout bytearecv byteasend cash_cmp cash_div_cash cash_div_flt4 cash_div_flt8 cash_div_int2 cash_div_int4 cash_div_int8 cash_eq cash_ge cash_gt cash_in cash_le cash_lt cash_mi cash_mul_flt4 cash_mul_flt8 cash_mul_int2 cash_mul_int4 cash_mul_int8 cash_ne cash_out cash_pl cash_recv cash_send cashlarger cashsmaller cbrt ceil ceiling center char char_length character_length chareq charge chargt charin charle charlt charne charout charrecv charsend chr cideq cidin cidout cidr cidr_in cidr_out cidr_recv cidr_send cidrecv cidsend circle circle_above circle_add_pt circle_below circle_center circle_contain circle_contain_pt circle_contained circle_distance circle_div_pt circle_eq circle_ge circle_gt circle_in circle_le circle_left circle_lt circle_mul_pt circle_ne circle_out circle_overabove circle_overbelow circle_overlap circle_overleft circle_overright circle_recv circle_right circle_same circle_send circle_sub_pt clock_timestamp close_lb close_ls close_lseg close_pb close_pl close_ps close_sb close_sl col_description concat concat_ws contjoinsel contsel convert convert_from convert_to corr cos cot count covar_pop covar_samp cstring_in cstring_out cstring_recv cstring_send cume_dist current_database current_query current_schema xpath_exists current_setting current_user currtid currtid2 currval cursor_to_xml cursor_to_xmlschema database_to_xml database_to_xml_and_xmlschema database_to_xmlschema date date_cmp date_cmp_timestamp date_cmp_timestamptz date_eq date_eq_timestamp date_eq_timestamptz date_ge date_ge_timestamp date_ge_timestamptz date_gt date_gt_timestamp date_gt_timestamptz date_in date_larger date_le date_le_timestamp date_le_timestamptz date_lt date_lt_timestamp date_lt_timestamptz date_mi date_mi_interval date_mii date_ne date_ne_timestamp date_ne_timestamptz date_out date_pl_interval date_pli date_recv date_send date_smaller date_sortsupport daterange_canonical daterange_subdiff datetime_pl datetimetz_pl dcbrt decode defined degrees delete dense_rank dexp diagonal diameter dispell_init dispell_lexize dist_cpoly dist_lb dist_pb dist_pc dist_pl dist_ppath dist_ps dist_sb dist_sl div dlog1 dlog10 domain_in domain_recv dpow dround dsimple_init dsimple_lexize dsnowball_init dsnowball_lexize dsqrt dsynonym_init dsynonym_lexize dtrunc each enum_ne enum_out enum_range enum_recv enum_send enum_smaller eqjoinsel eqsel euc_cn_to_mic euc_cn_to_utf8 euc_jis_2004_to_shift_jis_2004 euc_jis_2004_to_utf8 euc_jp_to_mic euc_jp_to_sjis euc_jp_to_utf8 euc_kr_to_mic euc_kr_to_utf8 euc_tw_to_big5 euc_tw_to_mic euc_tw_to_utf8 every exist exists_all exists_any exp factorial family fdw_handler_in fdw_handler_out fetchval first_value float4 float4_accum float48div float48eq float48ge float48gt float48le float48lt float48mi float48mul float48ne float48pl float4abs float4div float4eq float4ge float4gt float4in float4larger float4le float4lt float4mi float4mul float4ne float4out float4pl float4recv float4send float4smaller float4um float4up float8 float8_accum float8_avg float8_collect float8_corr float8_covar_pop float8_covar_samp float8_regr_accum float8_regr_avgx float8_regr_avgy float8_regr_collect float8_regr_intercept float8_regr_r2 float8_regr_slope float8_regr_sxx float8_regr_sxy float8_regr_syy float8_stddev_pop float8_stddev_samp float8_var_pop float8_var_samp float84div float84eq float84ge float84gt float84le float84lt float84mi float84mul float84ne float84pl float8abs float8div float8eq float8ge float8gt float8in float8larger float8le float8lt float8mi float8mul float8ne float8out float8pl float8recv float8send float8smaller float8um float8up floor flt4_mul_cash flt8_mul_cash fmgr_c_validator fmgr_internal_validator fmgr_sql_validator format format_type gb18030_to_utf8 gbk_to_utf8 generate_series generate_subscripts get_bit get_byte get_current_ts_config - - gin_clean_pending_list gin_cmp_prefix gin_cmp_tslexeme gin_extract_tsquery gin_extract_tsvector gin_tsquery_consistent gin_tsquery_triconsistent ginarrayconsistent ginarrayextract ginarraytriconsistent ginbeginscan ginbuild ginbuildempty ginbulkdelete gincostestimate ginendscan gingetbitmap gininsert ginmarkpos ginoptions ginqueryarrayextract ginrescan ginrestrpos ginvacuumcleanup gist_box_compress gist_box_consistent gist_box_decompress gist_box_penalty gist_box_picksplit gist_box_same gist_box_union gist_circle_compress gist_circle_consistent gist_point_compress gist_point_consistent gist_point_distance gist_poly_compress gist_poly_consistent gistbeginscan gistbuild gistbuildempty gistbulkdelete gistcostestimate gistendscan gistgetbitmap gistgettuple gistinsert gistmarkpos gistoptions gistrescan gistrestrpos gistvacuumcleanup gtsquery_compress gtsquery_consistent gtsquery_decompress gtsquery_penalty gtsquery_picksplit gtsquery_same gtsquery_union gtsvector_compress gtsvector_consistent gtsvector_decompress gtsvector_penalty gtsvector_picksplit gtsvector_same gtsvector_union gtsvectorin gtsvectorout has_tablespace_privilege has_type_privilege hash_aclitem hashbeginscan hashbuild hashbuildempty hashbulkdelete hashcostestimate hashendscan hashgetbitmap hashgettuple hashinsert hashint2vector hashint4 hashint8 hashmacaddr hashmarkpos hashname hashoid hashoidvector hashoptions hashrescan hashrestrpos hashtext hashvacuumcleanup hashvarlena host hostmask iclikejoinsel iclikesel icnlikejoinsel icnlikesel icregexeqjoinsel icregexeqsel icregexnejoinsel icregexnesel inet_client_addr inet_client_port inet_in inet_out inet_recv inet_send inet_server_addr inet_server_port inetand inetmi inetmi_int8 inetnot inetor inetpl initcap int2_accum int2_avg_accum int2_mul_cash int2_sum int24div int24eq int24ge int24gt int24le int24lt int24mi int24mul int24ne int24pl int28div int28eq int28ge int28gt int28le int28lt int28mi int28mul int28ne int28pl int2abs int2and int2div int2eq int2ge int2gt int2in int2larger int2le int2lt int2mi int2mod int2mul int2ne int2not int2or int2out int2pl int2recv int2send int2shl int2shr int2smaller int2um int2up int2vectoreq int2vectorin int2vectorout int2vectorrecv int2vectorsend int2xor int4_accum int4_avg_accum int4_mul_cash int4_sum int42div int42eq int42ge int42gt int42le int42lt int42mi int42mul int42ne int42pl int48div int48eq int48ge int48gt int48le int48lt int48mi int48mul int48ne int48pl int4abs int4and int4div int4eq int4ge int4gt int4in int4inc int4larger int4le int4lt int4mi int4mod int4mul int4ne int4not int4or int4out int4pl int4range int4range_canonical int4range_subdiff int4recv int4send int4shl int4shr int4smaller int4um int4up int4xor int8 int8_avg int8_avg_accum int8_avg_collect int8_mul_cash int8_sum int8_sum_to_int8 int8_accum int82div int82eq int82ge int82gt int82le int82lt int82mi int82mul int82ne int82pl int84div int84eq int84ge int84gt int84le int84lt int84mi int84mul int84ne int84pl int8abs int8and int8div int8eq int8ge int8gt int8in int8inc int8inc_any int8inc_float8_float8 int8larger int8le int8lt int8mi int8mod int8mul int8ne int8not int8or int8out int8pl int8pl_inet int8range int8range_canonical int8range_subdiff int8recv int8send int8shl int8shr int8smaller int8um int8up int8xor integer_pl_date inter_lb inter_sb inter_sl internal_in internal_out interval interval_accum interval_avg interval_cmp interval_collect interval_div interval_eq interval_ge interval_gt interval_hash interval_in interval_larger interval_le interval_lt interval_mi interval_mul interval_ne interval_out interval_pl interval_pl_date interval_pl_time interval_pl_timestamp interval_pl_timestamptz interval_pl_timetz interval_recv interval_send interval_smaller interval_transform interval_um intervaltypmodin intervaltypmodout intinterval isexists ishorizontal iso_to_koi8r iso_to_mic iso_to_win1251 iso_to_win866 iso8859_1_to_utf8 iso8859_to_utf8 isparallel isperp isvertical johab_to_utf8 jsonb_in jsonb_out jsonb_recv jsonb_send - - - json_in json_out json_recv json_send justify_days justify_hours justify_interval koi8r_to_iso koi8r_to_mic koi8r_to_utf8 koi8r_to_win1251 koi8r_to_win866 koi8u_to_utf8 language_handler_in language_handler_out latin1_to_mic latin2_to_mic latin2_to_win1250 latin3_to_mic latin4_to_mic like_escape likejoinsel likesel line line_distance line_eq line_horizontal line_in line_interpt line_intersect line_out line_parallel line_perp line_recv line_send line_vertical ln lo_close lo_creat lo_create lo_export lo_import lo_lseek lo_open lo_tell lo_truncate lo_unlink log loread lower lower_inc lower_inf lowrite lpad lseg lseg_center lseg_distance lseg_eq lseg_ge lseg_gt lseg_horizontal lseg_in lseg_interpt lseg_intersect lseg_le lseg_length lseg_lt lseg_ne lseg_out lseg_parallel lseg_perp lseg_recv lseg_send lseg_vertical ltrim macaddr_and macaddr_cmp macaddr_eq macaddr_ge macaddr_gt macaddr_in macaddr_le macaddr_lt macaddr_ne macaddr_not macaddr_or macaddr_out macaddr_recv macaddr_send makeaclitem masklen max md5(MD5加密算法安全性低,存在安全风险,建议使用更安全的加密算法) mic_to_big5 mic_to_euc_cn mic_to_euc_jp mic_to_euc_kr mic_to_euc_tw mic_to_iso mic_to_koi8r mic_to_latin1 mic_to_latin2 mic_to_latin3 mic_to_latin4 mic_to_sjis mic_to_win1250 mic_to_win1251 mic_to_win866 min mktinterval money mul_d_interval name nameeq namege namegt nameiclike nameicnlike nameicregexeq nameicregexne namein namele namelike namelt namene namenlike nameout namerecv nameregexeq nameregexne namesend neqjoinsel neqsel network_cmp network_eq network_ge network_gt network_le network_lt network_ne network_sub network_subeq network_sup network_supeq nlikejoinsel nlikesel numeric numeric_abs numeric_accum numeric_add numeric_avg numeric_avg_accum numeric_avg_collect numeric_cmp numeric_collect numeric_div numeric_div_trunc numeric_eq numeric_exp numeric_fac numeric_ge numeric_gt numeric_in numeric_inc numeric_larger numeric_le numeric_ln numeric_log numeric_lt numeric_mod numeric_mul numeric_ne numeric_out numeric_power numeric_recv numeric_send numeric_smaller numeric_sortsupport numeric_sqrt numeric_stddev_pop numeric_stddev_samp numeric_sub numeric_transform numeric_uminus numeric_uplus numeric_var_pop numeric_var_samp numerictypmodin numerictypmodout numrange_subdiff oid oideq oidge oidgt oidin oidlarger oidle oidlt oidne oidout oidrecv oidsend oidsmaller oidvectoreq oidvectorge oidvectorgt oidvectorin oidvectorle oidvectorlt oidvectorne oidvectorout oidvectorrecv oidvectorsend oidvectortypes on_pb on_pl on_ppath on_ps on_sb on_sl opaque_in opaque_out ordered_set_transition overlaps overlay path path_add path_add_pt path_center path_contain_pt path_distance path_div_pt path_in path_inter path_length path_mul_pt path_n_eq path_n_ge path_n_gt path_n_le path_n_lt path_npoints path_out path_recv path_send path_sub_pt percentile_cont percentile_cont_float8_final percentile_cont_interval_final pg_char_to_encoding pg_cursor pg_encoding_max_length pg_encoding_to_char - - - pg_node_tree_in pg_node_tree_out pg_node_tree_recv pg_node_tree_send pg_prepared_statement pg_prepared_xact - - pg_show_all_settings pg_stat_get_bgwriter_stat_reset_time pg_stat_get_buf_fsync_backend pg_stat_get_checkpoint_sync_time pg_stat_get_checkpoint_write_time pg_stat_get_db_blk_read_time pg_stat_get_db_blk_write_time pg_stat_get_db_conflict_all pg_stat_get_db_conflict_bufferpin pg_stat_get_db_conflict_snapshot pg_stat_get_db_conflict_startup_deadlock pg_switch_xlog xpath pg_timezone_abbrevs pg_timezone_names pg_stat_get_wal_receiver plpgsql_call_handler plpgsql_inline_handler plpgsql_validator point_above point_add point_below point_distance point_div point_eq point_horiz point_in point_left point_mul point_ne point_out point_recv point_right point_send point_sub point_vert poly_above poly_below poly_center poly_contain poly_contain_pt poly_contained poly_distance poly_in poly_left poly_npoints poly_out poly_overabove poly_overbelow poly_overlap poly_overleft poly_overright poly_recv poly_right poly_same poly_send polygon position positionjoinsel positionsel postgresql_fdw_validator pow power prsd_end prsd_headline prsd_lextype prsd_nexttoken prsd_start pt_contained_circle pt_contained_poly query_to_xml query_to_xml_and_xmlschema query_to_xmlschema quote_ident quote_literal quote_nullable radians radius random range_adjacent range_after range_before range_cmp range_contained_by range_contains range_contains_elem range_eq range_ge range_gist_compress range_gist_consistent range_gist_decompress range_gist_penalty range_gist_picksplit range_gist_same range_gist_union range_gt range_in range_intersect range_le range_lt range_minus range_ne range_out range_overlaps range_overleft range_overright range_recv range_send range_typanalyze range_union rank record_eq record_ge record_gt record_in record_le record_lt record_ne record_out record_recv record_send regclass regclassin regclassout regclassrecv regclasssend regconfigin regconfigout regconfigrecv regconfigsend regdictionaryin regdictionaryout regdictionaryrecv regdictionarysend regexeqjoinsel regexeqsel regexnejoinsel regexnesel regexp_matches regexp_replace regexp_split_to_array regexp_split_to_table regoperatorin regoperatorout regoperatorrecv regoperatorsend regoperin regoperout regoperrecv regopersend regprocedurein regprocedureout regprocedurerecv regproceduresend regprocin regprocout regprocrecv regprocsend regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy regr_syy regtypein regtypeout regtyperecv regtypesend reltime reltimeeq reltimege reltimegt reltimein reltimele reltimelt reltimene reltimeout reltimerecv reltimesend repeat replace reverse RI_FKey_cascade_del RI_FKey_cascade_upd RI_FKey_check_ins RI_FKey_check_upd RI_FKey_noaction_del RI_FKey_noaction_upd RI_FKey_restrict_del RI_FKey_restrict_upd RI_FKey_setdefault_del RI_FKey_setdefault_upd RI_FKey_setnull_del RI_FKey_setnull_upd right round row_number row_to_json rpad rtrim scalargtjoinsel scalargtsel scalarltjoinsel scalarltsel schema_to_xml schema_to_xml_and_xmlschema schema_to_xmlschema session_user set_bit set_byte set_config set_masklen shift_jis_2004_to_euc_jis_2004 shift_jis_2004_to_utf8 sjis_to_euc_jp sjis_to_mic sjis_to_utf8 smgrin smgrout spg_kd_choose spg_kd_config spg_kd_inner_consistent spg_kd_picksplit spg_quad_choose spg_quad_config spg_quad_inner_consistent spg_quad_leaf_consistent spg_quad_picksplit spg_text_choose spg_text_config spg_text_inner_consistent spg_text_leaf_consistent spg_text_picksplit spgbeginscan spgbuild spgbuildempty spgbulkdelete spgcanreturn spgcostestimate spgendscan spggetbitmap spggettuple spginsert spgmarkpos spgoptions spgrescan spgrestrpos spgvacuumcleanup stddev stddev_pop stddev_samp string_agg string_agg_finalfn string_agg_transfn strip sum suppress_redundant_updates_trigger table_to_xml table_to_xml_and_xmlschema table_to_xmlschema tan text text_ge text_gt text_larger text_le text_lt text_pattern_ge text_pattern_gt text_pattern_le text_pattern_lt text_smaller textanycat textcat texteq texticlike texticnlike texticregexeq texticregexne textin textlike textne textnlike textout textrecv textregexeq textregexne textsend thesaurus_init thesaurus_lexize tideq tidge tidgt tidin tidlarger tidle tidlt tidne tidout tidrecv tidsend tidsmaller time time_cmp time_eq time_ge time_gt time_hash time_in time_larger time_le time_lt time_mi_interval time_mi_time time_ne time_out time_pl_interval time_recv time_send time_smaller time_transform timedate_pl timemi timepl timestamp timestamp_cmp timestamp_cmp_date timestamp_cmp_timestamptz timestamp_eq timestamp_eq_date timestamp_eq_timestamptz timestamp_ge timestamp_ge_date timestamp_ge_timestamptz timestamp_gt timestamp_gt_date timestamp_gt_timestamptz timestamp_hash timestamp_in timestamp_larger timestamp_le timestamp_le_date timestamp_le_timestamptz timestamp_lt timestamp_lt_date timestamp_lt_timestamptz timestamp_mi timestamp_mi_interval timestamp_ne timestamp_ne_date timestamp_ne_timestamptz timestamp_out timestamp_pl_interval timestamp_recv timestamp_send timestamp_smaller timestamp_sortsupport timestamp_transform timestamptypmodin timestamptypmodout timestamptz timestamptz_cmp timestamptz_cmp_date timestamptz_cmp_timestamp timestamptz_eq timestamptz_eq_date timestamptz_eq_timestamp timestamptz_ge timestamptz_ge_date timestamptz_ge_timestamp timestamptz_gt timestamptz_gt_date timestamptz_gt_timestamp timestamptz_in timestamptz_larger timestamptz_le timestamptz_le_date timestamptz_le_timestamp timestamptz_lt timestamptz_lt_date timestamptz_lt_timestamp timestamptz_mi timestamptz_mi_interval timestamptz_ne timestamptz_ne_date timestamptz_ne_timestamp timestamptz_out timestamptz_pl_interval timestamptz_recv timestamptz_send timestamptz_smaller timestamptztypmodin timestamptztypmodout timetypmodin timetypmodout timetz timetz_cmp timetz_eq timetz_ge timetz_gt timetz_hash timetz_in timetz_larger timetz_le timetz_lt timetz_mi_interval timetz_ne timetz_out timetz_pl_interval timetz_recv timetz_send timetz_smaller timetzdate_pl timetztypmodin timetztypmodout timezone(2069) timezone(1159) timezone(2037) timezone (2070) timezone (1026) timezone (2038) tintervalct tintervaleq tintervalge tintervalgt tintervalin tintervalle tintervalleneq tintervallenge tintervallengt tintervallenle tintervallenlt tintervallenne tintervallt tintervalne tintervalout tintervalov tintervalrecv tintervalsame tintervalsend tintervalstart to_ascii(1845) to_ascii(1847) to_ascii(1846) trigger_in trigger_out ts_match_qv ts_match_tq ts_match_tt ts_match_vq ts_rank ts_rank_cd ts_rewrite ts_stat ts_token_type ts_typanalyze tsmatchjoinsel tsmatchsel tsq_mcontained tsq_mcontains tsquery_and tsquery_cmp tsquery_eq tsquery_ge tsquery_gt tsquery_le tsquery_lt tsquery_ne tsquery_not tsquery_or tsqueryin tsqueryout tsqueryrecv tsquerysend tsrange tsrange_subdiff tstzrange tstzrange_subdiff tsvector_cmp tsvector_concat tsvector_eq tsvector_ge tsvector_gt tsvector_le tsvector_lt tsvector_ne tsvector_update_trigger tsvector_update_trigger_column tsvectorin tsvectorout tsvectorrecv tsvectorsend txid_current txid_current_snapshot txid_snapshot_in txid_snapshot_out txid_snapshot_recv txid_snapshot_send txid_snapshot_xip txid_snapshot_xmax txid_snapshot_xmin txid_visible_in_snapshot uhc_to_utf8 unique_key_recheck unknownin unknownout unknownrecv unknownsend unnest utf8_to_big5 utf8_to_euc_cn utf8_to_euc_jis_2004 utf8_to_euc_jp utf8_to_euc_kr utf8_to_euc_tw utf8_to_gb18030 utf8_to_gbk utf8_to_iso8859 utf8_to_iso8859_1 utf8_to_johab utf8_to_koi8r utf8_to_koi8u utf8_to_shift_jis_2004 utf8_to_sjis utf8_to_uhc utf8_to_win uuid_cmp uuid_eq uuid_ge uuid_gt uuid_hash uuid_in uuid_le uuid_lt uuid_ne uuid_out uuid_recv uuid_send var_pop var_samp varbit varbit_in varbit_out varbit_recv varbit_send varbit_transform varbitcmp varbiteq varbitge varbitgt varbitle varbitlt varbitne varbittypmodin varbittypmodout varchar varchar_transform varcharin varcharout varcharrecv varcharsend varchartypmodin varchartypmodout variance void_in void_out void_recv void_send win_to_utf8 win1250_to_latin2 win1250_to_mic win1251_to_iso win1251_to_koi8r win1251_to_mic win1251_to_win866 win866_to_iso win866_to_koi8r win866_to_mic win866_to_win1251 xideq xideqint4 xidin xidout xidrecv xidsend xml xml_in xml_is_well_formed xml_is_well_formed_content xml_is_well_formed_document xml_out xml_recv xml_send xmlagg xmlcomment xmlconcat2 xmlexists xmlvalidate pg_notify - -
-
内部函数 GaussDB中下列函数使用了内部数据类型,用户无法直接调用,在此章节列出。 选择率计算函数 areajoinsel areasel arraycontjoinsel arraycontsel contjoinsel contsel eqjoinsel eqsel iclikejoinsel iclikesel icnlikejoinsel icnlikesel icregexeqjoinsel icregexeqsel icregexnejoinsel icregexnesel likejoinsel likesel neqjoinsel neqsel nlikejoinsel nlikesel positionjoinsel positionsel regexeqjoinsel regexeqsel regexnejoinsel regexnesel scalargtjoinsel scalargtsel scalarltjoinsel scalarltsel tsmatchjoinsel tsmatchsel - 统计信息收集函数 array_typanalyze range_typanalyze ts_typanalyze local_rto_stat - - 排序内部功能函数 bpchar_sortsupport bytea_sortsupport date_sortsupport numeric_sortsupport timestamp_sortsupport 内部类型处理函数 abstimerecv euc_jis_2004_to_utf8 int2recv line_recv oidvectorrecv_extend tidrecv utf8_to_koi8u anyarray_recv euc_jp_to_mic int2vectorrecv lseg_recv path_recv time_recv utf8_to_shift_jis_2004 array_recv euc_jp_to_sjis int4recv macaddr_recv pg_node_tree_recv time_transform utf8_to_sjis ascii_to_mic euc_jp_to_utf8 int8recv mic_to_ascii point_recv timestamp_recv utf8_to_uhc ascii_to_utf8 euc_kr_to_mic internal_out mic_to_big5 poly_recv timestamp_transform utf8_to_win big5_to_euc_tw euc_kr_to_utf8 interval_recv mic_to_euc_cn pound_nexttoken timestamptz_recv uuid_recv big5_to_mic euc_tw_to_big5 interval_transform mic_to_euc_jp prsd_nexttoken timetz_recv varbit_recv big5_to_utf8 euc_tw_to_mic iso_to_koi8r mic_to_euc_kr range_recv tintervalrecv varbit_transform bit_recv euc_tw_to_utf8 iso_to_mic mic_to_euc_tw rawrecv tsqueryrecv varchar_transform boolrecv float4recv iso_to_win1251 mic_to_iso record_recv tsvectorrecv varcharrecv box_recv float8recv iso_to_win866 mic_to_koi8r regclassrecv txid_snapshot_recv void_recv bpcharrecv gb18030_to_utf8 iso8859_1_to_utf8 mic_to_latin1 regconfigrecv uhc_to_utf8 win_to_utf8 btoidsortsupport gbk_to_utf8 iso8859_to_utf8 mic_to_latin2 regdictionaryrecv unknownrecv win1250_to_latin2 bytearecv gin_extract_tsvector johab_to_utf8 mic_to_latin3 regoperatorrecv utf8_to_ascii win1250_to_mic byteawithoutorderwithequalcolrecv gtsvector_compress json_recv mic_to_latin4 regoperrecv utf8_to_big5 win1251_to_iso cash_recv gtsvector_consistent koi8r_to_iso mic_to_sjis regprocedurerecv utf8_to_euc_cn win1251_to_koi8r charrecv gtsvector_decompress koi8r_to_mic mic_to_win1250 regprocrecv utf8_to_euc_jis_2004 win1251_to_mic cidr_recv gtsvector_penalty koi8r_to_utf8 mic_to_win1251 regtyperecv utf8_to_euc_jp win1251_to_win866 cidrecv gtsvector_picksplit koi8r_to_win1251 mic_to_win866 reltimerecv utf8_to_euc_kr win866_to_iso circle_recv gtsvector_same koi8r_to_win866 namerecv shift_jis_2004_to_euc_jis_2004 utf8_to_euc_tw win866_to_koi8r cstring_recv gtsvector_union koi8u_to_utf8 ngram_nexttoken shift_jis_2004_to_utf8 utf8_to_gb18030 win866_to_mic date_recv hll_recv latin1_to_mic numeric_recv sjis_to_euc_jp utf8_to_gbk win866_to_win1251 domain_recv hll_trans_recv latin2_to_mic numeric_transform sjis_to_mic utf8_to_iso8859 xidrecv euc_cn_to_mic large_seq_upgrade_ntree latin2_to_win1250 nvarchar2recv sjis_to_utf8 utf8_to_iso8859_1 xidrecv4 euc_cn_to_utf8 inet_recv latin3_to_mic oidrecv smalldatetime_recv utf8_to_johab xml_recv euc_jis_2004_to_shift_jis_2004 int1recv latin4_to_mic oidvectorrecv textrecv utf8_to_koi8r cstore_tid_out i16toi1 int16 int16_bool int16eq int16div int16ge int16gt int16in int16le int16lt int16mi int16mul int16ne int16out int16pl int16recv int16send numeric_bool int2vectorin_extend int2vectorout_extend int2vectorrecv_extend int2vectorsend_extend tdigest_in tdigest_merge tdigest_merge_to_one tdigest_mergep tdigest_out - 聚合操作内部函数 array_agg_finalfn array_agg_transfn bytea_string_agg_finalfn bytea_string_agg_transfn date_list_agg_noarg2_transfn date_list_agg_transfn float4_list_agg_noarg2_transfn float4_list_agg_transfn float8_list_agg_noarg2_transfn float8_list_agg_transfn int2_list_agg_noarg2_transfn int2_list_agg_transfn int4_list_agg_noarg2_transfn int4_list_agg_transfn int8_list_agg_noarg2_transfn int8_list_agg_transfn interval_list_agg_noarg2_transfn interval_list_agg_transfn list_agg_finalfn list_agg_noarg2_transfn list_agg_transfn median_float8_finalfn median_interval_finalfn median_transfn mode_final numeric_list_agg_noarg2_transfn numeric_list_agg_transfn ordered_set_transition percentile_cont_float8_final percentile_cont_interval_final string_agg_finalfn string_agg_transfn timestamp_list_agg_noarg2_transfn timestamp_list_agg_transfn timestamptz_list_agg_noarg2_transfn timestamptz_list_agg_transfn checksumtext_agg_transfn - - - - - 哈希内部功能函数 hashbeginscan hashbuild hashbuildempty hashbulkdelete hashcostestimate hashendscan hashgetbitmap hashgettuple hashinsert hashmarkpos hashmerge hashrescan hashrestrpos hashvacuumcleanup hashvarlena - - - - - - Btree索引内部功能函数 cbtreebuild cbtreecanreturn cbtreecostestimate cbtreegetbitmap cbtreegettuple btbeginscan btbuild btbuildempty btbulkdelete btcanreturn btcostestimate btendscan btfloat4sortsupport btfloat8sortsupport btgetbitmap btgettuple btinsert btint2sortsupport btint4sortsupport btint8sortsupport btmarkpos btmerge btnamesortsupport btrescan btrestrpos bttextsortsupport btvacuumcleanup cbtreeoptions Psort索引内部函数 psortbuild psortcanreturn psortcostestimate psortgetbitmap psortgettuple Ubtree索引内部函数 ubtbeginscan ubtbuild ubtbuildempty ubtbulkdelete ubtcanreturn ubtcostestimate ubtendscan ubtgetbitmap ubtgettuple ubtinsert ubtmarkpos ubtmerge ubtoptions ubtrescan ubtrestrpos ubtvacuumcleanup - - - - plpgsql内部函数 plpgsql_inline_handler 集合相关内部函数 array_indexby_delete array_indexby_length array_integer_deleteidx array_integer_exists array_integer_first array_integer_last array_integer_next array_integer_prior array_varchar_deleteidx array_varchar_exists array_varchar_first array_varchar_last array_varchar_next array_varchar_prior - - - - 外表相关内部函数 dist_fdw_handler roach_handler streaming_fdw_handler dist_fdw_validator file_fdw_handler file_fdw_validator log_fdw_handler 主DN远程读取备DN数据页辅助函数 gs_read_block_from_remote用于读取非段页式表文件的页面。默认只有初始化用户可以查看,其余用户需要赋权后才可以使用。 gs_read_segment_block_from_remote用于读取段页式表文件的页面。默认只有初始化用户可以查看,其余用户需要赋权后才可以使用。 主DN远程读取备DN数据文件辅助函数 gs_read_file_from_remote用于读取指定的文件。gs_repair_file利用gs_read_file_size_from_remote函数获取文件大小后,依赖这个函数将远端文件逐段读取。默认只有初始化用户可以查看,其余用户需要赋权后才可以使用。 gs_read_file_size_from_remote用于读取指定文件的大小。用于读取指定文件的大小,gs_repair_file函数修复文件时,要先获取远端关于这个文件的大小,用于校验本地文件缺失的文件信息,然后将缺失的文件逐个修复。默认只有初始化用户可以查看,其余用户需要赋权后才可以使用。 AI特性函数 create_snapshot create_snapshot_internal prepare_snapshot_internal prepare_snapshot manage_snapshot_internal archive_snapshot publish_snapshot purge_snapshot_internal purge_snapshot sample_snapshot - - - - PKG_SERVICE函数 isubmit_on_nodes submit_on_nodes - - - - - 其他函数 to_tsvector_for_batch value_of_percentile disable_conn bind_variable job_update job_cancel job_finish similar_escape table_skewness (不可用) timetz_text time_text reltime_text abstime_text _pg_keysequal analyze_query (不可用) analyze_workload (不可用) ssign_table_type gs_comm_proxy_thread_status gs_txid_oldestxmin pg_cancel_session pg_stat_segment_space_info remote_segment_space_info set_cost_params set_weight_params start_collect_workload tdigest_in tdigest_merge tdigest_merge_to_one tdigest_mergep tdigest_out pg_get_delta_info - - - - 视图相关引用函数 adm_hist_sqlstat_func adm_hist_sqlstat_idlog_func 父主题: 函数和操作符
-
废弃函数 由于版本升级,HLL(HyperLogLog)有一些旧的函数废弃,用户可以用类似的函数进行替代。 hll_schema_version(hll) 描述:查看当前hll中的schema version。旧版本schema version是常值1,用来进行hll字段的头部校验,重构后的hll在头部增加字段“HLL”进行校验,schema version不再使用。 hll_regwidth(hll) 描述:查看hll数据结构中桶的位数大小。旧版本桶的位数regwidth取值1~5,会存在较大的误差,也限制了基数估计上限。 重构后regwidth为固定值6,不再使用regwidth变量。 hll_expthresh(hll) 描述:得到当前hll中expthresh大小。采用hll_log2explicit(hll)替代类似功能。 hll_sparseon(hll) 描述:是否启用Sparse模式。采用hll_log2sparse(hll)替代类似功能,0表示关闭Sparse模式。
-
操作符 = 描述:比较hll或hll_hashval的值是否相等。 返回值类型:bool 示例: 1 2 3 4 5 6 7 8 9 10 11 12 13 --hll openGauss=# SELECT (hll_empty() || hll_hash_integer(1)) = (hll_empty() || hll_hash_integer(1)); column ---------- t (1 row) --hll_hashval openGauss=# SELECT hll_hash_integer(1) = hll_hash_integer(1); ?column? ---------- t (1 row)
-
聚合函数 hll_add_agg(hll_hashval) 描述:把哈希后的数据按照分组放到hll中。 返回值类型:hll 示例: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 --准备数据 openGauss=# CREATE TABLE t_id(id int); openGauss=# INSERT INTO t_id VALUES(generate_series(1,500)); openGauss=# CREATE TABLE t_data(a int, c text); openGauss=# INSERT INTO t_data SELECT mod(id,2), id FROM t_id; --创建表并指定列为hll openGauss=# CREATE TABLE t_a_c_hll(a int, c hll); --根据a列group by对数据分组,把各组数据加到hll中 openGauss=# INSERT INTO t_a_c_hll SELECT a, hll_add_agg(hll_hash_text(c)) FROM t_data GROUP BY a; --得到每组数据中hll的Distinct值 openGauss=# SELECT a, #c as cardinality FROM t_a_c_hll ORDER BY a; a | cardinality ---+------------------ 0 | 247.862354346299 1 | 250.908710610377 (2 rows)
-
功能函数 hll_empty() 描述:创建一个空的hll。 返回值类型:hll 示例: 1 2 3 4 5 openGauss=# SELECT hll_empty(); hll_empty ------------------------------------------------------------ \x484c4c00000000002b05000000000000000000000000000000000000 (1 row) hll_empty(int32 log2m) 描述:创建空的hll并指定参数log2m,取值范围是10到16。若输入-1,则采用内置默认值。 返回值类型:hll 示例: 1 2 3 4 5 6 7 8 9 10 11 openGauss=# SELECT hll_empty(10); hll_empty ------------------------------------------------------------ \x484c4c00000000002b04000000000000000000000000000000000000 (1 row) openGauss=# SELECT hll_empty(-1); hll_empty ------------------------------------------------------------ \x484c4c00000000002b05000000000000000000000000000000000000 (1 row) hll_empty(int32 log2m, int32 log2explicit) 描述:创建空的hll并依次指定参数log2m、log2explicit。log2explicit取值范围是0到12,0表示直接跳过Explicit模式。该参数可以用来设置Explicit模式的阈值大小,在数据段长度达到2log2explicit后切换为Sparse模式或者Full模式。若输入-1,则log2explicit采用内置默认值。 返回值类型: hll 示例: 1 2 3 4 5 6 7 8 9 10 11 openGauss=# SELECT hll_empty(10, 4); hll_empty ------------------------------------------------------------ \x484c4c00000000001304000000000000000000000000000000000000 (1 row) openGauss=# SELECT hll_empty(10, -1); hll_empty ------------------------------------------------------------ \x484c4c00000000002b04000000000000000000000000000000000000 (1 row) hll_empty(int32 log2m, int32 log2explicit, int64 log2sparse) 描述:创建空的hll并依次指定参数log2m、log2explicit、log2sparse。log2sparse取值范围是0到14,0表示直接跳过Sparse模式。该参数可以用来设置Sparse模式的阈值大小,在数据段长度达到2log2sparse后切换为Full模式。若输入-1,则log2sparse采用内置默认值。 返回值类型:hll 示例: 1 2 3 4 5 6 7 8 9 10 11 openGauss=# SELECT hll_empty(10, 4, 8); hll_empty ------------------------------------------------------------ \x484c4c00000000001204000000000000000000000000000000000000 (1 row) openGauss=# SELECT hll_empty(10, 4, -1); hll_empty ------------------------------------------------------------ \x484c4c00000000001304000000000000000000000000000000000000 (1 row) hll_empty(int32 log2m, int32 log2explicit, int64 log2sparse, int32 duplicatecheck) 描述:创建空的hll并依次指定参数log2m、log2explicit、log2sparse、duplicatecheck。duplicatecheck取0或者1,表示是否开启该模式,默认情况下该模式会关闭。若输入-1,则duplicatecheck采用内置默认值。 返回值类型:hll 示例: 1 2 3 4 5 6 7 8 9 10 11 openGauss=# SELECT hll_empty(10, 4, 8, 0); hll_empty ------------------------------------------------------------ \x484c4c00000000001204000000000000000000000000000000000000 (1 row) openGauss=# SELECT hll_empty(10, 4, 8, -1); hll_empty ------------------------------------------------------------ \x484c4c00000000001204000000000000000000000000000000000000 (1 row) hll_add(hll, hll_hashval) 描述:把hll_hashval加入到hll中。 返回值类型:hll 示例: 1 2 3 4 5 openGauss=# SELECT hll_add(hll_empty(), hll_hash_integer(1)); hll_add ---------------------------------------------------------------------------- \x484c4c08000002002b0900000000000000f03f3e2921ff133fbaed3e2921ff133fbaed00 (1 row) hll_add_rev(hll_hashval, hll) 描述:把hll_hashval加入到hll中,和hll_add功能一样,只是参数位置进行了交换。 返回值类型:hll 示例: 1 2 3 4 5 openGauss=# SELECT hll_add_rev(hll_hash_integer(1), hll_empty()); hll_add_rev ---------------------------------------------------------------------------- \x484c4c08000002002b0900000000000000f03f3e2921ff133fbaed3e2921ff133fbaed00 (1 row) hll_eq(hll, hll) 描述:比较两个hll是否相等。 返回值类型:bool 示例: 1 2 3 4 5 openGauss=# SELECT hll_eq(hll_add(hll_empty(), hll_hash_integer(1)), hll_add(hll_empty(), hll_hash_integer(2))); hll_eq -------- f (1 row) hll_ne(hll, hll) 描述:比较两个hll是否不相等。 返回值类型:bool 示例: 1 2 3 4 5 openGauss=# SELECT hll_ne(hll_add(hll_empty(), hll_hash_integer(1)), hll_add(hll_empty(), hll_hash_integer(2))); hll_ne -------- t (1 row) hll_cardinality(hll) 描述:计算hll的distinct值。 返回值类型:int 示例: 1 2 3 4 5 openGauss=# SELECT hll_cardinality(hll_empty() || hll_hash_integer(1)); hll_cardinality ----------------- 1 (1 row) hll_union(hll, hll) 描述:把两个hll数据结构union成一个。 返回值类型:hll 示例: 1 2 3 4 5 openGauss=# SELECT hll_union(hll_add(hll_empty(), hll_hash_integer(1)), hll_add(hll_empty(), hll_hash_integer(2))); hll_union -------------------------------------------------------------------------------------------- \x484c4c10002000002b090000000000000000400000000000000000b3ccc49320cca1ae3e2921ff133fbaed00 (1 row)
-
日志函数 hll主要存在三种模式Explicit,Sparse,Full。当数据规模比较小的时候会使用Explicit模式,这种模式下distinct值的计算是没有误差的;随着distinct值越来越多,hll会先后转换为Sparse模式和Full模式,这两种模式在计算结果上没有任何区别,只影响hll函数的计算效率和hll对象的存储空间。下面的函数可以用于查看hll的一些参数。 hll_print(hll) 描述:打印hll的一些debug参数信息。 示例: 1 2 3 4 5 openGauss=# SELECT hll_print(hll_empty()); hll_print ------------------------------------------------------------------------------- type=1(HLL_EMPTY), log2m=14, log2explicit=10, log2sparse=12, duplicatecheck=0 (1 row)
-
下标生成函数 generate_subscripts(array anyarray, dim int) 描述:生成一系列包括给定数组的下标。 返回值类型:setof int generate_subscripts(array anyarray, dim int, reverse boolean) 描述:生成一系列包括给定数组的下标。当reverse为真时,该系列则以相反的顺序返回。 返回值类型:setof int
-
序列号生成函数 generate_series(start, stop) 描述:生成一个数值序列,从start到stop,步长为1。 参数类型:int、bigint、numeric 返回值类型:setof int、setof bigint、setof numeric(与参数类型相同) generate_series(start, stop, step) 描述:生成一个数值序列,从start到stop,步长为step。 参数类型:int、bigint、numeric 返回值类型:setof int、setof bigint、setof numeric(与参数类型相同) generate_series(start, stop, step interval) 描述:生成一个数值序列,从start到stop,步长为step。 参数类型:timestamp或timestamp with time zone 返回值类型:setof timestamp或setof timestamp with time zone(与参数类型相同)
更多精彩内容
CDN加速
GaussDB
文字转换成语音
免费的服务器
如何创建网站
域名网站购买
私有云桌面
云主机哪个好
域名怎么备案
手机云电脑
SSL证书申请
云点播服务器
免费OCR是什么
电脑云桌面
域名备案怎么弄
语音转文字
文字图片识别
云桌面是什么
网址安全检测
网站建设搭建
国外CDN加速
SSL免费证书申请
短信批量发送
图片OCR识别
云数据库MySQL
个人域名购买
录音转文字
扫描图片识别文字
OCR图片识别
行驶证识别
虚拟电话号码
电话呼叫中心软件
怎么制作一个网站
Email注册网站
华为VNC
图像文字识别
企业网站制作
个人网站搭建
华为云计算
免费租用云托管
云桌面云服务器
ocr文字识别免费版
HTTPS证书申请
图片文字识别转换
国外域名注册商
使用免费虚拟主机
云电脑主机多少钱
鲲鹏云手机
短信验证码平台
OCR图片文字识别
SSL证书是什么
申请企业邮箱步骤
免费的企业用邮箱
云免流搭建教程
域名价格