返回首页

gbase数据、南大通用产品文档:GBase8a

更新日期:2024年09月11日

GBA-02EX-0002
错误码
错误标识
错误信息
GBA-02EX-0002
ER_EXECUTOR_QU
ERY
Failed to create a temporary table: %s
错误出现原因
创建临时表时产生错误,单机语法不支持
分析与建议
1、检查创建语句是否有问题;
2、gnode 是否已重启过;
3、查看相同名临时表是否已存在;
4、磁盘空间不足;

1.
用户优先级设定

语法:
grant usage on *.* to user_name with task_priority priority_value
priority_value 的取值范围为0,1,2,3 对应最小优先级,低优先级、中优先
级和高优先级,缺省为中优先级2。

权限要求:
有grant 权限的用户,推荐用户:root

示例:
gbase> create user uer1 ;
Query OK, 0 rows affected
gbase> grant usage on *.* to
uer1
with task_priority
1;
Query OK, 0 rows affected
gbase> select task_priority from user where user='user1';
+---------------+
| task_priority |
+---------------+
|
1 |
+---------------+
1 row in set
2.
用户资源组设定

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

语法:
grant usage on *.* to user_name with resource_group group_value
group_value 的取值范围为0-15,0 组为缺省组。

权限要求:
有grant 权限的用户,推荐用户:root。

示例:
gbase> create user user0 identified by 'user0';
Query OK, 0 rows affected
gbase> grant usage on *.* to user0 with resource_group 0;
Query OK, 0 rows affected
gbase> select resource_group from user where user='user0';
+----------------+
| resource_group |
+----------------+
|
0 |
+----------------+
1 row in set
3.
查询并行度设定

语法:
grant usage on *.* to user_name with max_cpus_used max_cpus_used_value
max_cpus_used_value 的取值范围为大于0 的整数,
该参数决定查询的并行度,
推荐值为用户所在资源组的可用CPU 数目。

权限要求:
有grant 权限的用户,推荐用户:root。

示例:
gbase> use gbase;
Query OK, 0 rows affected
gbase> create user user1;
Query OK, 0 rows affected
gbase> grant usage on *.* to
user1
with max_cpus_used
4;
Query OK, 0 rows affected

GBase 8a MPP Cluster 产品手册
5 数据库管理指南
文档版本953(2022-09-15)
南大通用数据技术股份有限公司
1288
gbase> select max_cpus from user where user='user1';
+----------+
| max_cpus |
+----------+
|
4 |
+----------+
1 row in set
4.
显示优先级状态
1)
语法
Show priorities [where conditions]
2)
显示
node_name:集群节点名称。
Group:资源组编号。
Priority:优先级编号。
priority_weight:优先级配重。
Status:优先级开启状态ON/OFF。
Description:优先级控制参数描述。
3)
权限要求
有show 权限用户。
4)
示例

需要配置cgconfig.conf 文件。在配置文件中为资源组0、1 进行设置。

启动cgconfig 服务。

重启gcware:
$gcluster_services gcware restart
完成以上配置操作后,再执行下面示例的命令,0、1 两个控制组的优先
级将为开启状态。

示例1:查看集群全部节点优先级状态。
gbase> show priorities;
+-----------+-------+----------+----------------+--------+-------------+
| node_name | group | priority | priority-weight | status | description|
+-----------+-------+----------+-----------------+-------+-------------+

GBase 8a MPP Cluster 产品手册
5 数据库管理指南
文档版本953(2022-09-15)
南大通用数据技术股份有限公司
1289
| node1
|
0|
0 |
20 | ON
|......
|
| node1
|
0|
1 |
40 | ON
|......
|
| node1
|
0|
2 |
60 | ON
|......
|
| node1
|
0|
3 |
80 | ON
|......
|
| node1
|
1|
0 |
20 | ON
|......
|
| node1
|
1|
1 |
40 | ON
|......
|
| node1
|
1|
2 |
60 | ON
|......
|
| node1
|
1|
3 |
80 | ON
|......
|
| node1
|
2|
0 |
20 | OFF
|......
|
| node1
|
2|
1 |
40 | OFF
|......
|
| node1
|
2|
2 |
60 | OFF
|......
|
| node1
|
2|
3 |
80 | OFF
|......
|
......
| node2
|
15|
0 |
20 | OFF
|......
|
| node2
|
15|
1 |
40 | OFF
|......
|
| node2
|
15|
2 |
60 | OFF
|......
|
| node2
|
15|
3 |
80 | OFF
|......
|
+-----------+-------+----------+-----------------+-------+-------------+
128 rows in set

