-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sql: adjust physical planning heuristics around small joins
Previously, whenever we had a hash or a merge join with at least one equality column (i.e. not a cross join), we would force the distribution of the plan. This can be suboptimal when we need to process a small number of rows. This commit makes the heuristic a bit more configurable: we now will choose to distribute only when performing a "large" join, where "large" is defined as having both inputs produce at least 1k rows (configured via new `distribute_join_row_count_threshold` session variable). If both inputs don't have stats available, we fall back to the old behavior of distributing the plan (which seems like a safer option). Note the following operations still force the plan distribution unconditionally: - table statistics - inverted filter (when we have a union of inverted spans) - inverted join - window functions with at least one window frame with PARTITION BY clause - zigzag join. I think there are cases where we don't want to force the distribution because of these operations, but they seem less of a concern, so I left a few TODOs. Ideally, eventually we'll have the optimizer make the decision. Release note (sql change): DistSQL physical planning decisions under `distsql=auto` mode have been adjusted in the following manner: presence of the hash or merge join no longer forces the plan to be distributed. Namely, we might not choose to distribute the plan if both inputs to the join are expected produce small number of rows (less than 1k combined by default, configurable via `distribute_join_row_count_threshold` session variable).
- Loading branch information
1 parent
2899e77
commit 9ab2996
Showing
13 changed files
with
162 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.