返回首页

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

更新日期:2024年09月11日

用户登录
在浏览器中输入统一监控网站地址,如:
http://[ip]:[port]/gcmonitor,进入用户登录界面,如下图所示:

图 错误!文档中没有指定样式的文字。-1 登录界面
输入用户名、密码后(默认admin:admin),单击回车或者点击“登录”
按钮,系统将进行用户校验,如果用户名和密码校验正确,则进入统一监控主
界面;否则提示错误信息:登录失败,请检查用户名和密码!

搜索表
在不使用索引的情况下也可以进行全文检索。

一个简单查询:将body 字段中包含america 的每一行打印出来。
gbase=#DROP SCHEMA IF EXISTS tsearch CASCADE;
gbase=#CREATE SCHEMA tsearch;
gbase=#CREATE TABLE tsearch.pgweb(id int, body text, title text, last_mod_date
date);
gbase=#INSERT INTO tsearch.pgweb VALUES(1, 'China, officially the People''s
Republic of China (PRC), located in Asia, is the world''s most populous state.',
'China', '2010-1-1');
gbase=#INSERT INTO tsearch.pgweb VALUES(2, 'America is a rock band, formed in
England in 1970 by multi-instrumentalists Dewey Bunnell, Dan Peek, and Gerry
Beckley.', 'America', '2010-1-1');
gbase=#INSERT INTO tsearch.pgweb VALUES(3, 'England is a country that is part of
the United Kingdom. It shares land borders with Scotland to the north and Wales
to the west.', 'England',
'2010-1-1');

GBase 8c SQL 参考手册
南大通用数据技术股份有限公司
630
gbase=#INSERT INTO tsearch.pgweb VALUES(4, 'Australia, officially the
Commonwealth of Australia, is a country comprising the mainland of the Australian
continent, the island of Tasmania, and numerous smaller islands.', 'Australia',
'2010-1-1');
gbase=#INSERT INTO tsearch.pgweb VALUES(5, 'Russia, also officially known as the
Russian Federation, is a sovereign state in northern Eurasia.', 'Russia',
'2010-1-1');
gbase=#INSERT INTO tsearch.pgweb VALUES(6, 'Japan is an island country in East
Asia.', 'Japan', '2010-1-1');
gbase=#INSERT INTO tsearch.pgweb VALUES(7, 'Germany, officially the Federal
Republic of Germany, is a sovereign state and federal parliamentary republic in
central-western Europe.', 'Germany', '2010-1-1');
gbase=#INSERT INTO tsearch.pgweb VALUES(8, 'France, is a sovereign state
comprising territory in western Europe and several overseas regions and
territories.', 'France', '2010-1-1');
gbase=#INSERT INTO tsearch.pgweb VALUES(9, 'Italy officially the Italian Republic,
is a unitary parliamentary republic in Europe.', 'Italy', '2010-1-1');
gbase=#INSERT INTO tsearch.pgweb VALUES(10, 'India, officially the Republic of
India, is a country in South Asia.', 'India', '2010-1-1');
gbase=#INSERT INTO tsearch.pgweb VALUES(11, 'Brazil, officially the Federative
Republic of Brazil, is the largest country in both South America and Latin
America.', 'Brazil', '2010-1-1');
gbase=#INSERT INTO tsearch.pgweb VALUES(12, 'Canada is a country in the northern
half of North America.', 'Canada', '2010-1-1');
gbase=#INSERT INTO tsearch.pgweb VALUES(13, 'Mexico, officially the United
Mexican States, is a federal republic in the southern part of North America.',
'Mexico', '2010-1-1');
gbase=#SELECT id, body, title FROM tsearch.pgweb WHERE to_tsvector('english',
body) @@ to_tsquery('english', 'america');
id |
body
| title