示例2:查看node1 节点的优先级状态信息。
gbase> show
priorities
where node_name = 'node1';
+-----------+-------+----------+----------------+--------+-------------+
| node_name | group | priority | priority-weight | status | description|
+-----------+-------+----------+-----------------+-------+-------------+
| node1
|
0|
0 |
20 | ON
|......
|
| node1
|
0|
1 |
40 | ON
|......
|
| node1
|
0|
2 |
60 | ON
|......
|
| node1
|
0|
3 |
80 | ON
|......
|
| node1
|
1|
0 |
20 | ON
|......
|
| node1
|
1|
1 |
40 | ON
|......
|
| node1
|
1|
2 |
60 | ON
|......
|
| node1
|
1|
3 |
80 | ON
|......
|
| node1
|
2|
0 |
20 | OFF
|......
|
| node1
|
2|
1 |
40 | OFF
|......
|
| node1
|
2|
2 |
60 | OFF
|......
|

GBase 8a MPP Cluster 产品手册
5 数据库管理指南
文档版本953(2022-09-15)
南大通用数据技术股份有限公司
1290
| node1
|
2|
3 |
80 | OFF
|......
|
......
| node1
|
15|
0 |
20 | OFF
|......
|
| node1
|
15|
1 |
40 | OFF
|......
|
| node1
|
15|
2 |
60 | OFF
|......
|
| node1
|
15|
3 |
80 | OFF
|......
|
+-----------+-------+----------+-----------------+-------+-------------+
64 rows in set

示例3:查看状态为ON 的优先级信息。
gbase> show priorities where status ='ON';
+-----------+-------+----------+----------------+--------+-------------+
| node_name | group | priority | priority-weight | status | description|
+-----------+-------+----------+-----------------+-------+-------------+
| node1
|
0|
0 |
20 | ON
|......
|
| node1
|
0|
1 |
40 | ON
|......
|
| node1
|
0|
2 |
60 | ON
|......
|
| node1
|
0|
3 |
80 | ON
|......
|
| node1
|
1|
0 |
20 | ON
|......
|
| node1
|
1|
1 |
40 | ON
|......
|
| node1
|
1|
2 |
60 | ON
|......
|
| node1
|
1|
3 |
80 | ON
|......
|
+-----------+-------+----------+-----------------+-------+-------------+
8 rows in set

示例4:关闭node1 节点cgroup 配置服务(service cgconfig stop)。
# service cgconfig stop
Stopping cgconfig service: [
OK
]
# su - gbase
$ gcluster_services all restart
Stopping GCMonit success!
Signaling GCRECOVER (gcrecover) to terminate: [
OK
]
Waiting for gcrecover services to unload:...[
OK
]
Signaling GCSYNC (gc_sync_server) to terminate: [
OK
]
[
OK
]for gc_sync_server services to unload:[
OK
]
Signaling GCLUSTERD
to terminate: [
OK
]

GBase 8a MPP Cluster 产品手册
5 数据库管理指南
文档版本953(2022-09-15)
南大通用数据技术股份有限公司
1291
.[
OK
]or gclusterd services to unload:...[
OK
]
Signaling GBASED
to terminate: [
OK
]
.[
OK
]or gbased services to unload:[
OK
]
Signaling GCWARE (gcware) to terminate: [
OK
]
Waiting for gcware services to unload:.[
OK
]
Starting GCWARE (gcwexec): [
OK
]
Starting GCMonit success!
Starting GBASED
: [
OK
]
Starting GCLUSTERD :
[
OK
]
Starting GCSYNC : [
OK
]
Starting GCRECOVER : [
OK
]
$ gccli -uroot
GBase client 9.5.3.17.117651. Copyright (c) 2004-2019, GBase.
All Rights Reserved.
gbase> show
priorities
where node_name = 'node1';
+-----------+-------+----------+----------------+--------+-------------+
| node_name | group | priority | priority-weight | status | description|
+-----------+-------+----------+-----------------+-------+-------------+
| node1
|
0|
0 |
20 | OFF
|......
|
| node1
|
0|
1 |
40 | OFF
|......
|
| node1
|
0|
2 |
60 | OFF
|......
|
| node1
|
0|
3 |
80 | OFF
|......
|
| node1
|
1|
0 |
20 | OFF
|......
|
| node1
|
1|
1 |
40 | OFF
|......
|
| node1
|
1|
2 |
60 | OFF
|......
|
| node1
|
1|
3 |
80 | OFF
|......
|
| node1
|
2|
0 |
20 | OFF
|......
|
| node1
|
2|
1 |
40 | OFF
|......
|
| node1
|
2|
2 |
60 | OFF
|......
|
| node1
|
2|
3 |
80 | OFF
|......
|
......
| node1
|
15|
0 |
20 | OFF
|......
|
| node1
|
15|
1 |
40 | OFF
|......
|
| node1
|
15|
2 |
60 | OFF
|......
|
| node1
|
15|
3 |
80 | OFF
|......
|
+-----------+-------+----------+-----------------+-------+-------------+

