🧪 Optimization Database Optimization Simulation
Interactive cost-based query optimizer: watch a System R-style dynamic-programming search pick the cheapest join order for a multi-table SQL query, rendered as a 3D join-plan tree, with a nested-loop vs hash-join cost model and a naive left-deep comparison.
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.
This simulation demonstrates techniques for optimizing database performance through indexing, query optimization, and data modeling strategies.
2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install