GBase 8c SQL 参考手册
南大通用数据技术股份有限公司
631
----
+----------------------------------------------------------------------------
-----------------------------------------
----+---------
2 | America is a rock band, formed in England in 1970 by multi-instrumentalists
Dewey Bunnell, Dan Peek, and Gerry Beckley. | America
12| Canada is a country in the northern half of North America. | Canada
13| Mexico, officially the United Mexican States, is a federal republic in the
southern part of North America.
| Mexico
11 | Brazil, officially the Federative Republic of Brazil, is the largest country
in both South America and Latin America. | Brazil
(4 rows)
像America 这样的相关词也会被找到,因为这些词都被处理成了相同标准的词条。
上面的查询指定english 配置来解析和规范化字符串。当然也可以省略此配置,通过
default_text_search_config 进行配置设置:
gbase=#SHOW default_text_search_config; default_text_search_config
----------------------------
pg_catalog.english (1 row)
gbase=#SELECT id, body, title FROM tsearch.pgweb WHERE to_tsvector(body) @@
to_tsquery('america');
id |
body
| title
|
+----------------------------------------------------------------------------
-----------------------------------------
----+---------
11 | Brazil, officially the Federative Republic of Brazil, is the largest country
in both South America and Latin America. | Brazil
2 | America is a rock band, formed in England in 1970 by multi-instrumentalists
Dewey Bunnell, Dan Peek, and Gerry Beckley. | America
12| Canada is a country in the northern half of North America. | Canada
13| Mexico, officially the United Mexican States, is a federal republic in the
southern part of North America.
| Mexico
(4 rows)

一个复杂查询:
检索出在title 或者body 字段中包含north 和america 的最近10 篇文档:
gbase=#SELECT title FROM tsearch.pgweb WHERE to_tsvector(title || ' ' || body)
@@ to_tsquery('north & america') ORDER BY last_mod_date DESC LIMIT 10;
title
--------

GBase 8c SQL 参考手册
南大通用数据技术股份有限公司
632
Mexico Canada (2 rows)
为了清晰,举例中没有调用coalesce 函数在两个字段中查找包含NULL 的行。
以上例子均在没有索引的情况下进行查询。对于大多数应用程序来说,这个方法很慢。
因此除了偶尔的特定搜索,文本搜索在实际使用中通常需要创建索引。

表 5-16 具体信息如下:
CHARACTER_SETS
字符集表,提供了实例中可使用的字符集信息,show character set 结
果取自此表
COLLATIONS
提供了关于各字符集的对照信息
COLLATION_CHARA
CTER_SET_APPLICA
BILITY
指明了可用于校对的字符集,等效于show collation 的前两个字段
COLUMNS
提供了表中的列信息,show columns from schemaname.tablename 的结
果取于此

GBase UP 产品手册 5 数据库管理指南
文档版本04(2021-04-21) 南大通用数据技术股份有限公司 296
COLUMN_PRIVILEG
ES
列权限表,给出关于列权限的信息。
ENGINES
关于引擎的信息
EVENTS
时间触发器,在特定时间点触发相关sql 语句或存储过程,区别于事
件触发器(trigger)
FILES
用来存储表空间(tablespace)数据的文件相关信息
GLOBAL_STATUS
系统全局的状态信息
GLOBAL_VARIABLE
S
全局变量的变量名及变量值
KEY_COLUMN_USA
GE
描述了具有约束的键列
PLUGINS
插件信息,是一张非标准表
PROCESSLIST
一个客户端连接的信息,show processlist 命令取于此
PROFILING
sql 语句执行的资源消耗信息,打开profiling 参数:set profiling=1
ROUTINES
提供了关于存储子程序(存储程序和函数)的信息。routines 表不包含
自定义函数(UDF)
COORDINATORS_TA
SK_INFORMATION
记录所有coordinator 节点的task 信息
GNODES_TASK_INF
ORMATION
记录所有node 节点的task 信息
COORDINATORS_RE
SOURCE_POOL_USA
GE
记录所有coordinator 节点的资源池实时使用情况,
包括等待任务数量,
运行任务数量等
GNODES_RESOURCE
_POOL_USAGE
记录单机层的资源池实时使用情况,包括CPU,内存,磁盘的使用信

