snowflakedb / snowflakedb/snowpark-python
Performance Improvement Preview: Duplicate Subquery Elimination
@sfc-gh-jdu is already working on this.
Since May 16, 2024.
- Dominant language
- Python
- Stars
- 341
- Forks
- 155
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 27
Description
Hi all,
We have an exciting query performance optimization released with Snowpark Python v1.15.0, and we're looking for testing it with production workloads. This optimization will convert duplicate subqueries to CTEs automatically and reduce both query compilation and computation time. We would encourage you to try out this experimental feature if you
- use the same Snowpark DataFrame multiple times to build another DataFrame in your workloads, e.g.
df = ...
df1 = df.filter(col("a") == 1)
df2 = df.with_column("c", lit(1))
df3 = df1.join(df2)
OR
- previously have manually used df.cache_result() to improve the performance by saving the intermediate result.
Feel free to try this optimization by setting
session.cte_optimization_enabled = True
at the beginning of code (then no cache_result() is needed), and watch the performance.
If you have any questions, feel free to reach out to me via jianzhun.du@snowflake.com or comment under this issue directly. Any input is appreciated!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.