返回首页

gbase数据、南大通用产品文档:GBase8a元数据兼容性

更新日期:2024年09月11日

Oracle 的大对象数据类型(如blob,clob 等)、binary、long 数据类型本期不支持。
支持oracle 基本数据类型(字符型、数字型及日期型等)。

GBase 8a MPP Cluster 产品手册
4 管理员指南
文档版本953(2022-09-15)
南大通用数据技术股份有限公司
611
说明

gbase 的decimal(p,s),p 即精度最大值支持到65 位,
s 即小数,
最大值为30;
oracle 的
number(p,s) 类型,s 超过30 ,dblink 网关将映射为gbase 的double 数据类型,由于double
类型是非精确的数据类型,会有精度损失;

由于oracle 的date 类型可以存储时分秒信息,对于异构数据源oracle 的date 类型,会
映射为GCluster 的datetime 类型。使用dblink 查询oracle 的date 类型数据会带上时分秒信
息,可以用to_date 函数格式化输出去掉时分秒信息。

语法
GROUP BY GROUPING SETS( (…),(…),…)
功能
对GROUPING SETS 后面括号里的n 个字段或表达式分别做GROUP BY 操作,最
后将结果合并在一起。
详见下面的解释:
GROUP BY GROUPING SETS (A,B,C) (A、B、C 代表语法中的“(…)”)
首先对(A)进行GROUP BY,然后对(B)进行GROUP BY,然后对(C)进行GROUP
BY,最后将所有结果合并在一起(相当于UNION ALL 操作),如果n 个字段或表达
式中的一个或多个在某一分组中不出现在GROUP BY 后面,用NULL 代替不出现
的字段或表达式。
示例
示例1:GROUP BY GROUPING SETS(color_type,f_YearMonth)
gbase> SELECT color_type,in_date,color_count FROM t3 ORDER BY color_type,in_date;
+------------+------------+-------------+
| color_type | in_date | color_count |

GBase UP 产品手册 5 数据库管理指南
文档版本04(2021-04-21) 南大通用数据技术股份有限公司 577
+------------+------------+-------------+
| black | 2010-09-11 | 18 |
| black | 2010-10-05 | 18 |
| black | 2010-10-13 | 31 |
| blue | 2010-09-21 | 23 |
| blue | 2010-09-30 | 15 |
| blue | 2010-10-11 | 62 |
| red | 2010-09-12 | 41 |
| red | 2010-10-01 | 12 |
| red | 2010-10-05 | 11 |
+------------+------------+-------------+
9 rows in set

gbase> SELECT NVL(color_type,'') as
color_type_show,DECODE(color_type,NULL,f_YearMonth || '合计
',NVL(f_YearMonth,color_type || ' 小计')) AS f_YearMonth_show,SUM(color_count) FROM
(SELECT color_type,DATE_FORMAT(in_date, '%Y-%m') as f_YearMonth,color_count FROM
t3) t GROUP BY GROUPING SETS(color_type,f_YearMonth) ORDER BY
color_type,f_YearMonth;
+-----------------+------------------+------------------+
| color_type_show | f_YearMonth_show | SUM(color_count) |
+-----------------+------------------+------------------+
| black | black 小计 | 67 |
| blue | blue 小计 | 100 |
| red | red 小计 | 64 |
| | 2010-09 合计 | 97 |
| | 2010-10 合计 | 134 |
+-----------------+------------------+------------------+
5 rows in set
非GROUP BY 类函数

PG_STATIO_USER_TABLES
PG_STATIO_USER_TABLES 视图显示命名空间中所有用户关系表的IO 状态信息。
名称
类型
描述
relid
oid
表OID。
schemaname
name
该表模式名。
relname
name
表名。
heap_blks_read
bigint
从该表中读取的磁盘块数。
heap_blks_hit
bigint
该表缓存命中数。
idx_blks_read
bigint
从表中所有索引读取的磁盘块数。
idx_blks_hit
bigint
表中所有索引命中缓存数。

GBase 8c V5 开发者手册
南大通用数据技术股份有限公司
913
名称
类型
描述
toast_blks_read
bigint
该表的TOAST 表读取的磁盘块数(如果存在)。
toast_blks_hit
bigint
该表的TOAST 表命中缓冲区数(如果存在)。
tidx_blks_read
bigint
该表的TOAST 表索引读取的磁盘块数
(如果存在)

tidx_blks_hit
bigint
该表的TOAST 表索引命中缓冲区数(如果存在)。