GNODES_USER_DIS
KSPACE_USAGE
记录用户磁盘配额的使用情况,包括用户限定磁盘空间,用户实际使
用磁盘空间等
COORDINATORS_RE
SOURCE_POOL_STAT
US
记录集群层的资源池历史使用情况,包括已服务任务数量,任务平均
运行时间,任务平均等待时间等
GNODES_RESOURCE
_POOL_STATUS
记录单机层的资源池历史使用情况,包括CPU,内存,磁盘的使用信

RESOURCE_POOL_E
VENTS
记录集群层资源池event 信息

GBase UP 产品手册 5 数据库管理指南
文档版本04(2021-04-21) 南大通用数据技术股份有限公司 297
COORDINATOR_RES
OURCE_POOL_USAG
E
记录当前coordinator 节点的资源池实时使用情况,
包括等待任务数量,
运行任务数量等
SCHEMATA
提供当前实例中所有数据库的信息,show databases 的结果获取此表
SCHEMA_PRIVILEGE
S
数据库限表,给出了有关数据库权限的信息。
SESSION_STATUS
当前session 的状态信息
SESSION_VARIABLE
S
当前session 的变量名及变量值
STATISTICS
提供了关于表索引的信息,show index from schemaname.tablename 的
结果取于此
TABLES
提供关于数据库中表的信息(含视图),详细描述了某张表属于哪个
库,表类型,表引擎,创建时间等,show tables from schemaname 的
结果取于此
TABLE_CONSTRAIN
TS
描述了存在约束的表,以及表的约束类型
TABLE_PRIVILEGES
表权限表
TRIGGERS
提供了关于触发程序的信息,必须有super 权限才能查看该表
USER_PRIVILEGES
用户权限表,给出了关于全程权限的信息
LOAD_STATUS
用于查询加载进度的系统表
LOAD_TRACE
加载错误日志信息,当前coordinator 节点
CLUSTER_LOAD_TR
ACE
加载错误日志信息,所有coordinator 节点
LOAD_RESULT
加载结果信息,当前coordinator 节点
CLUSTER_LOAD_RE
SULT
加载结果信息,所有coordinator 节点
VIEWS
给出了关于数据库中的视图的信息,需要有show views 权限,否则无
法查看视图信息
PRIORITIES
优先级状态显示(与cgroup、优先级队列有关)
TABLE_LOCKS
用于显示当前表锁的使用情况
MEMORY_HEAP_INF
O
内存中各个堆的信息
CACHE_ACCESS_INF
O
select/insert/update 操作对内存的访问情况,delete/show 操作表中值不
改变,gbased 重启表中值归零
CLUSTER_TABLES
存储的信息为表占用的磁盘空间

GBase UP 产品手册 5 数据库管理指南
文档版本04(2021-04-21) 南大通用数据技术股份有限公司 298
CLUSTER_TABLE_SE
GMENTS
存储的信息为事务型consumer task 的运行状态
KAFKA_CONSUMER
_STATUS
存储的信息为事务型consumer task 的运行状态
KAFKA_CONSUMER
_EFFICIENCY
存储的信息为事务型consumer task 的运行效率,
包含了各个环节的耗
时统计
KAFKA_LOADER_C
ONSUMER_STATUS
存储的信息为加载型consumer task 的运行状态
SYS_SCN
system change number
DML_INFO
DML 操作的信息
ALL_ENCRYPTION_
CERTIFICATE_STATU
S
所有节点当前加密状态信息
COORDINATOR_ENC
RYPTION_CERTIFICA
TE_STATUS
集群层当前加密状态信息
GNODE_ENCRYPTIO
N_CERTIFICATE_STA
TUS
所有node 点当前加密状态信息
ENCRYPTION_CERTI
FICATE_STATUS
单机本地当前加密状态信息