ClickHouse-每个查询插入一百多个条目

时间:2019-05-17 13:35:58

标签: clickhouse

我不知道如何增加每个查询的最大条目数。我想为每个查询插入一千个条目,默认值为100。

根据the doc,参数max_partitions_per_insert_block定义了同时登录的限制。

我尝试从ClickHouse客户端进行修改,但是插入仍然失败:

$ clickhouse-client
my-virtual-machine :) set max_partitions_per_insert_block=1000

*SET* max_partitions_per_insert_block = 1000

Ok.

0 rows in set. Elapsed: 0.001 sec. 

此外,max_partitions_per_insert_block文件中没有/etc/clickhouse-server/config.xml字段。

在修改max_partitions_per_insert_block之后,我尝试插入数据,但是我被这个错误困住了:

infi.clickhouse_orm.database.ServerError: Code: 252, e.displayText() = DB::Exception: Too many partitions for single INSERT block (more than 100). 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 19.5.3.8 (official build))

编辑:我仍然坚持使用。我什至无法使用SET max_partitions_per_insert_block = 1000手动将参数设置为所需的值:更改了该值,但是在退出并重新打开clickhouse-client之后(即使使用sudo,该参数又返回了100,所以它看起来不像权限问题)。

2 个答案:

答案 0 :(得分:0)

我在再次阅读文档,尤其是this document时发现了这一点。我已经在web表中看到的system.settings个人资料设置中识别出。我只是尝试在默认配置文件中插入以下内容,然后重新加载,然后插入一千个条目:<max_partitions_per_insert_block>1000</max_partitions_per_insert_block>

我想这对于某些人来说是显而易见的,但对于没有经验的人来说可能不是。

答案 1 :(得分:0)

您很有可能应该更改分区方案。每个分区在文件系统上生成几个文件,这可能导致操作系统中断。此外,这可能是长期合并的原因。