返回首页

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

更新日期:2024年09月11日

GCITerminate
函数原型:
sword GCITerminate ( ub4 mode)

功能描述:

从共享内存子系统中分离(仅用于和Oracle 保持兼容)
参数说明:
mode(输入)
保留参数,目前不使用(仅用于和Oracle 保持兼容)
返回值:

如果执行成功,返回GCI_SUCCESS,否则返回GCI_ERROR


gs_index_advise(text)
描述:针对单条查询语句推荐索引。
参数:SQL 语句字符串
返回值类型:record
示例:
gbase=# select "table", "column" from gs_index_advise('SELECT c_discount from
bmsql_customer where c_w_id = 10');
table
|
column
----------------+----------
bmsql_customer | c_w_id
(1 row)
上述结果表明:应当在bmsql_customer 的c_w_id 列上创建索引。例如可以通过下述
SQL 语句创建索引:
gbase=# CREATE INDEX idx on bmsql_customer(c_w_id);
某些SQL 语句,也可能被推荐创建联合索引,例如:

GBase 8c SQL 参考手册
南大通用数据技术股份有限公司
567
gbase=# select "table", "column" from gs_index_advise('select name, age, sex from
t1 where age >= 18 and age < 35 and sex = ''f'';');
table | column
-------+------------
t1
| age, sex
(1 row)
则上述语句表明应该在表t1 上创建一个联合索引(age, sex)。
可以通过下述命令创建:
gbase=# CREATE INDEX idx1 on t1(age, sex);
针对分区表可推荐具体索引类型,例如:
gbase=# select "table", "column", "indextype" from gs_index_advise('select name,
age, sex from range_table where age = 20;');
table | column | indextype
-------+--------+-----------
t1
| age
| global
(1 row)

hypopg_create_index(text)
描述:创建虚拟索引。
参数:创建索引语句的字符串
返回值类型:record
示例:
gbase=# select * from hypopg_create_index('create index on
bmsql_customer(c_w_id)');
indexrelid |
indexname
------------+-------------------------------------
329726 | <329726>btree_bmsql_customer_c_w_id
(1 row)

hypopg_display_index()
描述:显示所有创建的虚拟索引信息。
参数:无
返回值类型:record
示例:
gbase=# select * from hypopg_display_index();

GBase 8c SQL 参考手册
南大通用数据技术股份有限公司
568
indexname
| indexrelid |
table
|
column
--------------------------------------------+------------+----------------+--
----------------
<329726>btree_bmsql_customer_c_w_id
|
329726 | bmsql_customer |
(c_w_id)
<329729>btree_bmsql_customer_c_d_id_c_w_id |
329729 | bmsql_customer |
(c_d_id, c_w_id)
(2 rows)

hypopg_drop_index(oid)
描述:删除指定的虚拟索引。
参数:索引的oid
返回值类型:bool
示例:
gbase=# select * from hypopg_drop_index(329726);
hypopg_drop_index
-------------------
t
(1 row)

hypopg_reset_index()
描述:清除所有虚拟索引。
参数:无
返回值类型:无
示例:
gbase=# select * from hypopg_reset_index();
hypopg_reset_index
--------------------
(1 row)

hypopg_estimate_size(oid)

GBase 8c SQL 参考手册
南大通用数据技术股份有限公司
569
描述:估计指定索引创建所需的空间大小。
参数:索引的oid
返回值类型:int8
示例:
gbase=# select * from hypopg_estimate_size(329730);
hypopg_estimate_size
----------------------
15687680
(1 row)

check_engine_status(ip text, port text)
描述:测试给定的ip 和port 上是否有predictor engine 提供服务。
参数:predictor engine 的ip 地址和端口号。
返回值类型:text

encode_plan_node(optname text, orientation text, strategy text, options text, dop int8, quals
text, projection text)
描述:对入参的计划算子信息进行编码。
参数:计划算子信息。
返回值类型:text。
该函数为内部功能调用函数,不建议用户直接使用。