GBase 8a MPP Cluster 产品手册
5 数据库管理指南
文档版本953(2022-09-15)
南大通用数据技术股份有限公司
1292
64 rows in set

示例5:重新开启node1 的cgroup 配置服务(service cgconfig start)。
# service cgconfig start
Starting cgconfig service: [
OK
]
# su - gbase
# gcluster_services all restart
Stopping GCMonit success!
Signaling GCRECOVER (gcrecover) to terminate: [
OK
]
Waiting for gcrecover services to unload:...[
OK
]
Signaling GCSYNC (gc_sync_server) to terminate: [
OK
]
[
OK
]for gc_sync_server services to unload:[
OK
]
Signaling GCLUSTERD
to terminate: [
OK
]
.[
OK
]or gclusterd services to unload:...[
OK
]
Signaling GBASED
to terminate: [
OK
]
.[
OK
]or gbased services to unload:[
OK
]
Signaling GCWARE (gcware) to terminate: [
OK
]
Waiting for gcware services to unload:.[
OK
]
Starting GCWARE (gcwexec): [
OK
]
Starting GCMonit success!
Starting GBASED
: [
OK
]
Starting GCLUSTERD :
[
OK
]
Starting GCSYNC : [
OK
]
Starting GCRECOVER : [
OK
]
$ gccli -uroot
GBase client 9.5.3.17.117651. Copyright (c) 2004-2019, GBase.
All Rights Reserved.
gbase> show
priorities
where node_name = 'node1';
+-----------+-------+----------+----------------+--------+-------------+
| node_name | group | priority | priority-weight | status | description|
+-----------+-------+----------+-----------------+-------+-------------+
| node1
|
0|
0 |
20 | ON
|......
|

GBase 8a MPP Cluster 产品手册
5 数据库管理指南
文档版本953(2022-09-15)
南大通用数据技术股份有限公司
1293
| node1
|
0|
1 |
40 | ON
|......
|
| node1
|
0|
2 |
60 | ON
|......
|
| node1
|
0|
3 |
80 | ON
|......
|
| node1
|
1|
0 |
20 | ON
|......
|
| node1
|
1|
1 |
40 | ON
|......
|
| node1
|
1|
2 |
60 | ON
|......
|
| node1
|
1|
3 |
80 | ON
|......
|
| node1
|
2|
0 |
20 | OFF
|......
|
| node1
|
2|
1 |
40 | OFF
|......
|
| node1
|
2|
2 |
60 | OFF
|......
|
| node1
|
2|
3 |
80 | OFF
|......
|
......
| node1
|
15|
0 |
20 | OFF
|......
|
| node1
|
15|
1 |
40 | OFF
|......
|
| node1
|
15|
2 |
60 | OFF
|......
|
| node1
|
15|
3 |
80 | OFF
|......
|
+-----------+-------+----------+-----------------+-------+-------------+
64 rows in set
5.
配置优先级队列相关参数
通过在gcluster($GCLUSTER_BASE/config/gbase_8a_gcluster.cnf)与
gnode($GBASE_BASE/config/gbase_8a_gbase.cnf)的配置文件中修改下面几
个参数值来完成优先级队列的配置:

gbase_use_priority_queue:
参数设置为0,表示关闭优先级队列;
设置为1,表示开启优先级队列。

_gbase_priority_total_tasks:参数表示最大并行运行查询任务数目,包括
DML 的查询部分,本参数最大值不能超过128,缺省为本地CPU 核数2
倍;

