我正在尝试将数据迁移到 QuestDB 并插入历史记录,我将表创建为
create table records(
type INT,
interval INT,
timestamp TIMESTAMP,
name STRING) timestamp(timestamp)
并通过JDBC 插入数据。
一、问题详情
我收到错误“无法乱序插入行”。我读到 QuestDB 支持乱序,但不知何故我无法让它工作。
Caused by: org.postgresql.util.PSQLException: ERROR: Cannot insert rows out of order. Table=/root/.questdb/db/dwd_robot_running_data
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2674)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2364)
... 19 more
二、问题原因
只能在分区表上乱序插入行,创建新的分区表并将数据复制到其中
三、解决方案
建表时添加分区
create table records2(
type INT,
interval INT,
timestamp TIMESTAMP,
name STRING
)
timestamp(timestamp) partition by DAY
insert into records2
select * from records
drop table records
rename table records2 to records
在此之后,就可以将乱序插入到表记录中
在尝试将数据迁移到QuestDB并进行乱序插入时遇到错误。QuestDB通常支持乱序插入,但该情况可能由于未使用分区表导致。解决方案是创建一个按时间戳分区的表,将数据复制到新表,然后删除原始表并重命名新表。通过这种方式,可以实现乱序插入。
1648

被折叠的 条评论
为什么被折叠?



