以下為MSDN的說明:
出處:Advanced Query Tuning Concepts
SQL Server employs three types of join operations:
If the two join inputs are not small but are sorted on their join column (for example, if they were obtained by scanning sorted indexes), a merge join is the fastest join operation. If both join inputs are large and the two inputs are of similar sizes, a merge join with prior sorting and a hash join offer similar performance. However, hash join operations are often much faster if the two input sizes differ sihttps://www.blogger.com/blogger.g?blogID=3153720234527010496#editor/target=post;postID=2111640605181692195gnificantly from each other. For more information, see Understanding Merge Joins.
Hash joins can efficiently process large, unsorted, nonindexed inputs. They are useful for intermediate results in complex queries because:
這邊有大陸高手中文說明,有範例
看懂SqlServer查询计划
- Nested loops joins
- Merge joins
- Hash joins
If the two join inputs are not small but are sorted on their join column (for example, if they were obtained by scanning sorted indexes), a merge join is the fastest join operation. If both join inputs are large and the two inputs are of similar sizes, a merge join with prior sorting and a hash join offer similar performance. However, hash join operations are often much faster if the two input sizes differ sihttps://www.blogger.com/blogger.g?blogID=3153720234527010496#editor/target=post;postID=2111640605181692195gnificantly from each other. For more information, see Understanding Merge Joins.
Hash joins can efficiently process large, unsorted, nonindexed inputs. They are useful for intermediate results in complex queries because:
- Intermediate results are not indexed (unless explicitly saved to disk and then indexed) and often are not suitably sorted for the next operation in the query plan.
- Query optimizers estimate only intermediate result sizes. Because estimates can be very inaccurate for complex queries, algorithms to process intermediate results not only must be efficient, but also must degrade gracefully if an intermediate result turns out to be much larger than anticipated.
這邊有大陸高手中文說明,有範例
看懂SqlServer查询计划
沒有留言:
張貼留言