MiniOB
1
MiniOB is one mini database, helping developers to learn how database works.
载入中...
搜索中...
未找到
src
observer
sql
optimizer
cascade
optimizer.h
1
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
2
miniob is licensed under Mulan PSL v2.
3
You can use this software according to the terms and conditions of the Mulan PSL v2.
4
You may obtain a copy of Mulan PSL v2 at:
5
http://license.coscl.org.cn/MulanPSL2
6
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
7
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
8
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
9
See the Mulan PSL v2 for more details. */
10
11
#pragma once
12
13
#include "sql/optimizer/cascade/pending_tasks.h"
14
#include "sql/optimizer/cascade/optimizer_context.h"
15
#include "sql/operator/physical_operator.h"
16
#include "sql/optimizer/cascade/property_set.h"
17
22
class
Optimizer
23
{
24
public
:
25
Optimizer
() : context_(std::make_unique<OptimizerContext>()) {}
26
27
std::unique_ptr<PhysicalOperator> optimize(
OperatorNode
*op_tree);
28
29
std::unique_ptr<PhysicalOperator> choose_best_plan(
int
root_id);
30
31
private
:
32
void
optimize_loop(
int
root_group_id);
33
34
void
execute_task_stack(
PendingTasks
*task_stack,
int
root_group_id,
OptimizerContext
*root_context);
35
36
CostModel
cost_model_;
37
std::unique_ptr<OptimizerContext> context_;
38
};
CostModel
cost model in cost-based optimization(CBO)
Definition:
cost_model.h:19
OperatorNode
Definition:
operator_node.h:69
OptimizerContext
Definition:
optimizer_context.h:27
Optimizer
cascade optimizer TODO: currently, Optimizer is used for CBO optimization. need to unify the optimize...
Definition:
optimizer.h:23
PendingTasks
This collection of undone cascade tasks is currently stored as a stack.
Definition:
pending_tasks.h:21
制作者
1.9.5