clickhouse jdbc报错:Too many partitions for single INSERT block (more than 100)

本文解决了一个在使用ClickHouse时常见的问题:在通过JDBC插入数据时遇到“Too many partitions for single INSERT block”错误。问题源于使用了包含超过100个分区值的字段作为分区键。文章详细解释了ClickHouse对分区数量的限制及其原因,并提出了调整分区策略以避免此问题的方法。

通过clickhouse官方jdbc写入时报错:Too many partitions for single INSERT block (more than 100)
解决:
调整了建表时PARTITION BY分区字段,因为是从hive里读的,所以直接用了hive分区的值: PARTITION BY dt,之前用的add_time字段做分区:toYYYYMMDD(toDateTime(add_time, 'Asia/Shanghai')),这个字段在同一批次写入里包括大于100个分区值,clickhouse认为这样会存在性能问题,抛出异常:

The limit is controlled by 'max_partitions_per_insert_block' setting. Large number of 
partitions is a common misconception. It will lead to severe negative performance impact, 
including slow server startup, slow INSERT queries and slow SELECT queries. 
Recommended total number of partitions for a table is under 1000..10000. Please note,
that partitioning is not intended to speed up SELECT queries (ORDER BY key is sufficient
to make range queries fast). Partitions are intended for data manipulation (DROP
 PARTITION, etc). (version 20.2.1.2183 (official build))
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值