返回首页

gbase数据、南大通用产品文档:GBase8a避免超大结果集的直接返回

更新日期:2024年09月11日

对于查询结果集达到1 万以上,尤其是百万、千万的结果集,应避免结果集的直
接返回,将原始select 修改为insert select,即将查询结果插入到一个结果表中或
者在客户端输出时要加-q 参数。

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

智能索引
..........................................
10

打开捕获会话并创建会话ID。将在会话的syscdcses 表中插入一行。
语法:
cdc_opensess
(
"
server_name
"
,
session_ID
,
timeout
, max_recs
,
major_version
, minor_version
)
参数:
表2-6.cdc_opensess() 参数
参数
数据类型
描述
server_name
LVARCHAR
The name of the server. Must be
the server to which the client
application that is calling the
cdc_opensess() function is
connected.
session_ID
INTEGER
Must be 0.
timeout
INTEGER
Specifies the timeout behavior
of a read call on the captured
data:
<0
Do not timeout.
1.
Return immediately if
no data is available.
2.
or more
The number of seconds to
wait for data before
timing out.

GBase 8s数据库安装手册
南大通用数据技术股份有限公司
17
max_recs
INTEGER
The maximum number of CDC
records to return per read
function call. This value takes
precedence over the maximum
number of bytes to return that is
specified in the smart large
object read function.
major_version
INTEGER
The major version number of the
Change Data Capture API. Must be
1.
minor_version
INTEGER
The minor version number of the
Change Data Capture API.
Must be 1 for new applications.
Can be 0 for existing
applications.
用法:
使用cdc_opensess() 函数打开客户端应用程序和数据库服务器之间的通
信会话。cdc_opensess() 返回的会话ID 是提供给智能大对象读取函数的智能
大对象文件描述符。要开始捕获数据,必须使用cdc_activatesess() 函数和
cdc_ startcapture() 函数。
必须从客户端应用程序调用此函数。不能从数据库服务器中运行的用户定
义例程调用此函数。
注意:
如果您有多个应用程序使用变更数据捕获API 并连接到同一GBase 8s
服务器,则所有应用程序必须使用相同的major_version 和minor_versiion 参
数值。
返回值:
如果成功,则返回作为会话ID 的整数。
如果不成功,则返回与错误代码对应的整数。

GBase 8s数据库安装手册
南大通用数据技术股份有限公司
18