[FEAT MERGE] implement dynamic sampling

This commit is contained in:
wangt1xiuyi
2023-04-27 12:15:28 +00:00
committed by ob-robot
parent 56f85c9c76
commit f745b47cbc
86 changed files with 6754 additions and 2282 deletions

View File

@ -19,6 +19,7 @@
#include "sql/rewrite/ob_query_range_provider.h"
#include "sql/optimizer/ob_opt_default_stat.h"
#include "sql/resolver/dml/ob_dml_stmt.h"
#include "share/stat/ob_opt_ds_stat.h"
namespace oceanbase
{
@ -36,6 +37,7 @@ enum RowCountEstMethod
DEFAULT_STAT,
BASIC_STAT, //use min/max/ndv to estimate row count
STORAGE_STAT, //use storage layer to estimate row count
DYNAMIC_SAMPLING_STAT //use dynamic sampling to estimate row count
};
// all the table meta info need to compute cost
@ -52,9 +54,7 @@ struct ObTableMetaInfo
part_size_(0),
average_row_size_(0),
row_count_(0),
cost_est_type_(ObEstimateType::OB_CURRENT_STAT_EST),
has_opt_stat_(false),
is_empty_table_(false),
micro_block_count_(-1)
{ }
virtual ~ObTableMetaInfo()
@ -65,8 +65,7 @@ struct ObTableMetaInfo
TO_STRING_KV(K_(ref_table_id), K_(part_count), K_(micro_block_size),
K_(part_size), K_(average_row_size), K_(table_column_count),
K_(table_rowkey_count), K_(table_row_count), K_(row_count),
K_(cost_est_type), K_(has_opt_stat),
K_(is_empty_table), K_(micro_block_count));
K_(micro_block_count));
/// the following fields come from schema info
uint64_t ref_table_id_; //ref table id
@ -82,9 +81,7 @@ struct ObTableMetaInfo
double average_row_size_; //main table best partition average row size
double row_count_; // row count after filters, estimated by stat manager
ObEstimateType cost_est_type_; // cost estimation type
bool has_opt_stat_;
bool is_empty_table_;
int64_t micro_block_count_; // main table micro block count
private:
DISALLOW_COPY_AND_ASSIGN(ObTableMetaInfo);