Drag to orbit ยท leaves = tables ยท height = join order
โš  Couldn't load the 3D engineThree.js failed to load from the CDN. Check your connection and reload.

Query Optimizer: Join-Order Cost Search

Behind every multi-table SQL query, the database's cost-based optimizer has to pick which order to join the tables in โ€” the same result set can cost 100ร— more or less depending on the order chosen. This simulation runs the real dynamic-programming algorithm that engines like PostgreSQL use (in the spirit of IBM's System R optimizer): it solves every subset of the query's tables exactly once, caching the cheapest way to build each subset from smaller pieces, and reconstructs the winning plan as a 3D join tree. Switch between a nested-loop and a hash-join cost model to see how the optimal order changes, and compare it against a naive left-deep plan that just joins tables in the order they were written to see exactly what a real optimizer buys you.