TSContainerPoolRoundRobin 函数提供循环策略以将时间系列数据插入到指定容器池中的容器。
TSContainerPoolRoundRobin( table_name lvarchar, column_name lvarchar, subtype lvarchar, irregular integer, pool_name lvarchar) returns lvarchar;
使用 TSContainerPoolRoundRobin 函数可选择要插入指定容器池中的时间系列数据的容器。容器池必须存在,您才能向其插入数据,并且容器池中必须至少有一个容器配置为与插入的数据使用相同的 TimeSeries 子类型。将 TSContainerPoolRoundRobin 函数设置为容器池名称,并将其用作 INSERT 语句的 VALUES 子句中 container 参数的值。TSContainerPoolRoundRobin 函数按照循环顺序将容器名称返回到 INSERT 语句。
用于存储时间系列值的容器名称。
以下语句将数据插入到时间系列中。TSContainerPoolRoundRobin 函数指定将容器池 readings 用于 container 参数中。
INSERT INTO smartmeters(meter_id,rawreadings) VALUES('met00001','origin(2006-01-01 00:00:00.00000), calendar(smartmeter),regular,threshold(0), container(TSContainerPoolRoundRobin(readings)), [(33070,-13.00,100.00,9.98e+34), (19347,-4.00,100.00,1.007e+35), (17782,-18.00,100.00,9.83e+34)]');
当 INSERT 语句运行时,TSContainerPoolRoundRobin 函数使用以下值运行:
TSContainerPoolRoundRobin('smartmeters','rawreadings', 'smartmeter_row',0,'readings')
TSContainerPoolRoundRobin 函数按字母顺序排列容器名称,并将第一个容器名称返回到 INSERT 语句。下次 INSERT 语句运行时,TSContainerPoolRoundRobin 函数将返回第二个容器名称,依此类推。