This blog post discusses memoization - a technique that allows cost-based optimizers to consider billions of alternative plans.

Query optimization is an expensive process that needs to explore multiple alternative ways to execute the query. The query optimization problem is NP-hard, and the number of possible plans grows exponentially with the query’s complexity. For example, a typical TPC-H query may have up to several thousand possible join orders, 2–3 algorithms per join, a couple of access methods per table, some filter/aggregate pushdown alternatives, etc. Combined, this could quickly explode the search space to millions of alternative plans.

This blog post will discuss memoization — an important technique that allows cost-based optimizers to consider billions of alternative plans in a reasonable time.

#database #sql #query optimization #query engine #apache calcite #query optimizer #database analysis

Memoization in Cost-based Optimizers
1.20 GEEK