model_train_opt(template text, model text)
描述:训练给定的查询性能预测模型。
参数:性能预测模型的模板名和模型名。
返回值类型:tartup_time_accuracy FLOAT8 、
total_time_accuracy FLOAT8 、
rows_accuracy FLOAT8、peak_memory_accuracy FLOAT8

GBase 8c SQL 参考手册
南大通用数据技术股份有限公司
570

track_model_train_opt(ip text, port text)
描述:返回给定ip 和port predictor engine 的训练日志地址。
参数:predictor engine 的ip 地址和端口号。
返回值类型:text

encode_feature_perf_hist(datname text)
描述:将目标数据库已收集的历史计划算子进行编码。
参数:数据库名。
返回值类型:queryid bigint、plan_node_id int、parent_node_id int、left_child_id int、
right_child_id int, encode text 、
startup_time bigint 、
total_time bigint 、
rows bigint 、
peak_memory int

gather_encoding_info(datname text)
描述:调用encode_feature_perf_hist,将编码好的数据进行持久化保存。
参数:数据库名。
返回值类型:int

db4ai_predict_by_bool (text, VARIADIC “any”)
描述:获取返回值为布尔型的模型进行模型推断任务。
此函数为内部调用函数,建议直
接使用语法PREDICT BY 进行推断任务。
参数:模型名称和推断任务的输入列。
返回值类型:bool

db4ai_predict_by_float4(text, VARIADIC “any”)
描述:获取返回值为float4 的模型进行模型推断任务。此函数为内部调用函数,建议直
接使用语法PREDICT BY 进行推断任务。
参数:模型名称和推断任务的输入列。

GBase 8c SQL 参考手册
南大通用数据技术股份有限公司
571
返回值类型:float

db4ai_predict_by_float8(text, VARIADIC “any”)
描述:获取返回值为float8 的模型进行模型推断任务。此函数为内部调用函数,建议直
接使用语法PREDICT BY 进行推断任务。
参数:模型名称和推断任务的输入列。
返回值类型:float

db4ai_predict_by_int32(text, VARIADIC “any”)
描述:获取返回值为int32 的模型进行模型推断任务。此函数为内部调用函数,建议直
接使用语法PREDICT BY 进行推断任务。
参数:模型名称和推断任务的输入列。
返回值类型:int

db4ai_predict_by_int64(text, VARIADIC “any”)
描述:获取返回值为int64 的模型进行模型推断任务。此函数为内部调用函数,建议直
接使用语法PREDICT BY 进行推断任务。
参数:模型名称和推断任务的输入列。
返回值类型:int

db4ai_predict_by_numeric(text, VARIADIC “any”)
描述:获取返回值为numeric 的模型进行模型推断任务。此函数为内部调用函数,建议
直接使用语法PREDICT BY 进行推断任务。
参数:模型名称和推断任务的输入列。
返回值类型:numeric

db4ai_predict_by_text(text, VARIADIC “any”)
描述:获取返回值为字符型的模型进行模型推断任务。
此函数为内部调用函数,建议直

GBase 8c SQL 参考手册
南大通用数据技术股份有限公司
572
接使用语法PREDICT BY 进行推断任务。
参数:模型名称和推断任务的输入列。
返回值类型:text

db4ai_predict_by_float8_array(text, VARIADIC “any”)
描述:获取返回值为字符型的模型进行模型推断任务。
此函数为内部调用函数,建议直
接使用语法PREDICT BY 进行推断任务。
参数:模型名称和推断任务的输入列。
返回值类型:text

gs_explain_model(text)
描述:获取返回值为字符型的模型进行模型解析文本化任务。
参数:模型名称。
返回值类型:text

GBA-02DR-0024

GBase 8a MPP Cluster 产品手册
7 附录
文档版本953(2022-04-10)
南大通用数据技术股份有限公司
1660
错误码
错误标识
错误信息
GBA-02DR-0024

Gcluster
read
%s
table
error
on
node %s
错误出现原因
查询集群层gclusterdb.nodedatamap 出错
分析与建议
查看日志,找到出错节点,查看集群层gclusterdb.nodedatamap 是否正常