dolphindb中用back备份时报错:relevant to the query is too large

我执行备份的代码如下:

login("admin", "123456")
backupDir="F:/Data/backup"
backup(backupDir, <select * from loadTable("dfs://db1", "trades1")>, true)

表trades1是一个分区表,所涉及的分区也比较多,大约10W个左右,但是报错了,错误信息如下:

The number of partitions [10] relevant to the query is too large. Please add more specific filtering conditions on partition columns in WHERE clause, or consider changing the value of the configuration parameter maxPartitionNumPerQuery.

请先 登录 后评论

1 个回答

chenweijian

这里的问题是执行select * from loadTable("dfs://db1", "trades1")涉及的分区太多了,dolphindb中有一个参数maxPartitionNumPerQuery,限制了每一个query涉及的分区数,默认值是65536。

解决方案:
1.将maxPartitionNumPerQuery的值修改得大一点,满足当前的查询。单机single版在server目录下的dolphindb.cfg中修改,集群cluster在server目录下的config目录下的cluster.cfg中修改。

2.按分区,分批备份,可以在select * from loadTable("dfs://db1", "trades1")中加入where条件,限制每一批备份的分区数目。

dolphindb中的backup函数是以分区为单位,备份分布式表的数据。返回一个整数,表示备份成功的分区数量。

dolphindb中的,migrate函数用于恢复数据库中已备份的数据。

请先 登录 后评论