v.20.3New Feature

Switch to MergeJoin if necessary

Switch from HashJoin to MergeJoin (on disk) if needed #9082 (Artem Zuikov)
Introduces an automatic switch from HashJoin to MergeJoin (on disk) in ClickHouse when necessary.

Why it matters

This feature improves query reliability and resource management by enabling ClickHouse to switch to the MergeJoin algorithm on disk when the HashJoin cannot be used effectively, such as with large datasets that do not fit into memory. It ensures joins can still be performed without failure or excessive memory usage.

How to use it

The switch from HashJoin to MergeJoin occurs automatically when required. Users do not need to perform any manual configuration to enable this behavior; it is integrated into the query execution engine to handle large joins more efficiently.