Postgresql 如何启动TimescaleDB压缩作业?
我已经将大量历史数据加载到timescaledb表中Postgresql 如何启动TimescaleDB压缩作业?,postgresql,timescaledb,Postgresql,Timescaledb,我已经将大量历史数据加载到timescaledb表中 创建表引号( “时间”时间戳为空, symbol_id int4 NULL, “打开”数字(14,6)空, “关闭”数字(14,6)NULL, 高数值(14,6)空, 低数值(14,6)NULL, 卷int8 NULL, 约束引号\u ts\u pkey主键(符号\u id,“时间”) ); 选择create_hypertable('quotes','time','symbol_id',1,create_default_index=>fals
创建表引号(
“时间”时间戳为空,
symbol_id int4 NULL,
“打开”数字(14,6)空,
“关闭”数字(14,6)NULL,
高数值(14,6)空,
低数值(14,6)NULL,
卷int8 NULL,
约束引号\u ts\u pkey主键(符号\u id,“时间”)
);
选择create_hypertable('quotes','time','symbol_id',1,create_default_index=>false);
更改表引号集(
timescaledb.compress,
timescaledb.compress\u segmentby='symbol\u id'
);
选择添加压缩块策略(“引号”,间隔“7天”);
之后,我将数据插入表中:
插入引号(“时间”,数据_id,“打开”,“关闭”,高,低,音量)
选择“时间”,符号_id,“打开”,“关闭”,高,低,音量
来自source_schema.quotes;
我看到了哪些数据没有被压缩
SELECT*FROM timescaledb\u information.compressed\u chunk\u stats
按压缩状态、超表格名称、区块名称排序;
此外,我还可以选择包含必须压缩的旧数据的块(这是我的期望)
选择show_chunks('quotes',早于=>INTERVAL'7天');
如果我尝试压缩块,效果会很好:
选择压缩区块(“U timescaledb\U internal.\u hyper\u 1\u 59\u区块”);
但是如何启动内部timescaledb作业,以便根据指定的策略自动压缩块?对于任何超过7天的块,“选择添加压缩块策略('quotes',间隔'7天');”应启动该自动过程。(也就是说,区块的结尾必须大于等于7天。)
您还可以查看压缩数据或后台工作任务的信息视图:
不能确切地从您提供的信息中确定为什么看不到压缩数据。在slack.timescale.com上的社区slack频道上帮助调试可能更容易。干杯 谢谢,这很有帮助:
SELECT*FROM timescaledb\u information.policy\u stats;选择更改作业计划(1000,下一步开始=>'2020-07-03 17:34:00.0+00')代码>查找作业id随TSDB v2更改。它现在是从timescaledb_information.job_stats中选择*;设备id、计数、时间如果我添加的压缩策略超过7天,是否意味着我仍然可以在这7天之前进行插入、删除和更新?