MiniOB 1
MiniOB is one mini database, helping developers to learn how database works.
载入中...
搜索中...
未找到
cost_model.h
1/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
2miniob is licensed under Mulan PSL v2.
3You can use this software according to the terms and conditions of the Mulan PSL v2.
4You may obtain a copy of Mulan PSL v2 at:
5 http://license.coscl.org.cn/MulanPSL2
6THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
7EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
8MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
9See the Mulan PSL v2 for more details. */
10
11#pragma once
12
13class Memo;
14class GroupExpr;
19{
20private:
21 // reference columbia optimizer
22 double CPU_OP = 0.00002;
23 double HASH_COST = 0.00002;
24 double HASH_PROBE = 0.00001;
25 double INDEX_PROBE = 0.00001;
26 double IO = 0.03;
27
28public:
29 // TODO: support user-defined
30 CostModel(){};
31
32 inline double cpu_op() { return CPU_OP; }
33
35 inline double hash_cost() { return HASH_COST; }
36
38 inline double hash_probe() { return HASH_PROBE; }
39
41 inline double index_probe() { return INDEX_PROBE; }
42
44 inline double io() { return IO; }
45
46 double calculate_cost(Memo *memo, GroupExpr *gexpr);
47};
cost model in cost-based optimization(CBO)
Definition: cost_model.h:19
double cpu_op()
cpu cost of building hash table
Definition: cost_model.h:32
double hash_probe()
cpu cost of finding index
Definition: cost_model.h:38
double index_probe()
i/o cost
Definition: cost_model.h:41
double hash_cost()
cpu cost of finding hash bucket
Definition: cost_model.h:35
Definition: group_expr.h:25
: memorization
Definition: memo.h:29