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
In the clickbench Datafusion is currently ~5x slower than DuckDB on comparable machine. I think it would make sense to update the benchmark results with the latest improvements so that datafusion will be a viable/reasonable option for new projects
Reacted by Mehmet Ozan Kabak
Reacted by zhenxing jiang, Andy Grove, Ian Alexander Joiner and Rich
I think this is something we should do as soon as possible. We should not needlessly create a false impression of "slow" in the eyes of the community at large. Why try to correct it later when we can avoid it?
Our benchmark was not run on a comparable machine, and it is a very old version. I suggest we run it on c6a.metal, 500gb gp2 (that's the machine the majority is gravitating towards) with our current version. After that, we can identify which queries we are slow at, investigate the reasons and improve.
We (the Synnada team) is happy to help with investigations and take on improvement tasks.
Reacted by Andy Grove, Daniël Heres, dudzicp and r.4ntix
I wasn't really too involved with this. I have been focussing more on TPC-H and TPC-DS, and I also see DuckDB performing about 5x faster than DataFusion. I have not spent time determining why this is the case yet.
The latest results are here. This is yet another half-finished project of mine, so I apologize for the lack of configuration info. I am mostly running with default configs.
The current result listed in the website was benchmarked by datafusion v11, which was release around 6 months ago.
to imporve:
1. use datafusion v18 to rerun the benchmark codes and send the PR. t
2. at the time I wrote the benchmark codes, datafusion didnt support some features. e.g. it didn't support schema from parquet, so for some data type like timestamp, we need to load it as string and then cast it to timestamp explicitly. e.g.
this is the original sql queries
SELECT URLHash, EventDate, COUNT(*) AS PageViews FROM ...
I did modify some quries so that it works in datafusion. To fix this, we need to verify whether the new datafusion work or not. If so we could update the quries. If not, we could fire the issue to improve
I'll do the first option soon (update to v18), it should be a quick improvement.
It'll take more time to do the second approach. Welcome for the contribution. I'll get back to this if there's no one work on this.
SELECT"RegionID", SUM("AdvEngineID"), COUNT(*) AS c, AVG("ResolutionWidth"), COUNT(DISTINCT "UserID") FROM hits GROUP BY"RegionID"ORDER BY c DESCLIMIT10;
i have no clue for now, perhaps due to DISTINCT @alamb@tustvold@comphead do you have any idea for this?
Query 28: 18.859884645982497 -> almost 20 times better
SELECT REGEXP_REPLACE("Referer", '^https?://(?:www\.)?([^/]+)/.*$', '\1') AS k, AVG(length("Referer")) AS l, COUNT(*) AS c, MIN("Referer") FROM hits WHERE"Referer"<>''GROUP BY k HAVINGCOUNT(*) >100000ORDER BY l DESCLIMIT25;
i think this is benifit from the improvement of regexp_replace
Query 32: query doesn't work
SELECT"WatchID", "ClientIP", COUNT(*) AS c, SUM("IsRefresh"), AVG("ResolutionWidth") FROM hits GROUP BY"WatchID", "ClientIP"ORDER BY c DESCLIMIT10;
when i run it, it's killed (same as the previous version)
willy@willybench:~/ClickBench/datafusion$ datafusion-cli -f create.sql q33.sql
DataFusion CLI v18.0.0
0 rows in set. Query took 0.039 seconds.
Killed
With results from @andygrove being consistent with clickbench (~5x difference compared to duckdb), I think it make more sense to focus more on profiling to narrow the gap, rather than re running the benchmarks. Also when running the benchmarks, make sure you enable important config options mentioned by @korowa: #5142 (comment)
SELECT "RegionID", SUM("AdvEngineID"), COUNT(*) AS c, AVG("ResolutionWidth"), COUNT(DISTINCT "UserID") FROM hits GROUP BY "RegionID" ORDER BY c DESC LIMIT 10;
i have no clue for now, perhaps due to DISTINCT @alamb@tustvold@comphead do you have any idea for this?
@waitingkuo I can try to experiment if this is due to distinct.
Reacted by Mehmet Ozan Kabak, Wei-Ting Kuo, dudzicp and Andrew Lamb
@waitingkuo, I have a few quick questions: (1) Which machine did your new results run on, is it the same machine? (2) Which features are missing to run the queries as is?
# Download benchmark target data
wget --continue https://datasets.clickhouse.com/hits_compatible/hits.parquet
# launch datafusion-cli
datafusion-cli
DataFusion CLI v18.0.0
> CREATE EXTERNAL TABLE hits STORED AS PARQUET LOCATION 'hits.parquet';> SELECT "RegionID", SUM("AdvEngineID"), COUNT(*) AS c, AVG("ResolutionWidth"), COUNT(DISTINCT "UserID") FROM hits GROUP BY "RegionID" ORDER BY c DESC LIMIT 10;
to run the full benchmark, you could do bash benchmark.sh which contains
install latest datafusion
download benchmark dataset
execute 3 times per query
it take around 20-30 minutes for me for a full benchmark generation
AFAIK one big difference regarding performance is that most other engines in the clickbench suite first load the data into memory or some other internal format, while datafusion scans directly from the parquet files. Extending the benchmark runner to support both use cases and report separate results would be very useful. The tcph benchmark runner for example has such a feature
some system like duckdb or clickbench does provide two kinds of setting. e.g.
the original comparison @dudzicp posted is to compare duckdb(parquet) with datafusion. I think it's fair enough. Perhaps we could rename datafusion to datafusion(parquet) so that other people could easily understanding what they're comparing. (btw, we can judge it by loading time and datasize as well)
Perhaps we could rename datafusion to datafusion(parquet) so that other people could easily understanding what they're comparing. (btw, we can judge it by loading time and datasize as well)
I think this would be very helpful. Yes I think we should be only comparing datafusion performance to parquet files
The last suggestion might be better for running in a non-distributed execution, the current rule is better optimized for distributed execution (as shuffling data might be expensive), so if we get some improvements there, we'll need to make that configurable.
I've re-run the benchmark on a c6a.4xlarge instance similar to the other stateless engines in the benchmark. Submitted it here -> ClickHouse/ClickBench#81 . For nearly all requests, it performs significantly better, but I wonder if that's due in large part to the datafusion.optimizer.repartitioning_file_scans by default that was committed yesterday.
Reacted by Mehmet Ozan Kabak, Andy Grove, Andrew Lamb and Rich
I guess @alamb is correct and grouping/aggregation code needs improvements.
That's right, duckdb has very impressive grouping/aggregation improvements. Details in blog.
ClickBench is almost for grouping/aggregation and high cardinality distinct, so If datafusion wants to have better performance in this bench, it must need a high-performance hashtable which suits for OLAP queries.
Reacted by Andrew Lamb, dudzicp, baishen, xudong.w and Rich
The benchmark though should add parallelism by repartitioning after scanning - so I would expect aggregates to be executed in parallel (even though the scan won't be).
I recently look at Datafusion vs DuckDB for our use cases and one of our evaluation queries is a variant of ClickBench q23.
Datafusion v19.rc1: 12s
DuckDB v0.6.1: 0.6s (20x faster)
it aligns with "scan is not in parallel yet"? More detail here: #5404
I am thinking to rename the result from Datafusion (single) to DataFusion (single parquet). So it is more aligned with DuckDB (parquet) and Clickhouse-local (single). Thoughts ❓
SELECT "RegionID", SUM("AdvEngineID"), COUNT(*) AS c, AVG("ResolutionWidth"), COUNT(DISTINCT "UserID") FROM hits GROUP BY "RegionID" ORDER BY c DESC LIMIT 10;
I also create an issue for the non-working q32: #5969
SELECT "WatchID", "ClientIP", COUNT(*) AS c, SUM("IsRefresh"), AVG("ResolutionWidth") FROM hits GROUP BY "WatchID", "ClientIP" ORDER BY c DESC LIMIT 10
Activity
ozankabak commentedon Feb 14, 2023
I think this is something we should do as soon as possible. We should not needlessly create a false impression of "slow" in the eyes of the community at large. Why try to correct it later when we can avoid it?
Our benchmark was not run on a comparable machine, and it is a very old version. I suggest we run it on
c6a.metal, 500gb gp2(that's the machine the majority is gravitating towards) with our current version. After that, we can identify which queries we are slow at, investigate the reasons and improve.We (the Synnada team) is happy to help with investigations and take on improvement tasks.
alamb commentedon Feb 14, 2023
I agree this would be great to do. @waitingkuo and @andygrove have worked on this in the past and perhaps they have thoughts.
andygrove commentedon Feb 15, 2023
I wasn't really too involved with this. I have been focussing more on TPC-H and TPC-DS, and I also see DuckDB performing about 5x faster than DataFusion. I have not spent time determining why this is the case yet.
The latest results are here. This is yet another half-finished project of mine, so I apologize for the lack of configuration info. I am mostly running with default configs.
https://sqlbenchmarks.io/sqlbench-h/results/env/workstation/sf10/single_node/
waitingkuo commentedon Feb 15, 2023
the codes to reproduce the benchmark are here https://github.com/ClickHouse/ClickBench/tree/main/datafusion
The way to update the data in the clickbench website is to update the json file in the results folder and send a PR https://github.com/ClickHouse/ClickBench/tree/main/datafusion/results
The current result listed in the website was benchmarked by datafusion v11, which was release around 6 months ago.
to imporve:
1. use datafusion v18 to rerun the benchmark codes and send the PR. t
2. at the time I wrote the benchmark codes, datafusion didnt support some features. e.g. it didn't support schema from parquet, so for some data type like timestamp, we need to load it as string and then cast it to timestamp explicitly. e.g.
this is the original sql queries
https://github.com/ClickHouse/ClickBench/blob/main/duckdb-parquet/queries.sql#L41
this is the modified version for datafusion
https://github.com/ClickHouse/ClickBench/blob/main/datafusion/queries.sql#L41
I did modify some quries so that it works in datafusion. To fix this, we need to verify whether the new datafusion work or not. If so we could update the quries. If not, we could fire the issue to improve
I'll do the first option soon (update to v18), it should be a quick improvement.
It'll take more time to do the second approach. Welcome for the contribution. I'll get back to this if there's no one work on this.
ozankabak commentedon Feb 15, 2023
@waitingkuo, if you create the issues that identify what is required to run the queries properly, we can help with addressing them.
waitingkuo commentedon Feb 15, 2023
@ozankabak thank you, i'll submit another ticket to do so.
I just submit the pr to update it to v18
ClickHouse/ClickBench#77
here's the summary:
1 of the query get 20 times boost
1 of the query remain 0.1 times performance
1 of the query still not working
except from these 3 outliers, we have 20% improvement in average
the histogram chart

x axis means:
old execution time / new execution timethe larger the more improvement, 1.0 means no changehere's the result query by query
outlier queries:
Query 9: 0.09891081294396213 -> 10 times worse
i have no clue for now, perhaps due to
DISTINCT@alamb @tustvold @comphead do you have any idea for this?
Query 28: 18.859884645982497 -> almost 20 times better
i think this is benifit from the improvement of
regexp_replaceQuery 32: query doesn't work
when i run it, it's killed (same as the previous version)
dudzicp commentedon Feb 15, 2023
With results from @andygrove being consistent with clickbench (~5x difference compared to duckdb), I think it make more sense to focus more on profiling to narrow the gap, rather than re running the benchmarks. Also when running the benchmarks, make sure you enable important config options mentioned by @korowa: #5142 (comment)
comphead commentedon Feb 15, 2023
@waitingkuo I can try to experiment if this is due to distinct.
ozankabak commentedon Feb 15, 2023
@waitingkuo, I have a few quick questions: (1) Which machine did your new results run on, is it the same machine? (2) Which features are missing to run the queries as is?
waitingkuo commentedon Feb 15, 2023
@ozankabak i used azure's Standard_F16s_v2 vm to do so which has 16 vcpu and 32GB memory
https://learn.microsoft.com/en-us/azure/virtual-machines/fsv2-series
i didnt looks into the issue that the process killed yet. my quick guess is that it runs out of memory
waitingkuo commentedon Feb 15, 2023
@comphead thank you
the quickest way is pull clickbench github repo and go tho this folder
https://github.com/ClickHouse/ClickBench/tree/main/datafusion
and then
to run the full benchmark, you could do
bash benchmark.shwhich containsit take around 20-30 minutes for me for a full benchmark generation
jhorstmann commentedon Feb 16, 2023
AFAIK one big difference regarding performance is that most other engines in the clickbench suite first load the data into memory or some other internal format, while datafusion scans directly from the parquet files. Extending the benchmark runner to support both use cases and report separate results would be very useful. The tcph benchmark runner for example has such a feature
waitingkuo commentedon Feb 16, 2023
@jhorstmann thank you for pointing out this
some system like duckdb or clickbench does provide two kinds of setting. e.g.

the original comparison @dudzicp posted is to compare duckdb(parquet) with datafusion. I think it's fair enough. Perhaps we could rename datafusion to datafusion(parquet) so that other people could easily understanding what they're comparing. (btw, we can judge it by loading time and datasize as well)
alamb commentedon Feb 16, 2023
I think this would be very helpful. Yes I think we should be only comparing datafusion performance to parquet files
11 remaining items
Dandandan commentedon Feb 17, 2023
The last suggestion might be better for running in a non-distributed execution, the current rule is better optimized for distributed execution (as shuffling data might be expensive), so if we get some improvements there, we'll need to make that configurable.
alamb commentedon Feb 18, 2023
This is one of the last areas I think there are factors of 2 or more performance to be extracted given the current architecture 👍
kmitchener commentedon Feb 21, 2023
I've re-run the benchmark on a c6a.4xlarge instance similar to the other stateless engines in the benchmark. Submitted it here -> ClickHouse/ClickBench#81 . For nearly all requests, it performs significantly better, but I wonder if that's due in large part to the
datafusion.optimizer.repartitioning_file_scansby default that was committed yesterday.alamb commentedon Feb 23, 2023
It would not at all surprise me
Thank you @kmitchener
sundy-li commentedon Feb 23, 2023
That's right, duckdb has very impressive grouping/aggregation improvements. Details in blog.
ClickBench is almost for
grouping/aggregationandhigh cardinality distinct, so If datafusion wants to have better performance in this bench, it must need a high-performance hashtable which suits for OLAP queries.jychen7 commentedon Feb 26, 2023
I recently look at Datafusion vs DuckDB for our use cases and one of our evaluation queries is a variant of ClickBench q23.
it aligns with "scan is not in parallel yet"? More detail here: #5404
alamb commentedon Mar 10, 2023
Filed #5547 to track improving COUNT DISTINCT query performance
[-]Update benchmmarks on clickbench[/-][+]Update benchmarks on clickbench[/+]jychen7 commentedon Apr 11, 2023
I just run a benchmark on Datafusion v22 (use default setting): ClickHouse/ClickBench#97.
I am thinking to rename the result from
Datafusion (single)toDataFusion (single parquet). So it is more aligned withDuckDB (parquet)andClickhouse-local (single). Thoughts ❓jychen7 commentedon Apr 11, 2023
🥂 cheers that #5325 fix the regression on
q9I also create an issue for the non-working q32: #5969
Summary of queries that is 2x slower than DuckDB
#3516
comphead commentedon Apr 12, 2023
@jychen7 glad to hear #5325 fixed
for #5969 are you running with artifact built in
releasemode?jychen7 commentedon Apr 12, 2023
yes, it is release mode. For detail, can refer to 'benchmark.sh' in https://github.com/ClickHouse/ClickBench/pull/97/files.
btw, q32 not working is a known problem. I didn't find related github issue, so create #5969 to track it
alamb commentedon Jul 12, 2023
I expect DataFusion 28 to perform much better (and q32 now works) due to #6904
alamb commentedon Jul 27, 2023
I filed #7108 to track updating the clickbench benchmarks again, let's continue the conversation there. Closing this ticket