alamb commented on issue #18909:
URL: https://github.com/apache/datafusion/issues/18909#issuecomment-3572864231
# Metadata caching study
Given the way the scripts run, the metadata cache is not used for each run.
I confirmed that metadata caching makes a pretty significant difference by
"prewarming" the cache by adding `select count(*) from hits;` to create.sql.
```shell
diff --git a/datafusion-partitioned/create.sql
b/datafusion-partitioned/create.sql
index 3b3330c1..a01baa64 100644
--- a/datafusion-partitioned/create.sql
+++ b/datafusion-partitioned/create.sql
@@ -2,3 +2,5 @@ CREATE EXTERNAL TABLE hits
STORED AS PARQUET
LOCATION 'partitioned'
OPTIONS ('binary_as_string' 'true');
+-- prewarm metadata cache
+select count(*) from hits;
diff --git a/datafusion-partitioned/run.sh b/datafusion-partitioned/run.sh
index 0c5ed184..74bcb0c2 100755
--- a/datafusion-partitioned/run.sh
+++ b/datafusion-partitioned/run.sh
@@ -11,11 +11,11 @@ cat queries.sql | while read -r query; do
echo -n "["
for i in $(seq 1 $TRIES); do
- # 1. there will be two query result, one for creating table another
for executing the select statement
- # 2. each query contains a "Query took xxx seconds", we just grep
these 2 lines
- # 3. use sed to take the second line
+ # 1. there will be three query result, one for creating table, one
to load metadata cache, and another for executing the select statement
+ # 2. each query contains a "Query took xxx seconds", we just grep
these 3 lines
+ # 3. use sed to take the third line
# 4. use awk to take the number we want
- RES=$(datafusion-cli -f create.sql /tmp/query.sql 2>&1 | grep
"Elapsed" |sed -n 2p | awk '{ print $2 }')
+ RES=$(datafusion-cli -f create.sql /tmp/query.sql 2>&1 | grep
"Elapsed" |sed -n 3p | awk '{ print $2 }')
[[ $RES != "" ]] && \
echo -n "$RES" || \
echo -n "null"
```
Making this change results in a 20% benchmark improvement for DataFusion 51
on c6a.4xlarge
<img width="1172" height="1307" alt="Image"
src="https://github.com/user-attachments/assets/b51218a7-3463-4fe4-b28c-5c785523a866"
/>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]