_gbase_priority_tasks:
参数表示每个优先级队列可容纳最大任务数目
(即
可参加调度的数目),未能进入队列任务将阻塞等待,本参数最大值不
能超过64,缺省为本地CPU 核数;

gbase_use_res_ctrl_group:
本参数决定是不是启用资源控制组挂接。
参数
设置为0,表示不开启资源控制组挂接,缺省设置为不开启状态;设置
其他值为开启资源控制组挂接。
6.
指定查询SQL 优先级

GBase 8a MPP Cluster 产品手册
5 数据库管理指南
文档版本953(2022-09-15)
南大通用数据技术股份有限公司
1294
资源组用户Session 可根据具体情况,通过使用hint (格式为
/*+PRIORITY(‘priority_value’)*/), 决定该SQL 运行级别
(即对应的优先级)

本命令只限于查询SQL。

语法:
Select /*+PRIORITY(‘priority_value’)*/ …
权限要求
有create,insert,drop,select 权限的用户。

备注:
优先级设定只能小于或等于该用户优先级别,设置错误会恢复到用户优先
级,并报出警告“can not upgrade to priority X”(X 是执行用户的优先级)。

示例:
gbase> create table t1(a int);
Query OK, 0 rows affected
gbase> insert into t1 values (1),(1),(2),(3),(5);
Query OK, 5 rows affected
Records: 5
Duplicates: 0
Warnings: 0
gbase> select
/*+PRIORITY(‘0’)*/ * from t1 group by a;
+------+
| a
|
+------+
|
1 |
|
2 |
|
3 |
|
5 |
+------+
4 rows in set

全文检索概述
文本搜索操作符在数据库中已存在多年。
GBase 8c 为文本数据类型提供~、
~*、
LIKE

ILIKE 操作符;但它们缺乏现代信息系统所要求的许多必要属性。这些缺憾可以通过使用索
引及词典进行解决。
文本检索缺乏信息系统所要求的必要属性:

没有语义支持,即使是英语。
由于要识别派生词并不是那么容易,因此正则表达式也不能满足要求。如,satisfies
和satisfy,当使用正则表达式寻找satisfy 时,并不会查询到包含satisfies 的文档。用户可以
使用OR 搜索多种派生形式,但过程非常繁琐。并且有些词会有上千的派生词,因此容易出
错。

没有对搜索结果的分类(排序)
。当搜索出成千的文档时,查找效率很低。

由于没有索引的支持,每一次的搜索需要遍历所有的文档,整体搜索比较缓慢。
使用全文索引可以对文档进行预处理,
并且可以使后续的搜索更快速。
预处理过程包括:

将文档解析成token。
为每个文档标记不同类别的token 是非常有必要的,例如:数字、文字、复合词、电子
邮件地址,这样就可以做不同的处理。原则上token 的类别依赖于具体的应
用,但对于大
多数的应用来说,可以使用一组预定义的token 类。

将token 转换为词素。
词素像token 一样是一个字符串,但它已经标准化处理,这样同一个词的不同形式是一
样的。例如,标准化通常包括:将大写字母折成小写字母、删除后缀(如英语中的s 或者
es)

这将允许通过搜索找到同一个词的不同形式,
不需要繁琐地输入所有可能的变形样式。

GBase 8c SQL 参考手册
南大通用数据技术股份有限公司
626
同时,这一步通常会删除停用词。这些停用词通常因为太常见而对搜索无用。
(总之,token
是文档文本的原片段,而词素被认为是有用的索引和搜索词。
)GBase 8c 使用词典执行这
一步,且提供了各种标准的词典。

保存搜索优化后的预处理文档。
比如,每个文档可以呈现为标准化词素的有序组合。伴随词素,
通常还需要存储词素位
置信息以用于邻近排序。因此文档包含的查询词越密集其排序越高。
词典能够对token 如何标准化做到细粒度控制。使用合适的词典,可以定义不被索引的
停用词。
数据类型tsvector 用于存储预处理文档,
tsquery 用于存储查询条件,
详细请参见16.3.10
文本搜索类型。为这些数据类型提供的函数和操作符请参见16.5.12 文本检索函数和操作
符。其中最重要的是匹配运算符@@,将在16.8.1.3 基本文本匹配中介绍。