You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[root@localhost ~]# time clickhouse-client --query="INSERT INTO atomic.LINEITEM FORMAT TabSeparated" < /home/pg/clickhouse/lineitem.csv
real 17m50.733s
user 20m4.970s
sys 0m5.692s
[root@localhost ~]# ls -alh /home/pg/clickhouse/lineitem.csv
-rw-r--r--. 1 pg postgres 17G Feb 17 16:01 /home/pg/clickhouse/lineitem.csv
Inserting 1TB shouldn't be a problem. But in your case performance is indeed suspiciously low: ~16MB/s (should be ~100MB/s), and as the output of time suggests, the client is the bottleneck. Could you provide some info on the specs of the machine you are running this on?
The server cluster has 128GB RAM and 40x cores (3x shards with 3x node replicas).
These files were taking between 2 - 8 seconds to load with 10,000,000 rows. After inserting 923,765,380 clickhouse-client is timing out after 300 seconds - have I hit some limit?
I started seeing similar issues when changing to a set of partition columns that created several hundred to a few thousand partitions instead of one per day - partitioning on the primary key to reduce query times. One possible solution is to use a lower cardinality partition scheme.
I cannot reproduce timeouts while loading huge CSV through clickhouse-client. Tested with 600 GB CSV file.
For lineorder table from "star schema benchmark", ClickHouse can parse about 1.5 million rows per second (170 MB/sec) on single decent CPU core - that's definitely not slow.
@alexey-milovidov - apologies, how very rude of me to not follow up on my previous comment after resolving the issue 😄 For the sake of completeness, I'll write it down here so perhaps it can help someone else in future.
The problem I was facing was actually due to the files having RANDOM dates... this was because I was generating test data to simulate "real world" load but the oversight was that I was using random dates stretching across hundreds of years all within each file being loaded. I would start with an empty database but in a very short timeframe I had generated thousands of "date" partitions... each row in the CSV had to be put into a different partition and this was killing performance (as a side note we have 3x replicas for each shard located in different continents which is also "not recommended" in terms of performance however it is a business requirement for us).
After using more "real world" test data and later production data ClickHouse started behaving as expected 😂and I'm also glad to say we've had ClickHouse loading CSVs in production for several months and reading the results via MySQL Protocol through ProxySQL without any hiccups!
We are aware that it's very easy to create too many partitions. We are thinking about how we can avoid this issue from the usability perspective. (For example, the user can by mistake create partitioning schema with one partition per second of input data - then the filesystem quickly becomes totally unusable.)
Activity
ztlpn commentedon Mar 1, 2017
You can try splitting the file into several smaller files and inserting them in parallel. This should speedup insertion somewhat.
vavrusa commentedon Mar 2, 2017
You can break it by parts and insert in parallel.
sangli00 commentedon Mar 3, 2017
@ztlpn
If i insert 1TB data to Clickhouse,How to do it?
ztlpn commentedon Mar 3, 2017
Inserting 1TB shouldn't be a problem. But in your case performance is indeed suspiciously low: ~16MB/s (should be ~100MB/s), and as the output of
timesuggests, the client is the bottleneck. Could you provide some info on the specs of the machine you are running this on?sangli00 commentedon Mar 4, 2017
@ztlpn If i used Native interface and parallel write to ClicHouse is OK?
pondix commentedon Nov 29, 2017
I seem to be having a similar issue, here are the details:
Details of the CSV being loaded:
The server cluster has 128GB RAM and 40x cores (3x shards with 3x node replicas).
These files were taking between 2 - 8 seconds to load with 10,000,000 rows. After inserting 923,765,380 clickhouse-client is timing out after 300 seconds - have I hit some limit?
kmatt commentedon Nov 16, 2018
I started seeing similar issues when changing to a set of partition columns that created several hundred to a few thousand partitions instead of one per day - partitioning on the primary key to reduce query times. One possible solution is to use a lower cardinality partition scheme.
alexey-milovidov commentedon Jan 26, 2019
I cannot reproduce timeouts while loading huge CSV through clickhouse-client. Tested with 600 GB CSV file.
For
lineordertable from "star schema benchmark", ClickHouse can parse about 1.5 million rows per second (170 MB/sec) on single decent CPU core - that's definitely not slow.pondix commentedon Jan 27, 2019
@alexey-milovidov - apologies, how very rude of me to not follow up on my previous comment after resolving the issue 😄 For the sake of completeness, I'll write it down here so perhaps it can help someone else in future.
The problem I was facing was actually due to the files having RANDOM dates... this was because I was generating test data to simulate "real world" load but the oversight was that I was using random dates stretching across hundreds of years all within each file being loaded. I would start with an empty database but in a very short timeframe I had generated thousands of "date" partitions... each row in the CSV had to be put into a different partition and this was killing performance (as a side note we have 3x replicas for each shard located in different continents which is also "not recommended" in terms of performance however it is a business requirement for us).
After using more "real world" test data and later production data ClickHouse started behaving as expected 😂and I'm also glad to say we've had ClickHouse loading CSVs in production for several months and reading the results via MySQL Protocol through ProxySQL without any hiccups!
alexey-milovidov commentedon Jan 27, 2019
Thank you for the follow up!
We are aware that it's very easy to create too many partitions. We are thinking about how we can avoid this issue from the usability perspective. (For example, the user can by mistake create partitioning schema with one partition per second of input data - then the filesystem quickly becomes totally unusable.)
Merge pull request ClickHouse#538 from Altinity/24.8_ci_buddy-do-not-…
Bump `zxc` from 0.14.0 to 1.0.0