postgresql - Timescaledb:保留策略不会从超表中删除数据

标签 postgresql timescaledb

(注意:我也将其作为 github 问题发布 https://github.com/timescale/timescaledb/issues/3653 )

我有一个配置了 24 小时保留策略的超表 request_logs。保留策略被标记为成功运行,但表中没有旧数据被删除。该表继续日益增长。

我检查了 postgresql 日志文件,没有发现任何错误。

可以使用有关在何处查找信息来解决此问题的附加指南。

request_logs表结构

  \d+ request_logs;
  Table "public.request_logs"
Column   |           Type           | Collation | Nullable | Default | Storage | Stats target | Description 
-----------+--------------------------+-----------+----------+---------+---------+--------------+-------------
time      | timestamp with time zone |           | not null |         | plain   |              | 
referer   | bigint                   |           |          |         | plain   |              | 
useragent | bigint                   |           |          |         | plain   |              | 
Indexes:
"request_logs_time_idx" btree ("time" DESC)
Triggers:
ts_insert_blocker BEFORE INSERT ON request_logs FOR EACH ROW EXECUTE FUNCTION _timescaledb_internal.insert_blocker()
Child tables: _timescaledb_internal._hyper_1_37_chunk,
_timescaledb_internal._hyper_1_38_chunk,
_timescaledb_internal._hyper_1_40_chunk
Access method: heap

这是通过运行 select * from _timescaledb_catalog.hypertable; 检索的超表描述;

 id | schema_name |  table_name  | associated_schema_name | associated_table_prefix | num_dimensions | chunk_sizing_func_schema |  chunk_sizing_func_name  | chunk_target_size | compression_state | compressed_hypertable_id | replication_factor 
----+-------------+--------------+------------------------+-------------------------+----------------+--------------------------+--------------------------+-------------------+-------------------+--------------------------+--------------------
  1 | public      | request_logs | _timescaledb_internal  | _hyper_1                |              1 | _timescaledb_internal    | calculate_chunk_interval |                 0 |                 0 |                          |                   
(1 row)

这是通过运行SELECT * FROM timescaledb_information.job_stats;检索的retention_policy。

 hypertable_schema | hypertable_name | job_id |      last_run_started_at      |    last_successful_finish     | last_run_status | job_status | last_run_duration |          next_start           | total_runs | total_successes | total_failures 
-------------------+-----------------+--------+-------------------------------+-------------------------------+-----------------+------------+-------------------+-------------------------------+------------+-----------------+----------------
 public            | request_logs    |   1002 | 2021-10-05 23:59:01.601404+00 | 2021-10-05 23:59:01.638441+00 | Success         | Scheduled  | 00:00:00.037037   | 2021-10-06 23:59:01.638441+00 |          8 |               8 |              0
                   |                 |      1 | 2021-10-05 08:38:20.473945+00 | 2021-10-05 08:38:21.153468+00 | Success         | Scheduled  | 00:00:00.679523   | 2021-10-06 08:38:21.153468+00 |         45 |              45 |              0
(2 rows)

相关系统信息:

最佳答案

看起来这可能与 TimescaleDB 2.4.2 版本中修复的错误有关。 GitHub 报告已更新,如果您发现升级后问题仍然存在,请使用您的示例更新 GitHub 上的问题。感谢您的举报! 透明度:我为 Timescale 工作

关于postgresql - Timescaledb:保留策略不会从超表中删除数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69458707/

相关文章:

prometheus-alertmanager - Alertmanager 按标签过滤(时间刻度后端)

java - 尝试使用 Apache Ni-Fi 通过 SSL 连接到 Timescale Cloud 时出错

linux - 在从 Windows 托管数据库集群创建的 Linux 上恢复 pg_basebackup

regex - 不要提取错误的子串/数字

php - 如何让 Laravel Join 返回这样的数据?

sql - Postgresql 交叉表替代方案

postgresql - 将 Postgres 9.6 继承表迁移到 TimeScaleDB

PostgreSQL 可变表达式和子查询

用于查找 friend 签到的 SQL 查询

postgresql - 将 Postgresql 表迁移到 timescale 数据库