数据仓库服务 GAUSSDB(DWS)-函数和表达式:get_timeline_count_internal(schema_name text, rel_name text)

时间:2024-07-13 11:25:01

get_timeline_count_internal(schema_name text, rel_name text)

函数用于获取时序表在当前DN节点上tag表的行数,只能在DN节点上使用。

参数名

类型

描述

Required/Option

schema_name

text

时序表所属schema的名称。

Required

rel_name

text

时序表的表名。

Required

示例:

创建表,并且插入数据:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
CREATE TABLE IF NOT EXISTS CPU(
scope_name text TSTag,
server_ip text TSTag,
group_path text TSTag,
time timestamptz TSTime,
idle numeric TSField
) with (orientation=TIMESERIES) distribute by hash(scope_name);
insert into CPU values('dcxtataetaeta','10.145.255.33','saetataetaeta','2020-04-07 17:12:09+08',  60639);
insert into CPU values('wrhtataetaeta','10.145.255.33','saetataetaeta','2020-04-07 17:12:09+08',  53311);
insert into CPU values('saetataetaeta','10.145.255.33','saetataetaeta','2020-04-07 17:12:09+08',  27101);
insert into CPU values('saetataetaeta','10.145.255.33','saetataetaeta','2020-04-07 17:12:09+08',  48005);

数据从delta表进入CU后,连接DN节点,执行该函数:

1
2
3
4
5
select get_timeline_count_internal('public', 'cpu');
get_timeline_count_internal
-----------------------------
2
(1 row)

support.huaweicloud.com/IoT-devg830-dws/dws_14_00007.html