Tuning Guide for Joins in SQL Queries
- Dominant language
- Rust
- Stars
- 9.3k
- Forks
- 2.4k
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 344
Description
### Is your feature request related to a problem or challenge?
It would be great to add an example under `datafusion-examples` to illustrate the following:
1. Default Planning and Optimization Strategy
- What is the default strategy for planning and optimizing queries with joins: How does the engine decide the physical join type (e.g., sort-merge join vs. hash join)?
- How is the join order determined?
Introducing the high-level internal optimization strategy can help users better understand and perform their own optimizations.
2. Example Queries and EXPLAIN Output
- Provide example queries and show how the default policies optimize them.
- Explain how to interpret the output of the `EXPLAIN` statement.
3. Relevant Configuration Settings
Include explanation for the related configurations (note that some settings might not yet be supported in DF):
- If multiple physical join types are applicable, how can a user disable or prefer a specific join type?
(e.g., for a simple inner join with equality conditions, how to force a Nested Loop Join in the execution plan)
- How to override the join order?
(e.g., the optimizer chooses `t1`, `t3`, `t2` but the user prefers `t1`, `t2`, `t3`)
- Any other relevant configuration options.
### Describe the solution you'd like
_No response_
### Describe alternatives you've considered
_No response_
### Additional context
_No response_
Contributor guide
Research direction
Start in the `datafusion-examples` directory and review existing query and EXPLAIN examples. Document the default join planning and ordering behavior, relevant configuration settings and limitations, and representative SQL queries with their EXPLAIN output. Done means the example explains how users can understand and tune join plans.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, sql
- Domain
- databases, documentation
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100