报错:The number of partitions [xxxx] relevant to the query is too large.

在查询数据时发现报错: The number of partitions [274000] 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.

请问该报错产生的原因是分区粒度过细嘛?我建库建表参考的是教程中的代码:https://docs.dolphindb.cn/zh/tutorials/best_practices_for_partitioned_storage.html
参考的这个里面的逐笔委托(沪深合并)的方式:

//建库代码    
create database "dfs://stock_tick"
partitioned by VALUE(2020.01.01..2035.01.01), HASH([SYMBOL, 50]),
engine='TSDB',
atomic='TRANS',
chunkGranularity='TABLE'
//建表代码
create table "dfs://stock_tick"."tick_data" (
 code SYMBOL[comment="股票代码"],
 market INT[comment="市场代码"],
 date DATE[comment="交易日期",compress="delta"],
 time TIME[comment="时间戳",compress="delta"],
 close FLOAT[comment="最新价"],
 close_rate FLOAT[comment="涨跌幅"],
 up_down FLOAT[comment="涨跌额"],
 vol_ratio FLOAT[comment="量比"]
)
partitioned by _"date",_"code"
sortColumns=["market","code","time"],
keepDuplicates=LAST
请先 登录 后评论

1 个回答

Polly

报错信息指示性很明显,如果您的分区大小是合理的,就无需对分区数进行调整。可以尝试修改配置项 maxPartitionNumPerQuery(单机版在 dolphindb.cfg 集群在 cluster.cfg),修改后重启集群生效;查询通常不会读取全部分区的数据,可以通过 WHERE 语句有条件的筛选。

请先 登录 后评论