# The new cost-based join optimizer with reordering support for non-inner joins

DevFeed: [The new cost-based join optimizer with reordering support for non-inner joins](<https://devfeed.tech/articles/the-new-cost-based-join-optimizer-with-reordering-support-for-non-inner-joins-105721.md>)

Original publisher: [Read original article](<https://clickhouse.com/blog/the-new-cost-based-join-optimizer-with-reordering-support-for-non-inner-joins>)

Author: Fisnik Kastrati

Published: 2026-10-28T14:12:53Z

Content type: article

Language: en

Sources: [ClickHouse Blog](<https://devfeed.tech/sources/clickhouse-blog.md>)

Topics: [JOIN](<https://devfeed.tech/topics/join.md>), [Test-driven development](<https://devfeed.tech/topics/tdd.md>)

Tags: [000](<https://devfeed.tech/tags/000.md>), [17](<https://devfeed.tech/tags/17.md>), [2](<https://devfeed.tech/tags/2.md>), [2013](<https://devfeed.tech/tags/2013.md>), [3](<https://devfeed.tech/tags/3.md>), [about](<https://devfeed.tech/tags/about.md>), [actions](<https://devfeed.tech/tags/actions.md>), [algorithm](<https://devfeed.tech/tags/algorithm.md>), [algorithms](<https://devfeed.tech/tags/algorithms.md>), [all](<https://devfeed.tech/tags/all.md>), [based](<https://devfeed.tech/tags/based.md>), [clickhouse](<https://devfeed.tech/tags/clickhouse.md>), [cost](<https://devfeed.tech/tags/cost.md>), [exhaustive](<https://devfeed.tech/tags/exhaustive.md>), [join](<https://devfeed.tech/tags/join.md>), [plan](<https://devfeed.tech/tags/plan.md>), [safely](<https://devfeed.tech/tags/safely.md>), [semi](<https://devfeed.tech/tags/semi.md>), [support](<https://devfeed.tech/tags/support.md>), [with](<https://devfeed.tech/tags/with.md>)

## AI overview

ClickHouse's DPsub cost-based join optimizer can reorder inner, left/right/full outer, semi, and anti joins while preserving query results. A conflict detector uses join types, predicate references, and NULL behavior to reject invalid regroupings and admit valid ones; the article reports exhaustive validation with 2.8 million core plans, no invalid or missing plans, plus zero mismatches across 1,200 fuzzed queries. DPsub searches exhaustively up to 12 tables, though the default limit is 10; larger joins fall back to the greedy optimizer. The optimizer becomes the default in ClickHouse 26.10, with settings to select the algorithm and disable conflict detection.

## Source excerpt

ClickHouse's new exhaustive cost-based join optimizer safely reorders inner, outer, semi, and anti joins to find the cheapest valid plan.