QuestDB Exception--ERROR: Cannot insert rows out of order.

﹏ヽ暗。殇╰゛Y 2024-04-07 11:36 90阅读 0赞

我正在尝试将数据迁移到 QuestDB 并插入历史记录,我将表创建为

  1. create table records(
  2. type INT,
  3. interval INT,
  4. timestamp TIMESTAMP,
  5. name STRING) timestamp(timestamp)

并通过JDBC 插入数据。

一、问题详情

我收到错误“无法乱序插入行”。我读到 QuestDB 支持乱序,但不知何故我无法让它工作。

  1. Caused by: org.postgresql.util.PSQLException: ERROR: Cannot insert rows out of order. Table=/root/.questdb/db/dwd_robot_running_data
  2. at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2674)
  3. at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2364)
  4. ... 19 more

二、问题原因

只能在分区表上乱序插入行,创建新的分区表并将数据复制到其中

三、解决方案

建表时添加分区

  1. create table records2(
  2. type INT,
  3. interval INT,
  4. timestamp TIMESTAMP,
  5. name STRING
  6. )
  7. timestamp(timestamp) partition by DAY
  8. insert into records2
  9. select * from records
  10. drop table records
  11. rename table records2 to records

在此之后,就可以将乱序插入到表记录中

发表评论

表情:
评论列表 (有 0 条评论,90人围观)

还没有评论,来说两句吧...

相关阅读