Query optimizer is at the heart of the database systems. Cost-based optimizer studied in this paper is adopted in almost all current database systems. A cost-based optimizer introduces a plan enumeration algorithm to find a (sub)plan, and then uses a cost model to obtain the cost of that plan, and selects the plan with the lowest cost. In the cost model, cardinality, the number of tuples through an operator, plays a crucial role. Due to the inaccuracy in cardinality estimation, errors in cost...
2022-07-12 20:05:16 651KB 数据库 DBMS 优化器
1
总览 该项目是我的一个沙箱和游乐场,用于试验创意和Spark SQL的潜在改进。 它包括: 一种将小型SQL方言解析为未解决的逻辑计划的解析器 语义分析器,可将未解决的逻辑计划解析为已解决的逻辑计划 一个查询优化器,可将解析的查询计划优化为等效但性能更高的查询计划 查询计划程序,可将(优化的)逻辑计划转换为可执行的物理计划 目前,Spear仅适用于本地Scala集合。 建立 建筑矛很简单: $ ./build/sbt package 运行REPL Spear有一个基于Ammonite的REPL,用于交互式实验。 要启动它: $ ./build/sbt spear-repl/run 让我们创建一个简单的数字数据框: @ context range 10 show () ╒══╕ │id│ ├──┤ │ 0│ │ 1│ │ 2│ │ 3│ │ 4│ │ 5│ │ 6│ │ 7│ │ 8│ │ 9│ ╘══╛ 使用DataFrame API的示例查询: @ context. range( 10 ). select( 'id as 'key , (rand( 4
2021-01-30 23:04:23 184KB sql query-optimizer SQLScala
1