[CP] Enable storage cardinality estimation for partition table

This commit is contained in:
xianyu-w 2024-09-23 10:04:09 +00:00 committed by ob-robot
parent 6422d0daeb
commit e47fc93c69
36 changed files with 1552 additions and 939 deletions

View File

@ -626,6 +626,8 @@ enum ObSysVarClassType
SYS_VAR_DELAYED_INSERT_LIMIT = 10736,
SYS_VAR_NDB_VERSION = 10737,
SYS_VAR_AUTO_GENERATE_CERTS = 10738,
SYS_VAR_RANGE_INDEX_DIVE_LIMIT = 10740,
SYS_VAR_PARTITION_INDEX_DIVE_LIMIT = 10741,
SYS_VAR_OB_TABLE_ACCESS_POLICY = 10742,
};

View File

@ -621,6 +621,8 @@ namespace share
static const char* const OB_SV_DELAYED_INSERT_LIMIT = "delayed_insert_limit";
static const char* const OB_SV_NDB_VERSION = "ndb_version";
static const char* const OB_SV_AUTO_GENERATE_CERTS = "auto_generate_certs";
static const char* const OB_SV_RANGE_INDEX_DIVE_LIMIT = "range_index_dive_limit";
static const char* const OB_SV_PARTITION_INDEX_DIVE_LIMIT = "partition_index_dive_limit";
static const char* const OB_SV_TABLE_ACCESS_POLICY = "ob_table_access_policy";
}

View File

@ -967,6 +967,7 @@ const char *ObSysVarFactory::SYS_VAR_NAMES_SORTED_BY_NAME[] = {
"parallel_min_scan_time_threshold",
"parallel_servers_target",
"parser_max_mem_size",
"partition_index_dive_limit",
"performance_schema",
"performance_schema_show_processlist",
"plsql_ccflags",
@ -994,6 +995,7 @@ const char *ObSysVarFactory::SYS_VAR_NAMES_SORTED_BY_NAME[] = {
"rand_seed1",
"rand_seed2",
"range_alloc_block_size",
"range_index_dive_limit",
"range_optimizer_max_mem_size",
"rbr_exec_mode",
"read_only",
@ -1576,6 +1578,7 @@ const ObSysVarClassType ObSysVarFactory::SYS_VAR_IDS_SORTED_BY_NAME[] = {
SYS_VAR_PARALLEL_MIN_SCAN_TIME_THRESHOLD,
SYS_VAR_PARALLEL_SERVERS_TARGET,
SYS_VAR_PARSER_MAX_MEM_SIZE,
SYS_VAR_PARTITION_INDEX_DIVE_LIMIT,
SYS_VAR_PERFORMANCE_SCHEMA,
SYS_VAR_PERFORMANCE_SCHEMA_SHOW_PROCESSLIST,
SYS_VAR_PLSQL_CCFLAGS,
@ -1603,6 +1606,7 @@ const ObSysVarClassType ObSysVarFactory::SYS_VAR_IDS_SORTED_BY_NAME[] = {
SYS_VAR_RAND_SEED1,
SYS_VAR_RAND_SEED2,
SYS_VAR_RANGE_ALLOC_BLOCK_SIZE,
SYS_VAR_RANGE_INDEX_DIVE_LIMIT,
SYS_VAR_RANGE_OPTIMIZER_MAX_MEM_SIZE,
SYS_VAR_RBR_EXEC_MODE,
SYS_VAR_READ_ONLY,
@ -2339,6 +2343,8 @@ const char *ObSysVarFactory::SYS_VAR_NAMES_SORTED_BY_ID[] = {
"delayed_insert_limit",
"ndb_version",
"auto_generate_certs",
"range_index_dive_limit",
"partition_index_dive_limit",
"ob_table_access_policy"
};
@ -3149,6 +3155,8 @@ int ObSysVarFactory::create_all_sys_vars()
+ sizeof(ObSysVarDelayedInsertLimit)
+ sizeof(ObSysVarNdbVersion)
+ sizeof(ObSysVarAutoGenerateCerts)
+ sizeof(ObSysVarRangeIndexDiveLimit)
+ sizeof(ObSysVarPartitionIndexDiveLimit)
+ sizeof(ObSysVarObTableAccessPolicy)
;
void *ptr = NULL;
@ -8603,6 +8611,24 @@ int ObSysVarFactory::create_all_sys_vars()
ptr = (void *)((char *)ptr + sizeof(ObSysVarAutoGenerateCerts));
}
}
if (OB_SUCC(ret)) {
if (OB_ISNULL(sys_var_ptr = new (ptr)ObSysVarRangeIndexDiveLimit())) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_ERROR("fail to new ObSysVarRangeIndexDiveLimit", K(ret));
} else {
store_buf_[ObSysVarsToIdxMap::get_store_idx(static_cast<int64_t>(SYS_VAR_RANGE_INDEX_DIVE_LIMIT))] = sys_var_ptr;
ptr = (void *)((char *)ptr + sizeof(ObSysVarRangeIndexDiveLimit));
}
}
if (OB_SUCC(ret)) {
if (OB_ISNULL(sys_var_ptr = new (ptr)ObSysVarPartitionIndexDiveLimit())) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_ERROR("fail to new ObSysVarPartitionIndexDiveLimit", K(ret));
} else {
store_buf_[ObSysVarsToIdxMap::get_store_idx(static_cast<int64_t>(SYS_VAR_PARTITION_INDEX_DIVE_LIMIT))] = sys_var_ptr;
ptr = (void *)((char *)ptr + sizeof(ObSysVarPartitionIndexDiveLimit));
}
}
if (OB_SUCC(ret)) {
if (OB_ISNULL(sys_var_ptr = new (ptr)ObSysVarObTableAccessPolicy())) {
ret = OB_ALLOCATE_MEMORY_FAILED;
@ -15277,6 +15303,28 @@ int ObSysVarFactory::create_sys_var(ObIAllocator &allocator_, ObSysVarClassType
}
break;
}
case SYS_VAR_RANGE_INDEX_DIVE_LIMIT: {
void *ptr = NULL;
if (OB_ISNULL(ptr = allocator_.alloc(sizeof(ObSysVarRangeIndexDiveLimit)))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_ERROR("fail to alloc memory", K(ret), K(sizeof(ObSysVarRangeIndexDiveLimit)));
} else if (OB_ISNULL(sys_var_ptr = new (ptr)ObSysVarRangeIndexDiveLimit())) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_ERROR("fail to new ObSysVarRangeIndexDiveLimit", K(ret));
}
break;
}
case SYS_VAR_PARTITION_INDEX_DIVE_LIMIT: {
void *ptr = NULL;
if (OB_ISNULL(ptr = allocator_.alloc(sizeof(ObSysVarPartitionIndexDiveLimit)))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_ERROR("fail to alloc memory", K(ret), K(sizeof(ObSysVarPartitionIndexDiveLimit)));
} else if (OB_ISNULL(sys_var_ptr = new (ptr)ObSysVarPartitionIndexDiveLimit())) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_ERROR("fail to new ObSysVarPartitionIndexDiveLimit", K(ret));
}
break;
}
case SYS_VAR_OB_TABLE_ACCESS_POLICY: {
void *ptr = NULL;
if (OB_ISNULL(ptr = allocator_.alloc(sizeof(ObSysVarObTableAccessPolicy)))) {

View File

@ -4414,6 +4414,20 @@ public:
inline virtual ObSysVarClassType get_type() const { return SYS_VAR_AUTO_GENERATE_CERTS; }
inline virtual const common::ObObj &get_global_default_value() const { return ObSysVariables::get_default_value(604); }
};
class ObSysVarRangeIndexDiveLimit : public ObIntSysVar
{
public:
ObSysVarRangeIndexDiveLimit() : ObIntSysVar(NULL, NULL, NULL, NULL, NULL) {}
inline virtual ObSysVarClassType get_type() const { return SYS_VAR_RANGE_INDEX_DIVE_LIMIT; }
inline virtual const common::ObObj &get_global_default_value() const { return ObSysVariables::get_default_value(605); }
};
class ObSysVarPartitionIndexDiveLimit : public ObIntSysVar
{
public:
ObSysVarPartitionIndexDiveLimit() : ObIntSysVar(NULL, NULL, NULL, NULL, NULL) {}
inline virtual ObSysVarClassType get_type() const { return SYS_VAR_PARTITION_INDEX_DIVE_LIMIT; }
inline virtual const common::ObObj &get_global_default_value() const { return ObSysVariables::get_default_value(606); }
};
class ObSysVarObTableAccessPolicy : public ObEnumSysVar
{
public:
@ -4421,7 +4435,7 @@ public:
public:
ObSysVarObTableAccessPolicy() : ObEnumSysVar(OB_TABLE_ACCESS_POLICY_NAMES, NULL, NULL, NULL, NULL, NULL) {}
inline virtual ObSysVarClassType get_type() const { return SYS_VAR_OB_TABLE_ACCESS_POLICY; }
inline virtual const common::ObObj &get_global_default_value() const { return ObSysVariables::get_default_value(605); }
inline virtual const common::ObObj &get_global_default_value() const { return ObSysVariables::get_default_value(607); }
};
@ -4446,7 +4460,7 @@ private:
public:
const static int64_t MYSQL_SYS_VARS_COUNT = 99;
const static int64_t OB_SYS_VARS_COUNT = 507;
const static int64_t OB_SYS_VARS_COUNT = 509;
const static int64_t ALL_SYS_VARS_COUNT = MYSQL_SYS_VARS_COUNT + OB_SYS_VARS_COUNT;
const static int64_t INVALID_MAX_READ_STALE_TIME = -1;

View File

@ -8428,17 +8428,43 @@ static struct VarsInit{
}();
[&] (){
ObSysVars[605].default_value_ = "2" ;
ObSysVars[605].info_ = "Control the optimizer to generate a table access plan that prefers a specific storage format." ;
ObSysVars[605].name_ = "ob_table_access_policy" ;
ObSysVars[605].default_value_ = "10" ;
ObSysVars[605].info_ = "Indicate the limit on the number of ranges when optimizer use storage cardinality estimation" ;
ObSysVars[605].name_ = "range_index_dive_limit" ;
ObSysVars[605].data_type_ = ObIntType ;
ObSysVars[605].enum_names_ = "[u'ROW_STORE', u'COLUMN_STORE', u'AUTO']" ;
ObSysVars[605].flags_ = ObSysVarFlag::GLOBAL_SCOPE | ObSysVarFlag::SESSION_SCOPE | ObSysVarFlag::INFLUENCE_PLAN | ObSysVarFlag::NEED_SERIALIZE ;
ObSysVars[605].id_ = SYS_VAR_OB_TABLE_ACCESS_POLICY ;
ObSysVars[605].flags_ = ObSysVarFlag::SESSION_SCOPE | ObSysVarFlag::GLOBAL_SCOPE ;
ObSysVars[605].id_ = SYS_VAR_RANGE_INDEX_DIVE_LIMIT ;
cur_max_var_id = MAX(cur_max_var_id, static_cast<int64_t>(SYS_VAR_RANGE_INDEX_DIVE_LIMIT)) ;
ObSysVarsIdToArrayIdx[SYS_VAR_RANGE_INDEX_DIVE_LIMIT] = 605 ;
ObSysVars[605].base_value_ = "10" ;
ObSysVars[605].alias_ = "OB_SV_RANGE_INDEX_DIVE_LIMIT" ;
}();
[&] (){
ObSysVars[606].default_value_ = "10" ;
ObSysVars[606].info_ = "Indicate the limit on the number of partitions when optimizer use storage cardinality estimation" ;
ObSysVars[606].name_ = "partition_index_dive_limit" ;
ObSysVars[606].data_type_ = ObIntType ;
ObSysVars[606].flags_ = ObSysVarFlag::SESSION_SCOPE | ObSysVarFlag::GLOBAL_SCOPE ;
ObSysVars[606].id_ = SYS_VAR_PARTITION_INDEX_DIVE_LIMIT ;
cur_max_var_id = MAX(cur_max_var_id, static_cast<int64_t>(SYS_VAR_PARTITION_INDEX_DIVE_LIMIT)) ;
ObSysVarsIdToArrayIdx[SYS_VAR_PARTITION_INDEX_DIVE_LIMIT] = 606 ;
ObSysVars[606].base_value_ = "10" ;
ObSysVars[606].alias_ = "OB_SV_PARTITION_INDEX_DIVE_LIMIT" ;
}();
[&] (){
ObSysVars[607].default_value_ = "2" ;
ObSysVars[607].info_ = "Control the optimizer to generate a table access plan that prefers a specific storage format." ;
ObSysVars[607].name_ = "ob_table_access_policy" ;
ObSysVars[607].data_type_ = ObIntType ;
ObSysVars[607].enum_names_ = "[u'ROW_STORE', u'COLUMN_STORE', u'AUTO']" ;
ObSysVars[607].flags_ = ObSysVarFlag::GLOBAL_SCOPE | ObSysVarFlag::SESSION_SCOPE | ObSysVarFlag::INFLUENCE_PLAN | ObSysVarFlag::NEED_SERIALIZE ;
ObSysVars[607].id_ = SYS_VAR_OB_TABLE_ACCESS_POLICY ;
cur_max_var_id = MAX(cur_max_var_id, static_cast<int64_t>(SYS_VAR_OB_TABLE_ACCESS_POLICY)) ;
ObSysVarsIdToArrayIdx[SYS_VAR_OB_TABLE_ACCESS_POLICY] = 605 ;
ObSysVars[605].base_value_ = "2" ;
ObSysVars[605].alias_ = "OB_SV_TABLE_ACCESS_POLICY" ;
ObSysVarsIdToArrayIdx[SYS_VAR_OB_TABLE_ACCESS_POLICY] = 607 ;
ObSysVars[607].base_value_ = "2" ;
ObSysVars[607].alias_ = "OB_SV_TABLE_ACCESS_POLICY" ;
}();
if (cur_max_var_id >= ObSysVarFactory::OB_MAX_SYS_VAR_ID) {
@ -8447,7 +8473,7 @@ static struct VarsInit{
}
}vars_init;
static int64_t var_amount = 606;
static int64_t var_amount = 608;
int64_t ObSysVariables::get_all_sys_var_count(){ return ObSysVarFactory::ALL_SYS_VARS_COUNT;}
ObSysVarClassType ObSysVariables::get_sys_var_id(int64_t i){ return ObSysVars[i].id_;}

View File

@ -7525,8 +7525,8 @@
"ndb_index_stat_option": {
"id": 10436,
"name": "ndb_index_stat_option",
"default_value": "loop_checkon=1000ms,loop_idle=1000ms,loop_busy=100ms, update_batch=1,read_batch=4,idle_batch=32,check_batch=32, check_delay=1m,delete_batch=8,clean_delay=0,error_batch=4, error_delay=1m,evict_batch=8,evict_delay=1m,cache_limit=32M, cache_lowpct=90",
"base_value": "loop_checkon=1000ms,loop_idle=1000ms,loop_busy=100ms, update_batch=1,read_batch=4,idle_batch=32,check_batch=32, check_delay=1m,delete_batch=8,clean_delay=0,error_batch=4, error_delay=1m,evict_batch=8,evict_delay=1m,cache_limit=32M, cache_lowpct=90",
"default_value": "loop_checkon=1000ms,loop_idle=1000ms,loop_busy=100ms, update_batch=1,read_batch=4,idle_batch=32,check_batch=32, check_delay=1m,delete_batch=8,clean_delay=0,error_batch=4, error_delay=1m,evict_batch=8,evict_delay=1m,cache_limit=32M, cache_lowpct=90",
"base_value": "loop_checkon=1000ms,loop_idle=1000ms,loop_busy=100ms, update_batch=1,read_batch=4,idle_batch=32,check_batch=32, check_delay=1m,delete_batch=8,clean_delay=0,error_batch=4, error_delay=1m,evict_batch=8,evict_delay=1m,cache_limit=32M, cache_lowpct=90",
"data_type": "varchar",
"info": "mock for mysql5.7",
"flags": "SESSION | GLOBAL | MYSQL_ONLY",
@ -9826,8 +9826,8 @@
"named_pipe_full_access_group": {
"id": 10599,
"name": "named_pipe_full_access_group",
"default_value": "empty string",
"base_value": "empty string",
"default_value": "empty string",
"base_value": "empty string",
"data_type": "varchar",
"info": "mock for mysql5.7",
"flags": "GLOBAL | READONLY | MYSQL_ONLY",
@ -11840,8 +11840,7 @@
"publish_version": "425",
"info_cn": "",
"background_cn": "",
"ref_url": "",
"placeholder": true
"ref_url": ""
},
"partition_index_dive_limit": {
"id": 10741,
@ -11854,8 +11853,7 @@
"publish_version": "425",
"info_cn": "",
"background_cn": "",
"ref_url": "",
"placeholder": true
"ref_url": ""
},
"ob_table_access_policy": {
"id": 10742,

View File

@ -32,6 +32,7 @@
#include "sql/session/ob_sql_session_info.h"
#include "sql/optimizer/ob_dynamic_sampling.h"
#include "sql/optimizer/ob_skyline_prunning.h"
#include "sql/optimizer/ob_access_path_estimation.h"
using namespace oceanbase::common;
using namespace oceanbase::share;
@ -742,7 +743,7 @@ int ObOptimizerTraceImpl::append(const ObShardingInfo *info)
} else {
new_line();
append("location type:", info->get_location_type());
append(", partion count:", info->get_part_cnt());
append(", partition count:", info->get_part_cnt());
}
return ret;
}
@ -891,6 +892,89 @@ int ObOptimizerTraceImpl::append(const ObSkylineDim &dim)
return ret;
}
int ObOptimizerTraceImpl::append(const ObNewRange &range)
{
int ret = OB_SUCCESS;
char buf[1024] = {0};
int64_t length = 1024;
length = range.to_plain_string(buf, length);
ret = log_handle_.append(buf, length);
return ret;
}
int ObOptimizerTraceImpl::append(const ObOptTabletLoc& tablet_loc)
{
int ret = OB_SUCCESS;
if (OB_FAIL(append("(partition id:", tablet_loc.get_partition_id()))) {
LOG_WARN("failed to append", K(ret));
} else if (OB_FAIL(append("partition id:", tablet_loc.get_partition_id()))) {
LOG_WARN("failed to append", K(ret));
} else if (tablet_loc.get_first_level_part_id() >= 0 &&
OB_FAIL(append(", first level partition id:", tablet_loc.get_first_level_part_id()))) {
LOG_WARN("failed to append", K(ret));
} else if (OB_FAIL(append(", tablet id:"))) {
LOG_WARN("failed to append", K(ret));
} else if (OB_FAIL(append(tablet_loc.get_tablet_id().id()))) {
LOG_WARN("failed to append", K(ret));
} else if (OB_FAIL(append(")"))) {
LOG_WARN("failed to append", K(ret));
}
return ret;
}
int ObOptimizerTraceImpl::append(const ObCandiTabletLoc& candi_tablet_loc)
{
return append(candi_tablet_loc.get_partition_location());
}
int ObOptimizerTraceImpl::append(const ObBatchEstTasks& task)
{
int ret = OB_SUCCESS;
const ObIArray<obrpc::ObEstPartArgElement> &params = task.arg_.index_params_;
const ObIArray<obrpc::ObEstPartResElement> &res = task.res_.index_param_res_;
int64_t cnt = MIN(params.count(), res.count());
for (int64_t i = 0; OB_SUCC(ret) && i < cnt; i ++) {
if (i != 0 && OB_FAIL(new_line())) {
LOG_WARN("failed to append", K(ret));
} else if (OB_FAIL(append("( index", params.at(i).index_id_))) {
LOG_WARN("failed to append", K(ret));
} else if (OB_FAIL(append(", tablet", params.at(i).tablet_id_.id()))) {
LOG_WARN("failed to append", K(ret));
} else if (OB_FAIL(append(") logical rows:", res.at(i).logical_row_count_))) {
LOG_WARN("failed to append", K(ret));
} else if (OB_FAIL(append(", physical rows:", res.at(i).physical_row_count_))) {
LOG_WARN("failed to append", K(ret));
} else if (!res.at(i).reliable_ && OB_FAIL(append(" [NOT RELIABLE]"))) {
LOG_WARN("failed to append", K(ret));
}
}
return ret;
}
template <>
int ObOptimizerTraceImpl::append<ObDSResultItem>(const ObIArrayWrap<ObDSResultItem>& value)
{
int ret = OB_SUCCESS;
for (int i = 0; OB_SUCC(ret) && i < value.count(); ++i) {
if (OB_FAIL(append(value.at(i)))) {
} else if (OB_FAIL(new_line())) {
}
}
return ret;
}
template <>
int ObOptimizerTraceImpl::append<ColumnItem>(const ObIArrayWrap<ColumnItem>& value)
{
int ret = OB_SUCCESS;
for (int i = 0; OB_SUCC(ret) && i < value.count(); ++i) {
if (OB_FAIL(append(value.at(i).column_name_))) {
} else if (i > 0 && OB_FAIL(new_line())) {
}
}
return ret;
}
int ObOptimizerTraceImpl::trace_env()
{
int ret = OB_SUCCESS;

View File

@ -45,7 +45,10 @@ class ObSQLSessionInfo;
struct CandidatePlan;
class OptSystemStat;
class ObSkylineDim;
class ObOptTabletLoc;
class ObCandiTabletLoc;
struct ColumnItem;
struct ObBatchEstTasks;
class ObOptimizerTraceImpl;
@ -335,6 +338,10 @@ public:
int append(const CandidatePlan &plan);
int append(const ObDSResultItem &ds_result);
int append(const ObSkylineDim &dim);
int append(const ObNewRange &range);
int append(const ObOptTabletLoc& tablet_loc);
int append(const ObCandiTabletLoc& candi_tablet_loc);
int append(const ObBatchEstTasks& task);
/***********************************************/
////print template type
/***********************************************/
@ -348,35 +355,8 @@ public:
typename std::enable_if<std::is_base_of<ObDMLStmt, T>::value, int>::type
append(const T* value);
//for ObIArray<ObRawExpr*>
template <typename T>
typename std::enable_if<std::is_base_of<ObIArray<ObRawExpr*>, T>::value, int>::type
append(const T& value);
//for ObIArrayWrap<uint64_t>
template <typename T>
typename std::enable_if<std::is_base_of<ObIArrayWrap<uint64_t>, T>::value, int>::type
append(const T& value);
//for ObIArrayWrap<int64_t>
template <typename T>
typename std::enable_if<std::is_base_of<ObIArrayWrap<int64_t>, T>::value, int>::type
append(const T& value);
//for ObIArrayWrap<double>
template <typename T>
typename std::enable_if<std::is_base_of<ObIArrayWrap<double>, T>::value, int>::type
append(const T& value);
//for ObIArray<ObDSResultItem>
template <typename T>
typename std::enable_if<std::is_base_of<ObIArray<ObDSResultItem>, T>::value, int>::type
append(const T& value);
//for ObIArray<ColumnItem>
template <typename T>
typename std::enable_if<std::is_base_of<ObIArray<ColumnItem>, T>::value, int>::type
append(const T& value);
int append(const ObIArrayWrap<T>& value);
//template for function append
template<typename T1, typename T2, typename ...ARGS>
@ -459,10 +439,8 @@ ObOptimizerTraceImpl::append(const T* value)
return ret;
}
//for ObIArray<ObRawExpr*>
template <typename T>
typename std::enable_if<std::is_base_of<ObIArray<ObRawExpr*>, T>::value, int>::type
ObOptimizerTraceImpl::append(const T& value)
int ObOptimizerTraceImpl::append(const ObIArrayWrap<T>& value)
{
int ret = OB_SUCCESS;
append("[");
@ -476,84 +454,6 @@ ObOptimizerTraceImpl::append(const T& value)
return ret;
}
//for ObIArray<uint64_t>
template <typename T>
typename std::enable_if<std::is_base_of<ObIArrayWrap<uint64_t>, T>::value, int>::type
ObOptimizerTraceImpl::append(const T& value)
{
int ret = OB_SUCCESS;
append("[");
for (int i = 0; OB_SUCC(ret) && i < value.count(); ++i) {
if (i > 0) {
append(", ");
}
ret = append(value.at(i));
}
append("]");
return ret;
}
//for ObIArray<int64_t>
template <typename T>
typename std::enable_if<std::is_base_of<ObIArrayWrap<int64_t>, T>::value, int>::type
ObOptimizerTraceImpl::append(const T& value)
{
int ret = OB_SUCCESS;
append("[");
for (int i = 0; OB_SUCC(ret) && i < value.count(); ++i) {
if (i > 0) {
append(", ");
}
ret = append(value.at(i));
}
append("]");
return ret;
}
//for ObIArray<double>
template <typename T>
typename std::enable_if<std::is_base_of<ObIArrayWrap<double>, T>::value, int>::type
ObOptimizerTraceImpl::append(const T& value)
{
int ret = OB_SUCCESS;
append("[");
for (int i = 0; OB_SUCC(ret) && i < value.count(); ++i) {
if (i > 0) {
append(", ");
}
ret = append(value.at(i));
}
append("]");
return ret;
}
//for ObIArray<ObDSResultItem>
template <typename T>
typename std::enable_if<std::is_base_of<ObIArray<ObDSResultItem>, T>::value, int>::type
ObOptimizerTraceImpl::append(const T& value)
{
int ret = OB_SUCCESS;
for (int i = 0; OB_SUCC(ret) && i < value.count(); ++i) {
if (OB_FAIL(append(value.at(i)))) {
} else if (OB_FAIL(new_line())) {
}
}
return ret;
}
template <typename T>
typename std::enable_if<std::is_base_of<ObIArray<ColumnItem>, T>::value, int>::type
ObOptimizerTraceImpl::append(const T& value)
{
int ret = OB_SUCCESS;
for (int i = 0; OB_SUCC(ret) && i < value.count(); ++i) {
if (OB_FAIL(append(value.at(i).column_name_))) {
} else if (i > 0 && OB_FAIL(new_line())) {
}
}
return ret;
}
//template for function append
template<typename T1, typename T2, typename ...ARGS>
int ObOptimizerTraceImpl::append(const T1& value1, const T2& value2, const ARGS&... args)

View File

@ -430,13 +430,25 @@ int ObAccessPathEstimation::check_path_can_use_storage_estimation(const AccessPa
{
int ret = OB_SUCCESS;
can_use = false;
if (OB_ISNULL(path)) {
int64_t range_limit = 0;
int64_t partition_limit = 0;
if (OB_ISNULL(path) || OB_ISNULL(ctx.get_session_info())) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("access path is invalid", K(ret), K(path));
LOG_WARN("param is invalid", K(ret), K(path), K(ctx.get_session_info()));
} else if (OB_FAIL(is_storage_estimation_enabled(path->parent_->get_plan(), ctx ,path->table_id_, path->ref_table_id_, can_use))) {
LOG_WARN("fail to do check_path_can_use_storage_estimation ", K(ret), K(path));
} else if (!can_use) {
can_use = false;
} else if (OB_FAIL(ctx.get_global_hint().opt_params_.get_sys_var(ObOptParamHint::RANGE_INDEX_DIVE_LIMIT,
ctx.get_session_info(),
share::SYS_VAR_RANGE_INDEX_DIVE_LIMIT,
range_limit))) {
LOG_WARN("failed to get hint system variable", K(ret));
} else if (OB_FAIL(ctx.get_global_hint().opt_params_.get_sys_var(ObOptParamHint::PARTITION_INDEX_DIVE_LIMIT,
ctx.get_session_info(),
share::SYS_VAR_PARTITION_INDEX_DIVE_LIMIT,
partition_limit))) {
LOG_WARN("failed to get hint system variable", K(ret));
} else {
const ObTablePartitionInfo *part_info = NULL;
if (OB_ISNULL(part_info = path->table_partition_info_)) {
@ -444,15 +456,20 @@ int ObAccessPathEstimation::check_path_can_use_storage_estimation(const AccessPa
LOG_WARN("table partition info is null", K(ret), K(part_info));
} else {
int64_t scan_range_count = get_scan_range_count(path->get_query_ranges());
int64_t partition_count = part_info->get_phy_tbl_location_info().get_partition_cnt();
if (partition_count > 1 ||
scan_range_count <= 0 ||
(!path->est_cost_info_.index_meta_info_.is_geo_index_ &&
!path->est_cost_info_.index_meta_info_.is_multivalue_index_ &&
scan_range_count > ObOptEstCost::MAX_STORAGE_RANGE_ESTIMATION_NUM)) {
can_use = false;
if (range_limit < 0 && partition_limit < 0) {
// rollback to the old strategy iff both variables are negative
int64_t partition_count = part_info->get_phy_tbl_location_info().get_partition_cnt();
if (partition_count > 1 ||
scan_range_count <= 0 ||
(!path->est_cost_info_.index_meta_info_.is_geo_index_ &&
!path->est_cost_info_.index_meta_info_.is_multivalue_index_ &&
scan_range_count > ObOptEstCost::MAX_STORAGE_RANGE_ESTIMATION_NUM)) {
can_use = false;
} else {
can_use = true;
}
} else {
can_use = true;
can_use = (scan_range_count > 0);
}
}
}
@ -586,33 +603,57 @@ int ObAccessPathEstimation::process_storage_estimation(ObOptimizerContext &ctx,
ObArenaAllocator arena("CardEstimation");
ObArray<ObBatchEstTasks *> tasks;
ObArray<ObAddr> prefer_addrs;
void *ptr = NULL;
int64_t partition_limit = 0;
int64_t range_limit = 0;
ObCandiTabletLocSEArray chosen_partitions;
ObSEArray<common::ObNewRange, 4> chosen_scan_ranges;
OPT_TRACE_TITLE("BEGIN STORAGE CARDINALITY ESTIMATION");
bool force_leader_estimation = false;
force_leader_estimation = OB_FAIL(OB_E(EventTable::EN_LEADER_STORAGE_ESTIMATION) OB_SUCCESS);
ret = OB_SUCCESS;
if (OB_ISNULL(ctx.get_session_info()) ||
OB_ISNULL(ctx.get_exec_ctx()) ||
OB_ISNULL(ctx.get_exec_ctx()->get_physical_plan_ctx())) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("param is invalid", K(ret), K(ctx.get_session_info()), K(ctx.get_exec_ctx()));
} else if (OB_FAIL(ctx.get_global_hint().opt_params_.get_sys_var(ObOptParamHint::PARTITION_INDEX_DIVE_LIMIT,
ctx.get_session_info(),
share::SYS_VAR_PARTITION_INDEX_DIVE_LIMIT,
partition_limit))) {
LOG_WARN("failed to get hint system variable", K(ret));
} else if (OB_FAIL(ctx.get_global_hint().opt_params_.get_sys_var(ObOptParamHint::RANGE_INDEX_DIVE_LIMIT,
ctx.get_session_info(),
share::SYS_VAR_RANGE_INDEX_DIVE_LIMIT,
range_limit))) {
LOG_WARN("failed to get hint system variable", K(ret));
} else {
if (partition_limit < 0 && range_limit < 0) {
partition_limit = 1;
range_limit = ObOptEstCost::MAX_STORAGE_RANGE_ESTIMATION_NUM;
}
}
// for each access path, find a partition/server for estimation
for (int64_t i = 0; OB_SUCC(ret) && i < paths.count(); ++i) {
AccessPath *ap = NULL;
ObBatchEstTasks *task = NULL;
EstimatedPartition best_index_part;
const ObTableMetaInfo *table_meta = NULL;
chosen_scan_ranges.reuse();
chosen_partitions.reuse();
SMART_VARS_3((ObTablePartitionInfo, tmp_part_info),
(ObPhysicalPlanCtx, tmp_plan_ctx, arena),
(ObExecContext, tmp_exec_ctx, arena)) {
const ObTablePartitionInfo *table_part_info = NULL;
int64_t total_part_cnt = 0;
if (OB_ISNULL(ap = paths.at(i)) ||
OB_ISNULL(table_part_info = ap->table_partition_info_) ||
OB_ISNULL(ctx.get_session_info()) ||
OB_ISNULL(ctx.get_exec_ctx()) ||
OB_ISNULL(ctx.get_exec_ctx()->get_physical_plan_ctx()) ||
OB_ISNULL(table_meta = ap->est_cost_info_.table_meta_info_)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("access path is invalid", K(ret), K(ap), K(table_part_info), K(ctx.get_exec_ctx()),
K(table_meta));
} else {
total_part_cnt = table_part_info->get_phy_tbl_location_info().get_phy_part_loc_info_list().count();
ObPhysicalPlanCtx *plan_ctx = ctx.get_exec_ctx()->get_physical_plan_ctx();
const int64_t cur_time = plan_ctx->has_cur_time() ?
plan_ctx->get_cur_time().get_timestamp() : ObTimeUtility::current_time();
@ -631,47 +672,41 @@ int ObAccessPathEstimation::process_storage_estimation(ObOptimizerContext &ctx,
if (OB_FAIL(ret)) {
} else if (OB_FAIL(tmp_part_info.assign(*table_part_info))) {
LOG_WARN("failed to assign table part info", K(ret));
} else if (OB_UNLIKELY(1 != tmp_part_info.get_phy_tbl_location_info().get_phy_part_loc_info_list().count())) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("access path is invalid", K(ret), K(tmp_part_info.get_phy_tbl_location_info().get_phy_part_loc_info_list()));
} else if (!ap->is_global_index_ && ap->ref_table_id_ != ap->index_id_ &&
OB_FAIL(tmp_part_info.replace_final_location_key(tmp_exec_ctx,
ap->index_id_,
true))) {
LOG_WARN("failed to replace final location key", K(ret));
} else if (OB_FAIL(ObSQLUtils::choose_best_replica_for_estimation(
tmp_part_info.get_phy_tbl_location_info().get_phy_part_loc_info_list().at(0),
ctx.get_local_server_addr(),
prefer_addrs,
!ap->can_use_remote_estimate(),
best_index_part))) {
LOG_WARN("failed to choose best partition for estimation", K(ret));
} else if (force_leader_estimation &&
OB_FAIL(choose_leader_replica(tmp_part_info.get_phy_tbl_location_info().get_phy_part_loc_info_list().at(0),
ap->can_use_remote_estimate(),
ctx.get_local_server_addr(),
best_index_part))) {
LOG_WARN("failed to choose leader replica", K(ret));
} else if (!best_index_part.is_valid()) {
// does not do storage estimation for the index
} else if (OB_FAIL(get_task(tasks, best_index_part.addr_, task))) {
LOG_WARN("failed to get task", K(ret));
} else if (NULL != task) {
// do nothing
} else if (OB_FAIL(prefer_addrs.push_back(best_index_part.addr_))) {
LOG_WARN("failed to push back new addr", K(ret));
} else if (OB_ISNULL(ptr = arena.alloc(sizeof(ObBatchEstTasks)))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("memory is not enough", K(ret));
} else if (OB_FAIL(choose_storage_estimation_partitions(partition_limit,
tmp_part_info.get_phy_tbl_location_info().get_phy_part_loc_info_list(),
chosen_partitions))) {
LOG_WARN("failed to choose partitions", K(ret));
} else if (OB_FAIL(choose_storage_estimation_ranges(range_limit, ap, chosen_scan_ranges))) {
LOG_WARN("failed to choose scan ranges", K(ret));
} else {
task = new (ptr) ObBatchEstTasks();
task->addr_ = best_index_part.addr_;
task->arg_.schema_version_ = table_meta->schema_version_;
OZ (tasks.push_back(task));
OPT_TRACE("Choose partitions and ranges for index", ap->index_id_, "to estimate rowcount");
OPT_TRACE_BEGIN_SECTION;
OPT_TRACE("partitions :", chosen_partitions);
OPT_TRACE("ranges :", chosen_scan_ranges);
OPT_TRACE_END_SECTION;
LOG_TRACE("choose partitions and ranges to estimate rowcount", K(ap->index_id_), K(chosen_partitions));
LOG_TRACE("choose ranges to estimate rowcount", K(chosen_scan_ranges));
}
if (OB_SUCC(ret) && NULL != task) {
if (OB_FAIL(add_index_info(ctx, arena, task, best_index_part, ap))) {
LOG_WARN("failed to add task info", K(ret));
for (int64_t j = 0; OB_SUCC(ret) && j < chosen_partitions.count(); j ++) {
EstimatedPartition best_index_part;
if (OB_FAIL(get_storage_estimation_task(ctx,
arena,
chosen_partitions.at(j),
*table_meta,
prefer_addrs,
tasks,
best_index_part,
task))) {
LOG_WARN("failed to get task", K(ret));
} else if (NULL != task) {
if (OB_FAIL(add_index_info(ctx, arena, task, best_index_part, ap, chosen_scan_ranges))) {
LOG_WARN("failed to add task info", K(ret));
}
}
}
}
@ -696,26 +731,16 @@ int ObAccessPathEstimation::process_storage_estimation(ObOptimizerContext &ctx,
break;
} else if (!tasks.at(i)->check_result_reliable()) {
need_fallback = true;
OPT_TRACE("storage estimation result is not reliable");
OPT_TRACE(*tasks.at(i));
LOG_WARN("storage estimation result is not reliable", KPC(tasks.at(i)));
}
}
NG_TRACE(storage_estimation_end);
if (!need_fallback) {
for (int64_t i = 0; OB_SUCC(ret) && i < tasks.count(); ++i) {
const ObBatchEstTasks *task = tasks.at(i);
for (int64_t j = 0; OB_SUCC(ret) && j < task->paths_.count(); ++j) {
const obrpc::ObEstPartResElement &res = task->res_.index_param_res_.at(j);
AccessPath *path = task->paths_.at(j);
if (OB_FAIL(path->est_records_.assign(res.est_records_))) {
LOG_WARN("failed to assign estimation records", K(ret));
} else if (OB_FAIL(estimate_prefix_range_rowcount(res,
path->est_cost_info_))) {
LOG_WARN("failed to estimate prefix range rowcount", K(ret));
} else if (OB_FAIL(fill_cost_table_scan_info(path->est_cost_info_))) {
LOG_WARN("failed to fill cost table scan info", K(ret));
}
}
}
if (OB_SUCC(ret) && !need_fallback &&
OB_FAIL(process_storage_estimation_result(tasks, is_success))) {
LOG_WARN("failed to process result", K(ret));
}
// deconstruct ObBatchEstTasks
@ -725,7 +750,142 @@ int ObAccessPathEstimation::process_storage_estimation(ObOptimizerContext &ctx,
tasks.at(i) = NULL;
}
}
is_success = !need_fallback;
is_success &= !need_fallback;
return ret;
}
int ObAccessPathEstimation::get_storage_estimation_task(ObOptimizerContext &ctx,
ObIAllocator &arena,
const ObCandiTabletLoc &partition,
const ObTableMetaInfo &table_meta,
ObIArray<ObAddr> &prefer_addrs,
ObIArray<ObBatchEstTasks *> &tasks,
EstimatedPartition &best_index_part,
ObBatchEstTasks *&task)
{
int ret = OB_SUCCESS;
task = NULL;
void *ptr = NULL;
const bool can_use_remote = true;
const bool force_leader_estimation = OB_SUCCESS != (OB_E(EventTable::EN_LEADER_STORAGE_ESTIMATION) OB_SUCCESS);
if (OB_FAIL(ObSQLUtils::choose_best_replica_for_estimation(
partition,
ctx.get_local_server_addr(),
prefer_addrs,
!can_use_remote,
best_index_part))) {
LOG_WARN("failed to choose best partition for estimation", K(ret));
} else if (force_leader_estimation &&
OB_FAIL(choose_leader_replica(partition,
can_use_remote,
ctx.get_local_server_addr(),
best_index_part))) {
LOG_WARN("failed to choose leader replica", K(ret));
} else if (!best_index_part.is_valid()) {
// does not do storage estimation for this index partition
} else if (OB_FAIL(get_task(tasks, best_index_part.addr_, task))) {
LOG_WARN("failed to get task", K(ret));
} else if (NULL != task) {
// do nothing
} else if (OB_FAIL(prefer_addrs.push_back(best_index_part.addr_))) {
LOG_WARN("failed to push back new addr", K(ret));
} else if (OB_ISNULL(ptr = arena.alloc(sizeof(ObBatchEstTasks)))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("memory is not enough", K(ret));
} else {
task = new (ptr) ObBatchEstTasks();
task->addr_ = best_index_part.addr_;
task->arg_.schema_version_ = table_meta.schema_version_;
OZ (tasks.push_back(task));
}
return ret;
}
int ObAccessPathEstimation::process_storage_estimation_result(ObIArray<ObBatchEstTasks *> &tasks,
bool &is_reliable)
{
int ret = OB_SUCCESS;
ObSEArray<AccessPath *, 4> paths;
ObSEArray<int64_t, 4> logical_rows_array;
ObSEArray<int64_t, 4> physical_rows_array;
ObSEArray<int64_t, 4> partition_cnt_array;
is_reliable = true;
OPT_TRACE("Process storage estimation result");
OPT_TRACE_BEGIN_SECTION;
for (int64_t i = 0; OB_SUCC(ret) && i < tasks.count(); ++i) {
const ObBatchEstTasks *task = tasks.at(i);
if (OB_ISNULL(task)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("unexpected param", K(ret));
} else {
OPT_TRACE(*tasks.at(i));
}
for (int64_t j = 0; OB_SUCC(ret) && j < task->paths_.count(); ++j) {
const obrpc::ObEstPartResElement &res = task->res_.index_param_res_.at(j);
AccessPath *path = task->paths_.at(j);
int64_t idx = -1;
const ObEstPartArgElement &index_param = task->arg_.index_params_.at(j);
if (OB_ISNULL(path) || OB_UNLIKELY(j >= task->arg_.index_params_.count())) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("unexpected null path", K(ret));
} else if (OB_FAIL(append(path->est_records_, res.est_records_))) {
LOG_WARN("failed to assign estimation records", K(ret));
} else if (!ObOptimizerUtil::find_item(paths, path, &idx)) {
if (OB_FAIL(paths.push_back(path)) ||
OB_FAIL(logical_rows_array.push_back(0)) ||
OB_FAIL(physical_rows_array.push_back(0)) ||
OB_FAIL(partition_cnt_array.push_back(0))) {
LOG_WARN("failed to push back", K(ret));
} else {
idx = paths.count() - 1;
}
}
if (OB_SUCC(ret)) {
double sample_ratio = 1.0;
double scan_range_count = 1.0 * get_scan_range_count(path->est_cost_info_.ranges_);
if (index_param.batch_.type_ == ObSimpleBatch::T_MULTI_SCAN &&
OB_NOT_NULL(index_param.batch_.ranges_) &&
index_param.batch_.ranges_->count() > 1) {
sample_ratio = scan_range_count / index_param.batch_.ranges_->count();
} else {
sample_ratio = scan_range_count;
}
sample_ratio = std::max(sample_ratio, 1.0);
logical_rows_array.at(idx) += res.logical_row_count_ * sample_ratio;
physical_rows_array.at(idx) += res.physical_row_count_ * sample_ratio;
partition_cnt_array.at(idx) += 1;
}
}
}
OPT_TRACE_END_SECTION;
for (int64_t i = 0; OB_SUCC(ret) && is_reliable && i < paths.count(); ++i) {
// all choosed partitions are empty, do not use the result
if (paths.at(i)->is_global_index_ &&
paths.at(i)->est_cost_info_.ranges_.count() == 1 &&
paths.at(i)->est_cost_info_.ranges_.at(0).is_whole_range() &&
logical_rows_array.at(i) == 0) {
is_reliable = false;
LOG_WARN("storage estimation result is not reliable",
KPC(paths.at(i)), K(logical_rows_array.at(i)), K(physical_rows_array.at(i)), K(tasks));
OPT_TRACE("storage estimation result is not reliable for index ", paths.at(i)->index_id_);
}
}
if (is_reliable) {
for (int64_t i = 0; OB_SUCC(ret) && i < paths.count(); ++i) {
AccessPath *path = paths.at(i);
if (OB_FAIL(estimate_prefix_range_rowcount(logical_rows_array.at(i),
physical_rows_array.at(i),
partition_cnt_array.at(i),
path->est_cost_info_))) {
LOG_WARN("failed to estimate prefix range rowcount", K(ret));
} else if (OB_FAIL(fill_cost_table_scan_info(path->est_cost_info_))) {
LOG_WARN("failed to fill cost table scan info", K(ret));
}
OPT_TRACE("The storage estimation result of index", paths.at(i)->index_id_, "is",
logical_rows_array.at(i), "(logical) and",
physical_rows_array.at(i), "(physical)");
}
}
return ret;
}
@ -782,28 +942,27 @@ int ObAccessPathEstimation::do_storage_estimation(ObOptimizerContext &ctx,
}
int ObAccessPathEstimation::estimate_prefix_range_rowcount(
const obrpc::ObEstPartResElement &result,
const int64_t res_logical_row_count,
const int64_t res_physical_row_count,
const int64_t sample_partition_cnt,
ObCostTableScanInfo &est_cost_info)
{
int ret = OB_SUCCESS;
double &logical_row_count = est_cost_info.logical_query_range_row_count_;
double &physical_row_count = est_cost_info.phy_query_range_row_count_;
logical_row_count = 0;
physical_row_count = 0;
int64_t get_range_count = get_get_range_count(est_cost_info.ranges_);
int64_t scan_range_count = get_scan_range_count(est_cost_info.ranges_);
logical_row_count = res_logical_row_count;
physical_row_count = res_physical_row_count;
// at most N query ranges are used in storage estimation
double range_sample_ratio = (scan_range_count * 1.0 )
/ ObOptEstCost::MAX_STORAGE_RANGE_ESTIMATION_NUM;
range_sample_ratio = range_sample_ratio > 1.0 ? range_sample_ratio : 1.0;
logical_row_count += range_sample_ratio * result.logical_row_count_ + get_range_count;
physical_row_count += range_sample_ratio * result.physical_row_count_ + get_range_count;
double partition_sample_ratio = (est_cost_info.index_meta_info_.index_part_count_ * 1.0 ) / sample_partition_cnt;
partition_sample_ratio = partition_sample_ratio > 1.0 ? partition_sample_ratio : 1.0;
double get_range_count = 1.0 * get_get_range_count(est_cost_info.ranges_);
// number of index partition
logical_row_count *= est_cost_info.index_meta_info_.index_part_count_;
physical_row_count *= est_cost_info.index_meta_info_.index_part_count_;
logical_row_count *= partition_sample_ratio;
physical_row_count *= partition_sample_ratio;
logical_row_count += get_range_count;
physical_row_count += get_range_count;
// NLJ or SPF push down prefix filters
logical_row_count *= est_cost_info.pushdown_prefix_filter_sel_;
@ -814,9 +973,9 @@ int ObAccessPathEstimation::estimate_prefix_range_rowcount(
physical_row_count *= est_cost_info.ss_postfix_range_filters_sel_;
LOG_TRACE("OPT:[STORAGE EST ROW COUNT]",
K(logical_row_count), K(physical_row_count),
K(get_range_count), K(scan_range_count),
K(range_sample_ratio), K(result), K(est_cost_info.index_meta_info_.index_part_count_),
K(logical_row_count), K(physical_row_count), K(get_range_count),
K(partition_sample_ratio), K(res_logical_row_count), K(res_physical_row_count),
K(est_cost_info.index_meta_info_.index_part_count_),
K(est_cost_info.pushdown_prefix_filter_sel_),
K(est_cost_info.ss_postfix_range_filters_sel_));
return ret;
@ -890,20 +1049,124 @@ int ObAccessPathEstimation::fill_cost_table_scan_info(ObCostTableScanInfo &est_c
return ret;
}
int ObAccessPathEstimation::choose_storage_estimation_partitions(const int64_t partition_limit,
const ObCandiTabletLocIArray &partitions,
ObCandiTabletLocIArray &chosen_partitions)
{
int ret = OB_SUCCESS;
ObSqlBitSet<> min_max_index;
int64_t min_index = 0;
int64_t max_index = 0;
if (partition_limit <= 0 || partition_limit >= partitions.count()) {
if (OB_FAIL(chosen_partitions.assign(partitions))) {
LOG_WARN("failed to assign", K(ret));
}
} else {
for (int64_t i = 1; i < partitions.count(); i ++) {
if (partitions.at(i).get_partition_location().get_tablet_id().id() <
partitions.at(min_index).get_partition_location().get_tablet_id().id()) {
min_index = i;
}
if (partitions.at(i).get_partition_location().get_tablet_id().id() >
partitions.at(max_index).get_partition_location().get_tablet_id().id()) {
max_index = i;
}
}
if (OB_FAIL(min_max_index.add_member(min_index)) ||
OB_FAIL(min_max_index.add_member(max_index))) {
LOG_WARN("failed to add member", K(ret));
} else if (OB_FAIL(ObOptimizerUtil::choose_random_members(
STORAGE_EST_SAMPLE_SEED, partitions, partition_limit,
chosen_partitions, &min_max_index))) {
LOG_WARN("failed to choose random partitions", K(ret), K(partition_limit));
}
}
return ret;
}
int ObAccessPathEstimation::choose_storage_estimation_ranges(const int64_t range_limit,
AccessPath *ap,
ObIArray<common::ObNewRange> &scan_ranges)
{
int ret = OB_SUCCESS;
ObSEArray<common::ObNewRange, 4> get_ranges;
ObSEArray<common::ObNewRange, 4> valid_ranges;
if (OB_ISNULL(ap)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("unexpected null", K(ret));
} else if (ap->est_cost_info_.ranges_.empty()) {
// do nothing
} else if (ap->est_cost_info_.index_meta_info_.is_geo_index_) {
ObIArray<common::ObNewRange> &geo_ranges = ap->est_cost_info_.ranges_;
int64_t total_cnt = geo_ranges.count();
if (geo_ranges.at(0).get_start_key().get_obj_cnt() < SPATIAL_ROWKEY_MIN_NUM) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("The count of rowkey from spatial_index_table is wrong.", K(ret), K(geo_ranges.at(0).get_start_key().get_obj_cnt()));
} else if (total_cnt <= range_limit || range_limit <= 0) {
if (OB_FAIL(scan_ranges.assign(geo_ranges))) {
LOG_WARN("failed to assgin valid ranges", K(ret));
}
} else {
for (int64_t i = 0; OB_SUCC(ret) && i < geo_ranges.count(); ++i) {
const ObNewRange &range = geo_ranges.at(i);
if (is_multi_geo_range(range)) {
if (OB_FAIL(scan_ranges.push_back(range))) {
LOG_WARN("failed to push back scan range", K(ret));
}
} else {
if (OB_FAIL(get_ranges.push_back(range))) {
LOG_WARN("failed to push back scan range", K(ret));
}
}
}
// push_back scan_range for first priority
if (OB_FAIL(ret) || scan_ranges.count() == range_limit) {
} else if (scan_ranges.count() > range_limit) {
if (OB_FAIL(ObOptimizerUtil::choose_random_members(STORAGE_EST_SAMPLE_SEED, scan_ranges, range_limit, valid_ranges))) {
LOG_WARN("failed to choose random ranges", K(ret), K(range_limit), K(scan_ranges));
} else if (OB_FAIL(scan_ranges.assign(valid_ranges))) {
LOG_WARN("failed to assgin valid ranges", K(ret));
}
} else {
if (OB_FAIL(ObOptimizerUtil::choose_random_members(STORAGE_EST_SAMPLE_SEED, get_ranges, range_limit - scan_ranges.count(), valid_ranges))) {
LOG_WARN("failed to choose random ranges", K(ret), K(range_limit), K(scan_ranges));
} else if (OB_FAIL(append(scan_ranges, valid_ranges))) {
LOG_WARN("failed to append valid ranges", K(ret));
}
}
}
} else {
if (OB_FAIL(ObOptimizerUtil::classify_get_scan_ranges(
ap->est_cost_info_.ranges_,
get_ranges,
scan_ranges))) {
LOG_WARN("failed to clasiffy get scan ranges", K(ret));
} else if (scan_ranges.count() > range_limit && range_limit > 0) {
if (OB_FAIL(ObOptimizerUtil::choose_random_members(STORAGE_EST_SAMPLE_SEED, scan_ranges, range_limit, valid_ranges))) {
LOG_WARN("failed to choose random ranges", K(ret), K(range_limit), K(scan_ranges));
} else if (OB_FAIL(scan_ranges.assign(valid_ranges))) {
LOG_WARN("failed to assgin valid ranges", K(ret));
}
}
}
return ret;
}
int ObAccessPathEstimation::add_index_info(ObOptimizerContext &ctx,
ObIAllocator &allocator,
ObBatchEstTasks *task,
const EstimatedPartition &part,
AccessPath *ap)
AccessPath *ap,
const ObIArray<common::ObNewRange> &chosen_scan_ranges)
{
int ret = OB_SUCCESS;
ObSEArray<common::ObNewRange, 4> tmp_ranges;
ObSEArray<common::ObNewRange, 4> get_ranges;
ObSEArray<common::ObNewRange, 4> scan_ranges;
obrpc::ObEstPartArgElement *index_est_arg = NULL;
if (OB_ISNULL(task) || OB_ISNULL(ap) || OB_ISNULL(ctx.get_session_info())) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("invalid access path or batch task", K(ret), K(task), K(ap));
} else if (OB_FAIL(scan_ranges.assign(chosen_scan_ranges))) {
LOG_WARN("failed to assign", K(ret));
} else if (OB_UNLIKELY(task->addr_ != part.addr_)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("access path uses invalid batch task", K(ret), K(task->addr_), K(part.addr_));
@ -912,17 +1175,11 @@ int ObAccessPathEstimation::add_index_info(ObOptimizerContext &ctx,
} else if (OB_ISNULL(index_est_arg = task->arg_.index_params_.alloc_place_holder())) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("failed to allocate index argument", K(ret));
} else if (OB_FAIL(get_key_ranges(ctx, allocator, part.tablet_id_, ap, tmp_ranges))) {
} else if (OB_FAIL(get_key_ranges(ctx, allocator, part.tablet_id_, ap, scan_ranges))) {
LOG_WARN("failed to get key ranges", K(ret));
} else if (OB_FAIL(ObOptimizerUtil::classify_get_scan_ranges(
tmp_ranges,
get_ranges,
scan_ranges))) {
LOG_WARN("failed to clasiffy get scan ranges", K(ret));
} else {
index_est_arg->index_id_ = ap->index_id_;
index_est_arg->scan_flag_.index_back_ = ap->est_cost_info_.index_meta_info_.is_index_back_;
index_est_arg->scan_flag_.disable_cache();
index_est_arg->range_columns_count_ = ap->est_cost_info_.range_columns_.count();
index_est_arg->tablet_id_ = part.tablet_id_;
index_est_arg->ls_id_ = part.ls_id_;
@ -934,26 +1191,8 @@ int ObAccessPathEstimation::add_index_info(ObOptimizerContext &ctx,
for (int64_t i = 0; ap->is_global_index_ && i < scan_ranges.count(); ++i) {
scan_ranges.at(i).table_id_ = ap->index_id_;
}
bool is_spatial_index = ap->est_cost_info_.index_meta_info_.is_geo_index_;
if (!is_spatial_index && scan_ranges.count() > ObOptEstCost::MAX_STORAGE_RANGE_ESTIMATION_NUM) {
ObArray<common::ObNewRange> valid_ranges;
for (int64_t i = 0; OB_SUCC(ret) && i < ObOptEstCost::MAX_STORAGE_RANGE_ESTIMATION_NUM; ++i) {
if (OB_FAIL(valid_ranges.push_back(scan_ranges.at(i)))) {
LOG_WARN("failed to push back array", K(ret));
}
}
if (OB_SUCC(ret)) {
if (OB_FAIL(scan_ranges.assign(valid_ranges))) {
LOG_WARN("failed to assgin valid ranges", K(ret));
}
}
}
if (OB_SUCC(ret)) {
if (!is_spatial_index && OB_FAIL(construct_scan_range_batch(allocator, scan_ranges, index_est_arg->batch_))) {
LOG_WARN("failed to construct scan range batch", K(ret));
} else if (is_spatial_index && OB_FAIL(construct_geo_scan_range_batch(allocator, scan_ranges, index_est_arg->batch_))) {
LOG_WARN("failed to construct spatial scan range batch", K(ret));
}
if (FAILEDx(construct_scan_range_batch(allocator, scan_ranges, index_est_arg->batch_))) {
LOG_WARN("failed to construct scan range batch", K(ret));
}
}
return ret;
@ -1246,8 +1485,7 @@ int ObAccessPathEstimation::construct_scan_range_batch(ObIAllocator &allocator,
range_array = new(ptr)SQLScanRangeArray();
batch.type_ = ObSimpleBatch::T_MULTI_SCAN;
batch.ranges_ = range_array;
int64_t size = std::min(scan_ranges.count(),
ObOptEstCost::MAX_STORAGE_RANGE_ESTIMATION_NUM);
int64_t size = scan_ranges.count();
for (int64_t i = 0; OB_SUCC(ret) && i < size; ++i) {
if (OB_FAIL(range_array->push_back(scan_ranges.at(i)))) {
LOG_WARN("failed to push back scan range", K(ret));
@ -1331,17 +1569,9 @@ int ObAccessPathEstimation::construct_geo_scan_range_batch(ObIAllocator &allocat
bool ObBatchEstTasks::check_result_reliable() const
{
bool bret = paths_.count() == res_.index_param_res_.count();
for (int64_t i = 0; bret && i < paths_.count(); ++i) {
bool bret = true;
for (int64_t i = 0; bret && i < res_.index_param_res_.count(); ++i) {
bret = res_.index_param_res_.at(i).reliable_;
if (bret && NULL != paths_.at(i)) {
if (paths_.at(i)->is_global_index_ &&
paths_.at(i)->est_cost_info_.ranges_.count() == 1 &&
paths_.at(i)->est_cost_info_.ranges_.at(0).is_whole_range() &&
res_.index_param_res_.at(i).logical_row_count_ == 0) {
bret = false;
}
}
}
return bret;
}
@ -1353,8 +1583,13 @@ int ObAccessPathEstimation::estimate_full_table_rowcount(ObOptimizerContext &ctx
int ret = OB_SUCCESS;
const ObCandiTabletLocIArray &part_loc_info_array =
table_part_info.get_phy_tbl_location_info().get_phy_part_loc_info_list();
//if the part loc infos is only 1, we can use the storage estimate rowcount to get real time stat.
if (is_virtual_table(meta.ref_table_id_) &&
int64_t partition_limit = 0;
if (OB_FAIL(ctx.get_global_hint().opt_params_.get_sys_var(ObOptParamHint::PARTITION_INDEX_DIVE_LIMIT,
ctx.get_session_info(),
share::SYS_VAR_PARTITION_INDEX_DIVE_LIMIT,
partition_limit))) {
LOG_WARN("failed to get hint system variable", K(ret));
} else if (is_virtual_table(meta.ref_table_id_) &&
!share::is_oracle_mapping_real_virtual_table(meta.ref_table_id_)) {
//do nothing
} else if (part_loc_info_array.count() == 1) {
@ -1363,6 +1598,12 @@ int ObAccessPathEstimation::estimate_full_table_rowcount(ObOptimizerContext &ctx
} else {
LOG_TRACE("succeed to storage estimate full table rowcount", K(meta));
}
} else if (part_loc_info_array.count() > 1 && partition_limit >= 0) {
if (OB_FAIL(storage_estimate_full_table_rowcount(ctx, part_loc_info_array, meta))) {
LOG_WARN("failed to storage estimate full table rowcount", K(ret));
} else {
LOG_TRACE("succeed to storage estimate full table rowcount", K(meta));
}
//if the part loc infos more than 1, we see the dml info inner table and storage inner table.
} else if (part_loc_info_array.count() > 1) {
ObSEArray<ObTabletID, 64> all_tablet_ids;
@ -1436,7 +1677,6 @@ int ObAccessPathEstimation::storage_estimate_full_table_rowcount(ObOptimizerCont
task.addr_ = best_index_part.addr_;
path_arg.scan_flag_.index_back_ = 0;
path_arg.scan_flag_.disable_cache();
path_arg.index_id_ = meta.ref_table_id_;
path_arg.range_columns_count_ = meta.table_rowkey_count_;
path_arg.batch_.type_ = ObSimpleBatch::T_SCAN;
@ -1475,6 +1715,114 @@ int ObAccessPathEstimation::storage_estimate_full_table_rowcount(ObOptimizerCont
return ret;
}
int ObAccessPathEstimation::storage_estimate_full_table_rowcount(ObOptimizerContext &ctx,
const ObCandiTabletLocIArray &part_loc_infos,
ObTableMetaInfo &meta)
{
int ret = OB_SUCCESS;
ObArenaAllocator arena("CardEstimation");
ObArray<ObBatchEstTasks *> tasks;
ObArray<ObAddr> prefer_addrs;
ObCandiTabletLocSEArray chosen_partitions;
bool need_fallback = false;
int64_t partition_limit = 0;
int64_t total_part_cnt = part_loc_infos.count();
if (OB_ISNULL(ctx.get_session_info())) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("get unexpected null", K(ret));
} else if ((is_virtual_table(meta.ref_table_id_) &&
!share::is_oracle_mapping_real_virtual_table(meta.ref_table_id_))
|| EXTERNAL_TABLE == meta.table_type_) {
need_fallback = true;
} else if (OB_FAIL(ctx.get_global_hint().opt_params_.get_sys_var(ObOptParamHint::PARTITION_INDEX_DIVE_LIMIT,
ctx.get_session_info(),
share::SYS_VAR_PARTITION_INDEX_DIVE_LIMIT,
partition_limit))) {
LOG_WARN("failed to get hint system variable", K(ret));
} else if (OB_FAIL(choose_storage_estimation_partitions(partition_limit,
part_loc_infos,
chosen_partitions))) {
LOG_WARN("failed to choose partitions", K(ret));
} else {
LOG_TRACE("choose partitions to estimate rowcount", K(chosen_partitions));
}
for (int64_t i = 0; OB_SUCC(ret) && !need_fallback && i < chosen_partitions.count(); i ++) {
EstimatedPartition best_index_part;
ObBatchEstTasks *task = NULL;
if (OB_FAIL(get_storage_estimation_task(ctx,
arena,
chosen_partitions.at(i),
meta,
prefer_addrs,
tasks,
best_index_part,
task))) {
LOG_WARN("failed to get task", K(ret));
} else if (NULL != task) {
obrpc::ObEstPartArgElement path_arg;
ObNewRange *range = NULL;
task->addr_ = best_index_part.addr_;
path_arg.scan_flag_.index_back_ = 0;
path_arg.index_id_ = meta.ref_table_id_;
path_arg.range_columns_count_ = meta.table_rowkey_count_;
path_arg.batch_.type_ = ObSimpleBatch::T_SCAN;
path_arg.tablet_id_ = best_index_part.tablet_id_;
path_arg.ls_id_ = best_index_part.ls_id_;
path_arg.tenant_id_ = ctx.get_session_info()->get_effective_tenant_id();
path_arg.tx_id_ = ctx.get_session_info()->get_tx_id();
if (OB_FAIL(ObSQLUtils::make_whole_range(arena,
meta.ref_table_id_,
meta.table_rowkey_count_,
range))) {
LOG_WARN("failed to make whole range", K(ret));
} else if (OB_ISNULL(path_arg.batch_.range_ = range)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("failed to generate whole range", K(ret), K(range));
} else if (OB_FAIL(task->arg_.index_params_.push_back(path_arg))) {
LOG_WARN("failed to add primary key estimation arg", K(ret));
}
}
}
for (int64_t i = 0; OB_SUCC(ret) && !need_fallback && i < tasks.count(); ++i) {
ObBatchEstTasks *task = NULL;
if (OB_ISNULL(task = tasks.at(i))) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("task is null", K(ret));
} else if (OB_FAIL(do_storage_estimation(ctx, *tasks.at(i)))) {
if (is_retry_ret(ret)) {
//retry code throw error, and retry
} else {
LOG_WARN("failed to process storage estimation", K(ret));
need_fallback = true;
ret = OB_SUCCESS;
}
} else if (!tasks.at(i)->check_result_reliable()) {
need_fallback = true;
LOG_WARN("storage estimation is not reliable", KPC(tasks.at(i)));
}
}
NG_TRACE(storage_estimation_end);
if (OB_SUCC(ret) && !need_fallback) {
double row_count = 0.0;
double partition_count = 0.0;
for (int64_t i = 0; i < tasks.count(); ++i) {
const ObBatchEstTasks *task = tasks.at(i);
for (int64_t j = 0; j < task->res_.index_param_res_.count(); ++j) {
const obrpc::ObEstPartResElement &res = task->res_.index_param_res_.at(j);
row_count += res.logical_row_count_;
partition_count += 1.0;
}
}
if (partition_count > 0) {
row_count *= part_loc_infos.count() / partition_count;
meta.table_row_count_ = row_count;
meta.average_row_size_ = static_cast<double>(ObOptStatManager::get_default_avg_row_size());
meta.part_size_ = row_count * meta.average_row_size_;
}
}
return ret;
}
int ObAccessPathEstimation::get_key_ranges(ObOptimizerContext &ctx,
ObIAllocator &allocator,
const ObTabletID &tablet_id,
@ -1485,8 +1833,6 @@ int ObAccessPathEstimation::get_key_ranges(ObOptimizerContext &ctx,
if (OB_ISNULL(ap)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("get unexpected null", K(ret), K(ap));
} else if (OB_FAIL(new_ranges.assign(ap->est_cost_info_.ranges_))) {
LOG_WARN("failed to assign", K(ret));
} else if (!share::is_oracle_mapping_real_virtual_table(ap->ref_table_id_)) {
//do nothing
} else if (OB_FAIL(convert_agent_vt_key_ranges(ctx, allocator, ap, new_ranges))) {

View File

@ -32,7 +32,7 @@ struct ObBatchEstTasks
bool check_result_reliable() const;
TO_STRING_KV(K_(addr));
TO_STRING_KV(K_(addr), K_(arg), K_(res));
};
class ObAccessPathEstimation
@ -59,6 +59,7 @@ public:
uint64_t ref_table_id,
bool &can_use);
private:
static const int STORAGE_EST_SAMPLE_SEED = 1;
static int inner_estimate_rowcount(ObOptimizerContext &ctx,
common::ObIArray<AccessPath *> &paths,
const bool is_inner_path,
@ -133,6 +134,24 @@ private:
static int process_storage_estimation(ObOptimizerContext &ctx,
ObIArray<AccessPath *> &paths,
bool &is_success);
static int get_storage_estimation_task(ObOptimizerContext &ctx,
ObIAllocator &arena,
const ObCandiTabletLoc &partition,
const ObTableMetaInfo &table_meta,
ObIArray<ObAddr> &prefer_addrs,
ObIArray<ObBatchEstTasks *> &tasks,
EstimatedPartition &best_index_part,
ObBatchEstTasks *&task);
static int process_storage_estimation_result(ObIArray<ObBatchEstTasks *> &tasks,
bool &is_reliable);
static int choose_storage_estimation_partitions(const int64_t partition_limit,
const ObCandiTabletLocIArray &partitions,
ObCandiTabletLocIArray &chosen_partitions);
static int choose_storage_estimation_ranges(const int64_t range_limit,
AccessPath *ap,
ObIArray<common::ObNewRange> &scan_ranges);
static int process_dynamic_sampling_estimation(ObOptimizerContext &ctx,
ObIArray<AccessPath *> &paths,
@ -170,7 +189,8 @@ private:
ObIAllocator &allocator,
ObBatchEstTasks *task,
const EstimatedPartition &part,
AccessPath *ap);
AccessPath *ap,
const ObIArray<common::ObNewRange> &chosen_scan_ranges);
static int construct_scan_range_batch(ObIAllocator &allocator,
const ObIArray<ObNewRange> &scan_ranges,
@ -183,7 +203,9 @@ private:
static bool is_multi_geo_range(const ObNewRange &range);
static int estimate_prefix_range_rowcount(
const obrpc::ObEstPartResElement &result,
const int64_t res_logical_row_count,
const int64_t res_physical_row_count,
const int64_t sample_partition_cnt,
ObCostTableScanInfo &est_cost_info);
static int fill_cost_table_scan_info(ObCostTableScanInfo &est_cost_info);
@ -214,6 +236,9 @@ private:
static int storage_estimate_full_table_rowcount(ObOptimizerContext &ctx,
const ObCandiTabletLoc &part_loc_info,
ObTableMetaInfo &meta);
static int storage_estimate_full_table_rowcount(ObOptimizerContext &ctx,
const ObCandiTabletLocIArray &part_loc_infos,
ObTableMetaInfo &meta);
static int estimate_full_table_rowcount_by_meta_table(ObOptimizerContext &ctx,
const ObIArray<ObTabletID> &all_tablet_ids,

View File

@ -760,21 +760,31 @@ int ObOptimizer::init_correlation_model(ObDMLStmt &stmt, const ObSQLSessionInfo
int ret = OB_SUCCESS;
ObEstCorrelationModel* correlation_model = NULL;
int64_t type = 0;
bool has_hint = false;
bool has_new_hint = false;
if (OB_ISNULL(ctx_.get_query_ctx())) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("unexpected null ctx", K(ret));
} else if (!ctx_.get_query_ctx()->check_opt_compat_version(COMPAT_VERSION_4_2_4, COMPAT_VERSION_4_3_0,
COMPAT_VERSION_4_3_3)) {
type = static_cast<int64_t>(ObEstCorrelationType::INDEPENDENT);
} else if (OB_FAIL(ctx_.get_global_hint().opt_params_.has_opt_param(ObOptParamHint::CORRELATION_FOR_CARDINALITY_ESTIMATION, has_hint))) {
} else if (OB_FAIL(ctx_.get_global_hint().opt_params_.has_opt_param(ObOptParamHint::CARDINALITY_ESTIMATION_MODEL, has_new_hint))) {
LOG_WARN("failed to check whether has hint param", K(ret));
} else if (has_hint) {
if (OB_FAIL(ctx_.get_global_hint().opt_params_.get_enum_opt_param(ObOptParamHint::CORRELATION_FOR_CARDINALITY_ESTIMATION, type))) {
LOG_WARN("failed to get bool hint param", K(ret));
} else {
/**
* 'cardinality_estimation_model' is same as the name of the system variable.
* 'correlation_for_cardinality_estimation' should be deprecated.
* So the former has a higher priority.
*/
ObOptParamHint::OptParamType opt_param_type = ObOptParamHint::CORRELATION_FOR_CARDINALITY_ESTIMATION;
if (has_new_hint) {
opt_param_type = ObOptParamHint::CARDINALITY_ESTIMATION_MODEL;
}
if (OB_FAIL(ctx_.get_global_hint().opt_params_.get_enum_sys_var(opt_param_type,
&session,
share::SYS_VAR_CARDINALITY_ESTIMATION_MODEL,
type))) {
LOG_WARN("failed to get hint param", K(ret));
}
} else if (OB_FAIL(session.get_sys_variable(share::SYS_VAR_CARDINALITY_ESTIMATION_MODEL, type))) {
LOG_WARN("failed to get sys variable", K(ret));
}
if (OB_SUCC(ret)) {
if (OB_UNLIKELY(type < 0) ||

View File

@ -1603,6 +1603,13 @@ public:
const ObIArray<TableItem*> &table_items,
const ObRawExpr *expr,
bool &is_filter);
template<typename T>
static int choose_random_members(const uint64_t seed,
const ObIArray<T> &input_array,
int64_t choose_cnt,
ObIArray<T> &output_array,
ObSqlBitSet<> *priority_indices = NULL);
private:
//disallow construct
ObOptimizerUtil();
@ -1777,6 +1784,60 @@ uint64_t ObOptimizerUtil::hash_exprs(uint64_t seed, const ObIArray<T> &expr_arra
return hash_value;
}
/**
* Select `choose_cnt` elements from the `input_array`. Preferentially selects elements
* at `priority_indices`, then randomly selects the remaining elements.
*/
template<typename T>
int ObOptimizerUtil::choose_random_members(const uint64_t seed,
const ObIArray<T> &input_array,
int64_t choose_cnt,
ObIArray<T> &output_array,
ObSqlBitSet<> *priority_indices)
{
int ret = OB_SUCCESS;
output_array.reuse();
if (choose_cnt <= 0) {
// do nothing
} else if (choose_cnt >= input_array.count()) {
if (OB_FAIL(output_array.assign(input_array))) {
SQL_OPT_LOG(WARN, "failed to assign", K(ret));
}
} else {
ObSEArray<int64_t, 8> indices; // shuffle indices and choose the first `choose_cnt` members
ObRandom r;
r.seed(seed);
int64_t already_choose = 0;
for (int64_t i = 0; OB_SUCC(ret) && i < input_array.count(); i ++) {
if (OB_FAIL(indices.push_back(i))) {
SQL_OPT_LOG(WARN, "failed to push back", K(ret));
}
}
if (NULL != priority_indices) {
for (int64_t i = 0; OB_SUCC(ret) && i < input_array.count() && already_choose < choose_cnt; i ++) {
if (priority_indices->has_member(i)) {
std::swap(indices.at(already_choose), indices.at(i));
already_choose ++;
}
}
}
if (OB_SUCC(ret)) {
for (int64_t i = already_choose; i < choose_cnt; i ++) {
int64_t rand_index = r.get(i, indices.count() - 1);
std::swap(indices.at(i), indices.at(rand_index));
}
lib::ob_sort(&indices.at(0), &indices.at(0) + choose_cnt);
}
for (int64_t i = 0; OB_SUCC(ret) && i < choose_cnt; i ++) {
if (OB_FAIL(output_array.push_back(input_array.at(indices.at(i))))) {
SQL_OPT_LOG(WARN, "failed to push back", K(ret));
}
}
}
SQL_OPT_LOG(DEBUG, "succeed to choose random members",
K(choose_cnt), KPC(priority_indices), K(output_array));
return ret;
}
#define HASH_ARRAY(items, seed) \
do { \

View File

@ -6832,6 +6832,13 @@ STRING_VALUE
$$->type_ = T_INT;
$$->param_num_ = 1;
}
| NEG_SIGN INTNUM
{
$$ = $2;
$$->value_ = -$$->value_;
$$->type_ = T_INT;
$$->param_num_ = 1;
}
charset_name:
NAME_OB

View File

@ -898,7 +898,8 @@ bool ObOptParamHint::is_param_val_valid(const OptParamType param_type, const ObO
is_valid = val.is_int() && (0 <= val.get_int() && val.get_int() <= 4);
break;
}
case CORRELATION_FOR_CARDINALITY_ESTIMATION: {
case CORRELATION_FOR_CARDINALITY_ESTIMATION:
case CARDINALITY_ESTIMATION_MODEL: {
if (val.is_int()) {
is_valid = 0 <= val.get_int() && val.get_int() < static_cast<int64_t>(ObEstCorrelationType::MAX);
} else if (val.is_varchar()) {
@ -913,6 +914,10 @@ bool ObOptParamHint::is_param_val_valid(const OptParamType param_type, const ObO
|| 0 == val.get_varchar().case_compare("false"));
break;
}
case RANGE_INDEX_DIVE_LIMIT:
case PARTITION_INDEX_DIVE_LIMIT:
is_valid = val.is_int();
break;
case OB_TABLE_ACCESS_POLICY: {
if (val.is_int()) {
is_valid = 0 <= val.get_int() && val.get_int() < static_cast<int64_t>(ObTableAccessPolicy::MAX);
@ -1046,7 +1051,8 @@ int ObOptParamHint::get_enum_opt_param(const OptParamType param_type, int64_t &v
val = obj.get_int();
} else if (obj.is_varchar()) {
switch (param_type) {
case CORRELATION_FOR_CARDINALITY_ESTIMATION: {
case CORRELATION_FOR_CARDINALITY_ESTIMATION:
case CARDINALITY_ESTIMATION_MODEL: {
ObSysVarCardinalityEstimationModel sv;
if (OB_FAIL(sv.find_type(obj.get_varchar(), val))) {
LOG_WARN("param obj is invalid", K(ret), K(obj));
@ -1097,6 +1103,56 @@ int ObOptParamHint::check_and_get_bool_opt_param(const OptParamType param_type,
return ret;
}
template<typename T, ObOptParamHint::GET_PARAM_FUNC<T> PARAM_FUNC>
int ObOptParamHint::inner_get_sys_var(const OptParamType param_type,
const ObSQLSessionInfo *session,
const share::ObSysVarClassType sys_var_id,
T &val) const
{
int ret = OB_SUCCESS;
bool has_hint = false;
if (OB_ISNULL(session)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("unexpected null", K(session));
} else if (OB_FAIL(has_opt_param(param_type, has_hint))) {
LOG_WARN("failed to check whether has hint param", K(ret));
} else if (has_hint) {
if (OB_FAIL((this->*PARAM_FUNC)(param_type, val))) {
LOG_WARN("failed to get bool hint param", K(ret));
}
} else if (OB_FAIL(session->get_sys_variable(sys_var_id, val))) {
LOG_WARN("failed to get sys variable", K(ret));
}
return ret;
}
int ObOptParamHint::get_sys_var(const OptParamType param_type,
const ObSQLSessionInfo *session,
const share::ObSysVarClassType sys_var_id,
int64_t &val) const
{
return inner_get_sys_var<int64_t, &ObOptParamHint::get_integer_opt_param>
(param_type, session, sys_var_id, val);
}
int ObOptParamHint::get_sys_var(const OptParamType param_type,
const ObSQLSessionInfo *session,
const share::ObSysVarClassType sys_var_id,
bool &val) const
{
return inner_get_sys_var<bool, &ObOptParamHint::get_bool_opt_param>
(param_type, session, sys_var_id, val);
}
int ObOptParamHint::get_enum_sys_var(const OptParamType param_type,
const ObSQLSessionInfo *session,
const share::ObSysVarClassType sys_var_id,
int64_t &val) const
{
return inner_get_sys_var<int64_t, &ObOptParamHint::get_enum_opt_param>
(param_type, session, sys_var_id, val);
}
void ObOptParamHint::reset()
{
param_types_.reuse();

View File

@ -176,7 +176,10 @@ struct ObOptParamHint
DEF(RUNTIME_FILTER_TYPE,) \
DEF(BLOOM_FILTER_RATIO,) \
DEF(CORRELATION_FOR_CARDINALITY_ESTIMATION,) \
DEF(CARDINALITY_ESTIMATION_MODEL,) \
DEF(_PUSH_JOIN_PREDICATE,) \
DEF(RANGE_INDEX_DIVE_LIMIT,) \
DEF(PARTITION_INDEX_DIVE_LIMIT,) \
DEF(OB_TABLE_ACCESS_POLICY,) \
DECLARE_ENUM(OptParamType, opt_param, OPT_PARAM_TYPE_DEF, static);
@ -197,6 +200,26 @@ struct ObOptParamHint
int get_opt_param_runtime_filter_type(int64_t &rf_type) const;
int get_enum_opt_param(const OptParamType param_type, int64_t &val) const;
int has_opt_param(const OptParamType param_type, bool &has_hint) const;
template<typename T>
using GET_PARAM_FUNC = int (ObOptParamHint::*)(const OptParamType, T&) const;
template<typename T, GET_PARAM_FUNC<T> PARAM_FUNC>
int inner_get_sys_var(const OptParamType param_type,
const ObSQLSessionInfo *session,
const share::ObSysVarClassType sys_var_id,
T &val) const;
int get_sys_var(const OptParamType param_type,
const ObSQLSessionInfo *session,
const share::ObSysVarClassType sys_var_id,
int64_t &val) const;
int get_sys_var(const OptParamType param_type,
const ObSQLSessionInfo *session,
const share::ObSysVarClassType sys_var_id,
bool &val) const;
int get_enum_sys_var(const OptParamType param_type,
const ObSQLSessionInfo *session,
const share::ObSysVarClassType sys_var_id,
int64_t &val) const;
bool empty() const { return param_types_.empty(); }
int check_and_get_bool_opt_param(const OptParamType param_type, bool &has_opt_param, bool &val) const;
void reset();

View File

@ -2150,6 +2150,11 @@ int ObBasicSessionInfo::get_sys_variable(const ObSysVarClassType sys_var_id, uin
return ret;
}
int ObBasicSessionInfo::get_sys_variable(const ObSysVarClassType sys_var_id, bool &val) const
{
return get_bool_sys_var(sys_var_id, val);
}
int ObBasicSessionInfo::sys_variable_exists(const ObString &var, bool &is_exists) const
{
int ret = OB_SUCCESS;

View File

@ -990,6 +990,7 @@ public:
int get_sys_variable(const share::ObSysVarClassType sys_var_id, common::ObString &val) const;
int get_sys_variable(const share::ObSysVarClassType sys_var_id, int64_t &val) const;
int get_sys_variable(const share::ObSysVarClassType sys_var_id, uint64_t &val) const;
int get_sys_variable(const share::ObSysVarClassType sys_var_id, bool &val) const;
int get_sys_variable(const share::ObSysVarClassType sys_var_id, share::ObBasicSysVar *&val) const;
/// @note get system variables by id is prefered
int get_sys_variable_by_name(const common::ObString &var, common::ObObj &val) const;

File diff suppressed because it is too large Load Diff

View File

@ -198595,9 +198595,9 @@ Query Plan
|0 |SCALAR GROUP BY | |1 |6 |
|1 |└─PX COORDINATOR | |1 |6 |
|2 | └─EXCHANGE OUT DISTR |:EX10000 |1 |6 |
|3 | └─MERGE GROUP BY | |1 |6 |
|4 | └─PX PARTITION ITERATOR| |12 |5 |
|5 | └─TABLE FULL SCAN |table1000_key_pk_parts_2|12 |5 |
|3 | └─MERGE GROUP BY | |1 |5 |
|4 | └─PX PARTITION ITERATOR| |2 |5 |
|5 | └─TABLE FULL SCAN |table1000_key_pk_parts_2|2 |5 |
=================================================================================
Outputs & filters:
-------------------------------------

View File

@ -571,12 +571,12 @@ Query Plan
============================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
----------------------------------------------------------------------------
|0 |PX COORDINATOR MERGE SORT | |1 |61 |
|1 |└─EXCHANGE OUT DISTR |:EX10001 |1 |60 |
|2 | └─MERGE GROUP BY | |1 |60 |
|3 | └─EXCHANGE IN MERGE SORT DISTR | |20 |58 |
|4 | └─EXCHANGE OUT DISTR (HASH) |:EX10000 |20 |50 |
|5 | └─MERGE GROUP BY | |20 |31 |
|0 |PX COORDINATOR MERGE SORT | |1 |59 |
|1 |└─EXCHANGE OUT DISTR |:EX10001 |1 |59 |
|2 | └─MERGE GROUP BY | |1 |59 |
|3 | └─EXCHANGE IN MERGE SORT DISTR | |19 |56 |
|4 | └─EXCHANGE OUT DISTR (HASH) |:EX10000 |19 |48 |
|5 | └─MERGE GROUP BY | |19 |31 |
|6 | └─SORT | |20 |29 |
|7 | └─PX PARTITION ITERATOR| |20 |27 |
|8 | └─TABLE FULL SCAN |t_h3_r4_01_20|20 |27 |
@ -626,15 +626,15 @@ Query Plan
============================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
----------------------------------------------------------------------------
|0 |PX COORDINATOR MERGE SORT | |1 |67 |
|1 |└─EXCHANGE OUT DISTR |:EX10001 |1 |67 |
|2 | └─MERGE GROUP BY | |1 |67 |
|3 | └─EXCHANGE IN MERGE SORT DISTR | |20 |64 |
|4 | └─EXCHANGE OUT DISTR (HASH) |:EX10000 |20 |56 |
|5 | └─MERGE GROUP BY | |20 |37 |
|6 | └─SORT | |20 |35 |
|7 | └─PX PARTITION ITERATOR| |20 |33 |
|8 | └─TABLE FULL SCAN |t_h3_r5_09_28|20 |33 |
|0 |PX COORDINATOR MERGE SORT | |1 |69 |
|1 |└─EXCHANGE OUT DISTR |:EX10001 |1 |68 |
|2 | └─MERGE GROUP BY | |1 |68 |
|3 | └─EXCHANGE IN MERGE SORT DISTR | |21 |66 |
|4 | └─EXCHANGE OUT DISTR (HASH) |:EX10000 |21 |57 |
|5 | └─MERGE GROUP BY | |21 |37 |
|6 | └─SORT | |21 |35 |
|7 | └─PX PARTITION ITERATOR| |21 |33 |
|8 | └─TABLE FULL SCAN |t_h3_r5_09_28|21 |33 |
============================================================================
Outputs & filters:
-------------------------------------
@ -736,15 +736,15 @@ Query Plan
============================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
----------------------------------------------------------------------------
|0 |PX COORDINATOR MERGE SORT | |1 |88 |
|1 |└─EXCHANGE OUT DISTR |:EX10001 |1 |88 |
|2 | └─MERGE GROUP BY | |1 |88 |
|3 | └─EXCHANGE IN MERGE SORT DISTR | |20 |85 |
|4 | └─EXCHANGE OUT DISTR (HASH) |:EX10000 |20 |77 |
|5 | └─MERGE GROUP BY | |20 |58 |
|6 | └─SORT | |20 |56 |
|7 | └─PX PARTITION ITERATOR| |20 |54 |
|8 | └─TABLE FULL SCAN |t_h5_r5_09_28|20 |54 |
|0 |PX COORDINATOR MERGE SORT | |1 |91 |
|1 |└─EXCHANGE OUT DISTR |:EX10001 |1 |91 |
|2 | └─MERGE GROUP BY | |1 |91 |
|3 | └─EXCHANGE IN MERGE SORT DISTR | |22 |89 |
|4 | └─EXCHANGE OUT DISTR (HASH) |:EX10000 |22 |79 |
|5 | └─MERGE GROUP BY | |22 |59 |
|6 | └─SORT | |23 |57 |
|7 | └─PX PARTITION ITERATOR| |23 |54 |
|8 | └─TABLE FULL SCAN |t_h5_r5_09_28|23 |54 |
============================================================================
Outputs & filters:
-------------------------------------
@ -1239,11 +1239,11 @@ Query Plan
====================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
--------------------------------------------------------------------
|0 |PX COORDINATOR MERGE SORT | |12 |39 |
|1 |└─EXCHANGE OUT DISTR |:EX10000 |12 |36 |
|2 | └─SORT | |12 |28 |
|3 | └─PX PARTITION ITERATOR| |12 |26 |
|4 | └─TABLE RANGE SCAN |t_h3_r4_01_20|12 |26 |
|0 |PX COORDINATOR MERGE SORT | |14 |41 |
|1 |└─EXCHANGE OUT DISTR |:EX10000 |14 |37 |
|2 | └─SORT | |14 |28 |
|3 | └─PX PARTITION ITERATOR| |14 |26 |
|4 | └─TABLE RANGE SCAN |t_h3_r4_01_20|14 |26 |
====================================================================
Outputs & filters:
-------------------------------------
@ -1282,11 +1282,11 @@ Query Plan
====================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
--------------------------------------------------------------------
|0 |PX COORDINATOR MERGE SORT | |12 |46 |
|1 |└─EXCHANGE OUT DISTR |:EX10000 |12 |42 |
|2 | └─SORT | |12 |34 |
|3 | └─PX PARTITION ITERATOR| |12 |33 |
|4 | └─TABLE RANGE SCAN |t_h3_r5_09_28|12 |33 |
|0 |PX COORDINATOR MERGE SORT | |11 |44 |
|1 |└─EXCHANGE OUT DISTR |:EX10000 |11 |41 |
|2 | └─SORT | |11 |34 |
|3 | └─PX PARTITION ITERATOR| |11 |33 |
|4 | └─TABLE RANGE SCAN |t_h3_r5_09_28|11 |33 |
====================================================================
Outputs & filters:
-------------------------------------
@ -1325,11 +1325,11 @@ Query Plan
====================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
--------------------------------------------------------------------
|0 |PX COORDINATOR MERGE SORT | |12 |56 |
|1 |└─EXCHANGE OUT DISTR |:EX10000 |12 |53 |
|2 | └─SORT | |12 |44 |
|3 | └─PX PARTITION ITERATOR| |12 |43 |
|4 | └─TABLE RANGE SCAN |t_h5_r4_01_20|12 |43 |
|0 |PX COORDINATOR MERGE SORT | |14 |59 |
|1 |└─EXCHANGE OUT DISTR |:EX10000 |14 |54 |
|2 | └─SORT | |14 |45 |
|3 | └─PX PARTITION ITERATOR| |14 |43 |
|4 | └─TABLE RANGE SCAN |t_h5_r4_01_20|14 |43 |
====================================================================
Outputs & filters:
-------------------------------------
@ -1368,11 +1368,11 @@ Query Plan
====================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
--------------------------------------------------------------------
|0 |PX COORDINATOR MERGE SORT | |12 |67 |
|1 |└─EXCHANGE OUT DISTR |:EX10000 |12 |63 |
|2 | └─SORT | |12 |55 |
|3 | └─PX PARTITION ITERATOR| |12 |54 |
|4 | └─TABLE RANGE SCAN |t_h5_r5_09_28|12 |54 |
|0 |PX COORDINATOR MERGE SORT | |10 |64 |
|1 |└─EXCHANGE OUT DISTR |:EX10000 |10 |61 |
|2 | └─SORT | |10 |55 |
|3 | └─PX PARTITION ITERATOR| |10 |53 |
|4 | └─TABLE RANGE SCAN |t_h5_r5_09_28|10 |53 |
====================================================================
Outputs & filters:
-------------------------------------
@ -2251,7 +2251,7 @@ Query Plan
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
---------------------------------------------------------------------
|0 |PX COORDINATOR | |4 |54 |
|1 |└─EXCHANGE OUT DISTR |:EX10001|4 |48 |
|1 |└─EXCHANGE OUT DISTR |:EX10001|4 |47 |
|2 | └─HASH JOIN | |4 |33 |
|3 | ├─PX PARTITION ITERATOR | |4 |9 |
|4 | │ └─TABLE FULL SCAN |t1 |4 |9 |
@ -2297,7 +2297,7 @@ Query Plan
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
---------------------------------------------------------------------
|0 |PX COORDINATOR | |4 |54 |
|1 |└─EXCHANGE OUT DISTR |:EX10001|4 |48 |
|1 |└─EXCHANGE OUT DISTR |:EX10001|4 |47 |
|2 | └─HASH JOIN | |4 |33 |
|3 | ├─PX PARTITION ITERATOR | |4 |9 |
|4 | │ └─TABLE FULL SCAN |t1 |4 |9 |
@ -4044,7 +4044,7 @@ Query Plan
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
---------------------------------------------------------------------
|0 |PX COORDINATOR | |4 |54 |
|1 |└─EXCHANGE OUT DISTR |:EX10001|4 |48 |
|1 |└─EXCHANGE OUT DISTR |:EX10001|4 |47 |
|2 | └─HASH JOIN | |4 |33 |
|3 | ├─PX PARTITION ITERATOR | |4 |9 |
|4 | │ └─TABLE FULL SCAN |t1 |4 |9 |
@ -4090,7 +4090,7 @@ Query Plan
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
---------------------------------------------------------------------
|0 |PX COORDINATOR | |4 |54 |
|1 |└─EXCHANGE OUT DISTR |:EX10001|4 |48 |
|1 |└─EXCHANGE OUT DISTR |:EX10001|4 |47 |
|2 | └─HASH JOIN | |4 |33 |
|3 | ├─PX PARTITION ITERATOR | |4 |9 |
|4 | │ └─TABLE FULL SCAN |t1 |4 |9 |

View File

@ -629,7 +629,7 @@ Query Plan
=========================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------------
|0 |TABLE FULL SCAN|p(idx_geohash_code_geog_poi_7)|1 |203 |
|0 |TABLE FULL SCAN|p(idx_geohash_code_geog_poi_7)|1 |201 |
=========================================================================
Outputs & filters:
-------------------------------------
@ -693,7 +693,7 @@ Query Plan
==============================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------------------
|0 |TABLE FULL SCAN|highway_621(idx_the_geom_highway_6)|12 |2946 |
|0 |TABLE FULL SCAN|highway_621(idx_the_geom_highway_6)|1 |449 |
==============================================================================
Outputs & filters:
-------------------------------------

View File

@ -269,7 +269,7 @@ Query Plan
=================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------
|0 |TABLE FULL SCAN|t(idx)|4 |879 |
|0 |TABLE FULL SCAN|t(idx)|4 |868 |
=================================================
Outputs & filters:
-------------------------------------
@ -394,7 +394,7 @@ Query Plan
=================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------
|0 |TABLE FULL SCAN|t(idx)|1 |163 |
|0 |TABLE FULL SCAN|t(idx)|2 |471 |
=================================================
Outputs & filters:
-------------------------------------
@ -437,10 +437,10 @@ Optimization Info:
-------------------------------------
t:
table_rows:8
physical_range_rows:1
logical_range_rows:1
index_back_rows:0
output_rows:0
physical_range_rows:12
logical_range_rows:12
index_back_rows:3
output_rows:1
table_dop:1
dop_method:Table DOP
avaiable_index_name:[idx, t]
@ -972,7 +972,7 @@ Query Plan
===========================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------
|0 |TABLE FULL SCAN|geo_table2(geom)|1 |218 |
|0 |TABLE FULL SCAN|geo_table2(geom)|1 |215 |
===========================================================
Outputs & filters:
-------------------------------------
@ -1042,7 +1042,7 @@ Query Plan
===========================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------
|0 |TABLE FULL SCAN|geo_table2(geom)|1 |218 |
|0 |TABLE FULL SCAN|geo_table2(geom)|1 |215 |
===========================================================
Outputs & filters:
-------------------------------------
@ -1127,8 +1127,8 @@ Query Plan
============================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------
|0 |SORT | |1 |218 |
|1 |└─TABLE FULL SCAN|geo_table(geom)|1 |218 |
|0 |SORT | |1 |159 |
|1 |└─TABLE FULL SCAN|geo_table(geom)|1 |159 |
============================================================
Outputs & filters:
-------------------------------------
@ -1172,8 +1172,8 @@ Optimization Info:
-------------------------------------
geo_table:
table_rows:6
physical_range_rows:3
logical_range_rows:3
physical_range_rows:1
logical_range_rows:1
index_back_rows:0
output_rows:0
table_dop:1
@ -1534,7 +1534,7 @@ Query Plan
=================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------
|0 |TABLE FULL SCAN|t(idx)|5 |1128 |
|0 |TABLE FULL SCAN|t(idx)|4 |1016 |
=================================================
Outputs & filters:
-------------------------------------
@ -1578,10 +1578,10 @@ Optimization Info:
-------------------------------------
t:
table_rows:14
physical_range_rows:35
logical_range_rows:35
index_back_rows:8
output_rows:4
physical_range_rows:31
logical_range_rows:31
index_back_rows:7
output_rows:3
table_dop:1
dop_method:Table DOP
avaiable_index_name:[idx, t]
@ -1660,7 +1660,7 @@ Query Plan
=================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------
|0 |TABLE FULL SCAN|t(idx)|4 |1032 |
|0 |TABLE FULL SCAN|t(idx)|4 |835 |
=================================================
Outputs & filters:
-------------------------------------
@ -1703,10 +1703,10 @@ Optimization Info:
-------------------------------------
t:
table_rows:14
physical_range_rows:32
logical_range_rows:32
index_back_rows:8
output_rows:4
physical_range_rows:25
logical_range_rows:25
index_back_rows:6
output_rows:3
table_dop:1
dop_method:Table DOP
avaiable_index_name:[idx, t]
@ -1960,7 +1960,7 @@ Query Plan
=================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------
|0 |TABLE FULL SCAN|t(idx)|1 |304 |
|0 |TABLE FULL SCAN|t(idx)|1 |299 |
=================================================
Outputs & filters:
-------------------------------------
@ -2022,7 +2022,7 @@ Query Plan
=================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------
|0 |TABLE FULL SCAN|t(idx)|1 |304 |
|0 |TABLE FULL SCAN|t(idx)|1 |299 |
=================================================
Outputs & filters:
-------------------------------------
@ -2084,7 +2084,7 @@ Query Plan
=================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------
|0 |TABLE FULL SCAN|t(idx)|1 |304 |
|0 |TABLE FULL SCAN|t(idx)|1 |299 |
=================================================
Outputs & filters:
-------------------------------------
@ -2146,7 +2146,7 @@ Query Plan
=================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------
|0 |TABLE FULL SCAN|t(idx)|7 |1526 |
|0 |TABLE FULL SCAN|t(idx)|7 |1596 |
=================================================
Outputs & filters:
-------------------------------------
@ -2189,9 +2189,9 @@ Optimization Info:
-------------------------------------
t:
table_rows:14
physical_range_rows:49
logical_range_rows:49
index_back_rows:12
physical_range_rows:52
logical_range_rows:52
index_back_rows:13
output_rows:6
table_dop:1
dop_method:Table DOP
@ -2209,7 +2209,7 @@ Query Plan
=================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------
|0 |TABLE FULL SCAN|t(idx)|1 |304 |
|0 |TABLE FULL SCAN|t(idx)|1 |299 |
=================================================
Outputs & filters:
-------------------------------------
@ -2271,7 +2271,7 @@ Query Plan
=================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------
|0 |TABLE FULL SCAN|t(idx)|1 |314 |
|0 |TABLE FULL SCAN|t(idx)|4 |1032 |
=================================================
Outputs & filters:
-------------------------------------
@ -2314,10 +2314,10 @@ Optimization Info:
-------------------------------------
t:
table_rows:14
physical_range_rows:6
logical_range_rows:6
index_back_rows:1
output_rows:0
physical_range_rows:32
logical_range_rows:32
index_back_rows:8
output_rows:4
table_dop:1
dop_method:Table DOP
avaiable_index_name:[idx, t]
@ -2397,7 +2397,7 @@ Query Plan
=================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------
|0 |TABLE FULL SCAN|t(idx)|1 |304 |
|0 |TABLE FULL SCAN|t(idx)|1 |299 |
=================================================
Outputs & filters:
-------------------------------------
@ -2645,7 +2645,7 @@ Query Plan
=================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------
|0 |TABLE FULL SCAN|t(idx)|5 |1128 |
|0 |TABLE FULL SCAN|t(idx)|4 |1016 |
=================================================
Outputs & filters:
-------------------------------------
@ -2689,10 +2689,10 @@ Optimization Info:
-------------------------------------
t:
table_rows:14
physical_range_rows:35
logical_range_rows:35
index_back_rows:8
output_rows:4
physical_range_rows:31
logical_range_rows:31
index_back_rows:7
output_rows:3
table_dop:1
dop_method:Table DOP
avaiable_index_name:[idx, t]
@ -2771,7 +2771,7 @@ Query Plan
=================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------
|0 |TABLE FULL SCAN|t(idx)|4 |1032 |
|0 |TABLE FULL SCAN|t(idx)|4 |835 |
=================================================
Outputs & filters:
-------------------------------------
@ -2814,10 +2814,10 @@ Optimization Info:
-------------------------------------
t:
table_rows:14
physical_range_rows:32
logical_range_rows:32
index_back_rows:8
output_rows:4
physical_range_rows:25
logical_range_rows:25
index_back_rows:6
output_rows:3
table_dop:1
dop_method:Table DOP
avaiable_index_name:[idx, t]
@ -3173,7 +3173,7 @@ Query Plan
========================================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
----------------------------------------------------------------------------------------
|0 |TABLE FULL SCAN|spatial_point_in_line(index_spatial_line_geo)|1 |324 |
|0 |TABLE FULL SCAN|spatial_point_in_line(index_spatial_line_geo)|2 |392 |
========================================================================================
Outputs & filters:
-------------------------------------

View File

@ -270,7 +270,7 @@ Query Plan
================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------
|0 |TABLE FULL SCAN|t1(g)|1 |159 |
|0 |TABLE FULL SCAN|t1(g)|2 |383 |
================================================
Outputs & filters:
-------------------------------------
@ -295,7 +295,7 @@ Query Plan
================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------
|0 |TABLE FULL SCAN|t1(g)|1 |159 |
|0 |TABLE FULL SCAN|t1(g)|2 |383 |
================================================
Outputs & filters:
-------------------------------------
@ -320,7 +320,7 @@ Query Plan
================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------
|0 |TABLE FULL SCAN|t1(g)|1 |159 |
|0 |TABLE FULL SCAN|t1(g)|2 |383 |
================================================
Outputs & filters:
-------------------------------------
@ -345,7 +345,7 @@ Query Plan
================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------
|0 |TABLE FULL SCAN|t1(g)|1 |159 |
|0 |TABLE FULL SCAN|t1(g)|2 |383 |
================================================
Outputs & filters:
-------------------------------------

View File

@ -61,10 +61,10 @@ Query Plan
=============================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------
|0 |PX COORDINATOR | |2 |544 |
|1 |└─EXCHANGE OUT DISTR |:EX10000|2 |543 |
|2 | └─PX PARTITION ITERATOR| |2 |541 |
|3 | └─TABLE FULL SCAN |t1(idx) |2 |541 |
|0 |PX COORDINATOR | |1 |289 |
|1 |└─EXCHANGE OUT DISTR |:EX10000|1 |289 |
|2 | └─PX PARTITION ITERATOR| |1 |289 |
|3 | └─TABLE FULL SCAN |t1(idx) |1 |289 |
=============================================================
Outputs & filters:
-------------------------------------

View File

@ -36,8 +36,8 @@ Query Plan
=================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------------
|0 |SORT | |5 |283 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t1(gkey)|5 |282 |
|0 |SORT | |5 |154 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t1(gkey)|5 |153 |
=================================================================
Outputs & filters:
-------------------------------------
@ -147,8 +147,8 @@ Query Plan
=================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------------
|0 |SORT | |5 |283 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t2(gkey)|5 |282 |
|0 |SORT | |5 |154 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t2(gkey)|5 |153 |
=================================================================
Outputs & filters:
-------------------------------------
@ -258,8 +258,8 @@ Query Plan
=================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------------
|0 |SORT | |5 |283 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t3(gkey)|5 |282 |
|0 |SORT | |5 |154 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t3(gkey)|5 |153 |
=================================================================
Outputs & filters:
-------------------------------------
@ -369,8 +369,8 @@ Query Plan
=================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------------
|0 |SORT | |5 |283 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t4(gkey)|5 |282 |
|0 |SORT | |5 |154 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t4(gkey)|5 |153 |
=================================================================
Outputs & filters:
-------------------------------------
@ -480,8 +480,8 @@ Query Plan
=================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------------
|0 |SORT | |5 |283 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t5(gkey)|5 |282 |
|0 |SORT | |5 |154 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t5(gkey)|5 |153 |
=================================================================
Outputs & filters:
-------------------------------------
@ -629,9 +629,9 @@ Query Plan
================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
----------------------------------------------------------------
|0 |SUBPLAN FILTER | |1 |143 |
|0 |SUBPLAN FILTER | |1 |93 |
|1 |├─TABLE FULL SCAN |t1 |2 |3 |
|2 |└─DISTRIBUTED TABLE RANGE SCAN|t2(i1)|1 |71 |
|2 |└─DISTRIBUTED TABLE RANGE SCAN|t2(i1)|1 |46 |
================================================================
Outputs & filters:
-------------------------------------

View File

@ -35,8 +35,8 @@ Query Plan
=================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------------
|0 |SORT | |5 |283 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t6(gkey)|5 |282 |
|0 |SORT | |5 |154 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t6(gkey)|5 |153 |
=================================================================
Outputs & filters:
-------------------------------------
@ -146,8 +146,8 @@ Query Plan
=================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------------
|0 |SORT | |5 |283 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t7(gkey)|5 |282 |
|0 |SORT | |5 |154 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t7(gkey)|5 |153 |
=================================================================
Outputs & filters:
-------------------------------------
@ -258,8 +258,8 @@ Query Plan
=================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------------
|0 |SORT | |5 |283 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t8(gkey)|5 |282 |
|0 |SORT | |5 |154 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t8(gkey)|5 |153 |
=================================================================
Outputs & filters:
-------------------------------------
@ -369,8 +369,8 @@ Query Plan
=================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------------
|0 |SORT | |5 |283 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t9(gkey)|5 |282 |
|0 |SORT | |5 |154 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t9(gkey)|5 |153 |
=================================================================
Outputs & filters:
-------------------------------------
@ -480,8 +480,8 @@ Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |283 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t10(gkey)|5 |282 |
|0 |SORT | |5 |154 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t10(gkey)|5 |153 |
==================================================================
Outputs & filters:
-------------------------------------

View File

@ -78,8 +78,8 @@ Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |283 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t11(gkey)|5 |282 |
|0 |SORT | |5 |154 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t11(gkey)|5 |153 |
==================================================================
Outputs & filters:
-------------------------------------
@ -189,8 +189,8 @@ Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |283 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t12(gkey)|5 |282 |
|0 |SORT | |5 |154 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t12(gkey)|5 |153 |
==================================================================
Outputs & filters:
-------------------------------------
@ -300,8 +300,8 @@ Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |283 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t13(gkey)|5 |282 |
|0 |SORT | |5 |154 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t13(gkey)|5 |153 |
==================================================================
Outputs & filters:
-------------------------------------
@ -412,8 +412,8 @@ Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |283 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t14(gkey)|5 |282 |
|0 |SORT | |5 |154 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t14(gkey)|5 |153 |
==================================================================
Outputs & filters:
-------------------------------------
@ -523,8 +523,8 @@ Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |283 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t15(gkey)|5 |282 |
|0 |SORT | |5 |154 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t15(gkey)|5 |153 |
==================================================================
Outputs & filters:
-------------------------------------

View File

@ -84,8 +84,8 @@ Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |283 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t21(gkey)|5 |282 |
|0 |SORT | |5 |154 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t21(gkey)|5 |153 |
==================================================================
Outputs & filters:
-------------------------------------
@ -196,8 +196,8 @@ Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |283 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t22(gkey)|5 |282 |
|0 |SORT | |5 |154 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t22(gkey)|5 |153 |
==================================================================
Outputs & filters:
-------------------------------------
@ -307,8 +307,8 @@ Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |283 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t23(gkey)|5 |282 |
|0 |SORT | |5 |154 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t23(gkey)|5 |153 |
==================================================================
Outputs & filters:
-------------------------------------
@ -418,8 +418,8 @@ Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |283 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t24(gkey)|5 |282 |
|0 |SORT | |5 |154 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t24(gkey)|5 |153 |
==================================================================
Outputs & filters:
-------------------------------------
@ -529,8 +529,8 @@ Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |283 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t25(gkey)|5 |282 |
|0 |SORT | |5 |154 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t25(gkey)|5 |153 |
==================================================================
Outputs & filters:
-------------------------------------

View File

@ -476,7 +476,7 @@ Query Plan
=================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------------
|0 |MERGE JOIN | |6 |35 |
|0 |MERGE JOIN | |5 |35 |
|1 |├─PX COORDINATOR MERGE SORT | |5 |17 |
|2 |│ └─EXCHANGE OUT DISTR |:EX10000|5 |15 |
|3 |│ └─SORT | |5 |12 |
@ -527,7 +527,7 @@ Query Plan
=================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------------
|0 |MERGE JOIN | |6 |35 |
|0 |MERGE JOIN | |5 |35 |
|1 |├─PX COORDINATOR MERGE SORT | |5 |17 |
|2 |│ └─EXCHANGE OUT DISTR |:EX10000|5 |15 |
|3 |│ └─SORT | |5 |12 |
@ -578,7 +578,7 @@ Query Plan
=================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------------
|0 |MERGE JOIN | |6 |35 |
|0 |MERGE JOIN | |5 |35 |
|1 |├─PX COORDINATOR MERGE SORT | |5 |17 |
|2 |│ └─EXCHANGE OUT DISTR |:EX10000|5 |15 |
|3 |│ └─SORT | |5 |12 |
@ -629,7 +629,7 @@ Query Plan
=================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------------
|0 |MERGE JOIN | |6 |35 |
|0 |MERGE JOIN | |5 |35 |
|1 |├─PX COORDINATOR MERGE SORT | |5 |17 |
|2 |│ └─EXCHANGE OUT DISTR |:EX10000|5 |15 |
|3 |│ └─SORT | |5 |12 |
@ -684,7 +684,7 @@ Query Plan
=================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------------
|0 |MERGE JOIN | |6 |35 |
|0 |MERGE JOIN | |5 |35 |
|1 |├─PX COORDINATOR MERGE SORT | |5 |17 |
|2 |│ └─EXCHANGE OUT DISTR |:EX10000|5 |15 |
|3 |│ └─SORT | |5 |12 |
@ -735,7 +735,7 @@ Query Plan
=================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------------
|0 |MERGE JOIN | |6 |35 |
|0 |MERGE JOIN | |5 |35 |
|1 |├─PX COORDINATOR MERGE SORT | |5 |17 |
|2 |│ └─EXCHANGE OUT DISTR |:EX10000|5 |15 |
|3 |│ └─SORT | |5 |12 |
@ -786,7 +786,7 @@ Query Plan
=================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------------
|0 |MERGE JOIN | |6 |35 |
|0 |MERGE JOIN | |5 |35 |
|1 |├─PX COORDINATOR MERGE SORT | |5 |17 |
|2 |│ └─EXCHANGE OUT DISTR |:EX10000|5 |15 |
|3 |│ └─SORT | |5 |12 |
@ -837,7 +837,7 @@ Query Plan
=================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------------
|0 |MERGE JOIN | |6 |35 |
|0 |MERGE JOIN | |5 |35 |
|1 |├─PX COORDINATOR MERGE SORT | |5 |17 |
|2 |│ └─EXCHANGE OUT DISTR |:EX10000|5 |15 |
|3 |│ └─SORT | |5 |12 |
@ -889,8 +889,8 @@ Query Plan
===================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------
|0 |MERGE JOIN | |2 |51 |
|1 |├─MERGE JOIN | |6 |35 |
|0 |MERGE JOIN | |2 |50 |
|1 |├─MERGE JOIN | |5 |35 |
|2 |│ ├─PX COORDINATOR MERGE SORT | |6 |18 |
|3 |│ │ └─EXCHANGE OUT DISTR |:EX10000|6 |16 |
|4 |│ │ └─SORT | |6 |12 |
@ -960,8 +960,8 @@ Query Plan
===================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------
|0 |MERGE JOIN | |2 |51 |
|1 |├─MERGE JOIN | |6 |35 |
|0 |MERGE JOIN | |2 |50 |
|1 |├─MERGE JOIN | |5 |35 |
|2 |│ ├─PX COORDINATOR MERGE SORT | |6 |18 |
|3 |│ │ └─EXCHANGE OUT DISTR |:EX10000|6 |16 |
|4 |│ │ └─SORT | |6 |12 |

View File

@ -16,21 +16,21 @@ Query Plan
=============================================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
---------------------------------------------------------------------------------------------
|0 |PX COORDINATOR | |1 |61 |
|1 |└─EXCHANGE OUT DISTR |:EX10003 |1 |60 |
|2 | └─INDEX INSERT |t1(t1_idx1)|1 |60 |
|3 | └─EXCHANGE IN DISTR | |1 |47 |
|4 | └─EXCHANGE OUT DISTR (PKEY HASH) |:EX10002 |1 |47 |
|5 | └─MATERIAL | |1 |47 |
|6 | └─INDEX DELETE |t1(t1_idx1)|1 |47 |
|7 | └─EXCHANGE IN DISTR | |1 |35 |
|8 | └─EXCHANGE OUT DISTR (PKEY HASH) |:EX10001 |1 |35 |
|9 | └─MATERIAL | |1 |35 |
|10| └─UPDATE | |1 |35 |
|11| └─EXCHANGE IN DISTR | |1 |3 |
|12| └─EXCHANGE OUT DISTR (PKEY HASH)|:EX10000 |1 |3 |
|13| └─PX BLOCK ITERATOR | |1 |3 |
|14| └─TABLE FULL SCAN |t1 |1 |3 |
|0 |PX COORDINATOR | |6 |167 |
|1 |└─EXCHANGE OUT DISTR |:EX10003 |6 |164 |
|2 | └─INDEX INSERT |t1(t1_idx1)|6 |162 |
|3 | └─EXCHANGE IN DISTR | |6 |118 |
|4 | └─EXCHANGE OUT DISTR (PKEY HASH) |:EX10002 |6 |117 |
|5 | └─MATERIAL | |6 |115 |
|6 | └─INDEX DELETE |t1(t1_idx1)|6 |115 |
|7 | └─EXCHANGE IN DISTR | |6 |78 |
|8 | └─EXCHANGE OUT DISTR (PKEY HASH) |:EX10001 |6 |77 |
|9 | └─MATERIAL | |6 |75 |
|10| └─UPDATE | |6 |75 |
|11| └─EXCHANGE IN DISTR | |6 |6 |
|12| └─EXCHANGE OUT DISTR (PKEY HASH)|:EX10000 |6 |5 |
|13| └─PX BLOCK ITERATOR | |6 |3 |
|14| └─TABLE FULL SCAN |t1 |6 |3 |
=============================================================================================
Outputs & filters:
-------------------------------------
@ -90,21 +90,21 @@ Query Plan
===================================================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
---------------------------------------------------------------------------------------------------
|0 |PX COORDINATOR | |1 |61 |
|1 |└─EXCHANGE OUT DISTR |:EX10003 |1 |60 |
|2 | └─INDEX INSERT |pindex(pindex_i2)|1 |60 |
|3 | └─EXCHANGE IN DISTR | |1 |47 |
|4 | └─EXCHANGE OUT DISTR (HASH) |:EX10002 |1 |47 |
|5 | └─MATERIAL | |1 |47 |
|6 | └─INDEX DELETE |pindex(pindex_i2)|1 |47 |
|7 | └─EXCHANGE IN DISTR | |1 |35 |
|8 | └─EXCHANGE OUT DISTR (HASH) |:EX10001 |1 |35 |
|9 | └─MATERIAL | |1 |35 |
|10| └─UPDATE | |1 |35 |
|11| └─EXCHANGE IN DISTR | |1 |3 |
|12| └─EXCHANGE OUT DISTR (PKEY HASH)|:EX10000 |1 |3 |
|13| └─PX BLOCK ITERATOR | |1 |3 |
|14| └─TABLE FULL SCAN |pindex |1 |3 |
|0 |PX COORDINATOR | |3 |103 |
|1 |└─EXCHANGE OUT DISTR |:EX10003 |3 |102 |
|2 | └─INDEX INSERT |pindex(pindex_i2)|3 |101 |
|3 | └─EXCHANGE IN DISTR | |3 |75 |
|4 | └─EXCHANGE OUT DISTR (HASH) |:EX10002 |3 |75 |
|5 | └─MATERIAL | |3 |74 |
|6 | └─INDEX DELETE |pindex(pindex_i2)|3 |74 |
|7 | └─EXCHANGE IN DISTR | |3 |52 |
|8 | └─EXCHANGE OUT DISTR (HASH) |:EX10001 |3 |52 |
|9 | └─MATERIAL | |3 |51 |
|10| └─UPDATE | |3 |51 |
|11| └─EXCHANGE IN DISTR | |3 |4 |
|12| └─EXCHANGE OUT DISTR (PKEY HASH)|:EX10000 |3 |4 |
|13| └─PX BLOCK ITERATOR | |3 |3 |
|14| └─TABLE FULL SCAN |pindex |3 |3 |
===================================================================================================
Outputs & filters:
-------------------------------------
@ -167,21 +167,21 @@ Query Plan
===================================================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
---------------------------------------------------------------------------------------------------
|0 |PX COORDINATOR | |1 |61 |
|1 |└─EXCHANGE OUT DISTR |:EX10003 |1 |60 |
|2 | └─INDEX INSERT |pindex(pindex_i2)|1 |60 |
|3 | └─EXCHANGE IN DISTR | |1 |47 |
|4 | └─EXCHANGE OUT DISTR (HASH) |:EX10002 |1 |47 |
|5 | └─MATERIAL | |1 |47 |
|6 | └─INDEX DELETE |pindex(pindex_i2)|1 |47 |
|7 | └─EXCHANGE IN DISTR | |1 |35 |
|8 | └─EXCHANGE OUT DISTR (HASH) |:EX10001 |1 |35 |
|9 | └─MATERIAL | |1 |35 |
|10| └─UPDATE | |1 |35 |
|11| └─EXCHANGE IN DISTR | |1 |3 |
|12| └─EXCHANGE OUT DISTR (PKEY HASH)|:EX10000 |1 |3 |
|13| └─PX BLOCK ITERATOR | |1 |3 |
|14| └─TABLE FULL SCAN |pindex |1 |3 |
|0 |PX COORDINATOR | |3 |103 |
|1 |└─EXCHANGE OUT DISTR |:EX10003 |3 |102 |
|2 | └─INDEX INSERT |pindex(pindex_i2)|3 |101 |
|3 | └─EXCHANGE IN DISTR | |3 |75 |
|4 | └─EXCHANGE OUT DISTR (HASH) |:EX10002 |3 |75 |
|5 | └─MATERIAL | |3 |74 |
|6 | └─INDEX DELETE |pindex(pindex_i2)|3 |74 |
|7 | └─EXCHANGE IN DISTR | |3 |52 |
|8 | └─EXCHANGE OUT DISTR (HASH) |:EX10001 |3 |52 |
|9 | └─MATERIAL | |3 |51 |
|10| └─UPDATE | |3 |51 |
|11| └─EXCHANGE IN DISTR | |3 |4 |
|12| └─EXCHANGE OUT DISTR (PKEY HASH)|:EX10000 |3 |4 |
|13| └─PX BLOCK ITERATOR | |3 |3 |
|14| └─TABLE FULL SCAN |pindex |3 |3 |
===================================================================================================
Outputs & filters:
-------------------------------------
@ -242,21 +242,21 @@ Query Plan
===================================================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
---------------------------------------------------------------------------------------------------
|0 |PX COORDINATOR | |1 |61 |
|1 |└─EXCHANGE OUT DISTR |:EX10003 |1 |60 |
|2 | └─INDEX INSERT |pindex(pindex_i2)|1 |60 |
|3 | └─EXCHANGE IN DISTR | |1 |47 |
|4 | └─EXCHANGE OUT DISTR (PKEY HASH) |:EX10002 |1 |47 |
|5 | └─MATERIAL | |1 |47 |
|6 | └─INDEX DELETE |pindex(pindex_i2)|1 |47 |
|7 | └─EXCHANGE IN DISTR | |1 |35 |
|8 | └─EXCHANGE OUT DISTR (PKEY HASH) |:EX10001 |1 |35 |
|9 | └─MATERIAL | |1 |35 |
|10| └─UPDATE | |1 |35 |
|11| └─EXCHANGE IN DISTR | |1 |3 |
|12| └─EXCHANGE OUT DISTR (PKEY HASH)|:EX10000 |1 |3 |
|13| └─PX BLOCK ITERATOR | |1 |3 |
|14| └─TABLE FULL SCAN |pindex |1 |3 |
|0 |PX COORDINATOR | |3 |103 |
|1 |└─EXCHANGE OUT DISTR |:EX10003 |3 |102 |
|2 | └─INDEX INSERT |pindex(pindex_i2)|3 |101 |
|3 | └─EXCHANGE IN DISTR | |3 |75 |
|4 | └─EXCHANGE OUT DISTR (PKEY HASH) |:EX10002 |3 |75 |
|5 | └─MATERIAL | |3 |74 |
|6 | └─INDEX DELETE |pindex(pindex_i2)|3 |74 |
|7 | └─EXCHANGE IN DISTR | |3 |52 |
|8 | └─EXCHANGE OUT DISTR (PKEY HASH) |:EX10001 |3 |52 |
|9 | └─MATERIAL | |3 |51 |
|10| └─UPDATE | |3 |51 |
|11| └─EXCHANGE IN DISTR | |3 |4 |
|12| └─EXCHANGE OUT DISTR (PKEY HASH)|:EX10000 |3 |4 |
|13| └─PX BLOCK ITERATOR | |3 |3 |
|14| └─TABLE FULL SCAN |pindex |3 |3 |
===================================================================================================
Outputs & filters:
-------------------------------------
@ -306,21 +306,21 @@ Query Plan
=====================================================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------------------------------------------------
|0 |PX COORDINATOR | |1 |61 |
|1 |└─EXCHANGE OUT DISTR |:EX10003 |1 |60 |
|2 | └─INDEX INSERT |pindex(pindex_i2)|1 |60 |
|3 | └─EXCHANGE IN DISTR | |1 |47 |
|4 | └─EXCHANGE OUT DISTR (HASH) |:EX10002 |1 |47 |
|5 | └─MATERIAL | |1 |47 |
|6 | └─INDEX DELETE |pindex(pindex_i2)|1 |47 |
|7 | └─EXCHANGE IN DISTR | |1 |35 |
|8 | └─EXCHANGE OUT DISTR (HASH) |:EX10001 |1 |35 |
|9 | └─MATERIAL | |1 |35 |
|10| └─UPDATE | |1 |35 |
|11| └─EXCHANGE IN DISTR | |1 |3 |
|12| └─EXCHANGE OUT DISTR (PKEY RANDOM)|:EX10000 |1 |3 |
|13| └─PX BLOCK ITERATOR | |1 |3 |
|14| └─TABLE FULL SCAN |pindex |1 |3 |
|0 |PX COORDINATOR | |3 |103 |
|1 |└─EXCHANGE OUT DISTR |:EX10003 |3 |102 |
|2 | └─INDEX INSERT |pindex(pindex_i2)|3 |101 |
|3 | └─EXCHANGE IN DISTR | |3 |75 |
|4 | └─EXCHANGE OUT DISTR (HASH) |:EX10002 |3 |75 |
|5 | └─MATERIAL | |3 |74 |
|6 | └─INDEX DELETE |pindex(pindex_i2)|3 |74 |
|7 | └─EXCHANGE IN DISTR | |3 |52 |
|8 | └─EXCHANGE OUT DISTR (HASH) |:EX10001 |3 |52 |
|9 | └─MATERIAL | |3 |51 |
|10| └─UPDATE | |3 |51 |
|11| └─EXCHANGE IN DISTR | |3 |4 |
|12| └─EXCHANGE OUT DISTR (PKEY RANDOM)|:EX10000 |3 |4 |
|13| └─PX BLOCK ITERATOR | |3 |3 |
|14| └─TABLE FULL SCAN |pindex |3 |3 |
=====================================================================================================
Outputs & filters:
-------------------------------------
@ -383,21 +383,21 @@ Query Plan
=====================================================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------------------------------------------------
|0 |PX COORDINATOR | |1 |61 |
|1 |└─EXCHANGE OUT DISTR |:EX10003 |1 |60 |
|2 | └─INDEX INSERT |pindex(pindex_i2)|1 |60 |
|3 | └─EXCHANGE IN DISTR | |1 |47 |
|4 | └─EXCHANGE OUT DISTR (HASH) |:EX10002 |1 |47 |
|5 | └─MATERIAL | |1 |47 |
|6 | └─INDEX DELETE |pindex(pindex_i2)|1 |47 |
|7 | └─EXCHANGE IN DISTR | |1 |35 |
|8 | └─EXCHANGE OUT DISTR (HASH) |:EX10001 |1 |35 |
|9 | └─MATERIAL | |1 |35 |
|10| └─UPDATE | |1 |35 |
|11| └─EXCHANGE IN DISTR | |1 |3 |
|12| └─EXCHANGE OUT DISTR (PKEY RANDOM)|:EX10000 |1 |3 |
|13| └─PX BLOCK ITERATOR | |1 |3 |
|14| └─TABLE FULL SCAN |pindex |1 |3 |
|0 |PX COORDINATOR | |3 |104 |
|1 |└─EXCHANGE OUT DISTR |:EX10003 |3 |102 |
|2 | └─INDEX INSERT |pindex(pindex_i2)|3 |101 |
|3 | └─EXCHANGE IN DISTR | |3 |76 |
|4 | └─EXCHANGE OUT DISTR (HASH) |:EX10002 |3 |75 |
|5 | └─MATERIAL | |3 |74 |
|6 | └─INDEX DELETE |pindex(pindex_i2)|3 |74 |
|7 | └─EXCHANGE IN DISTR | |3 |52 |
|8 | └─EXCHANGE OUT DISTR (HASH) |:EX10001 |3 |52 |
|9 | └─MATERIAL | |3 |51 |
|10| └─UPDATE | |3 |51 |
|11| └─EXCHANGE IN DISTR | |3 |4 |
|12| └─EXCHANGE OUT DISTR (PKEY RANDOM)|:EX10000 |3 |4 |
|13| └─PX BLOCK ITERATOR | |3 |3 |
|14| └─TABLE FULL SCAN |pindex |3 |3 |
=====================================================================================================
Outputs & filters:
-------------------------------------
@ -458,21 +458,21 @@ Query Plan
=====================================================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------------------------------------------------
|0 |PX COORDINATOR | |1 |61 |
|1 |└─EXCHANGE OUT DISTR |:EX10003 |1 |60 |
|2 | └─INDEX INSERT |pindex(pindex_i2)|1 |60 |
|3 | └─EXCHANGE IN DISTR | |1 |47 |
|4 | └─EXCHANGE OUT DISTR (PKEY HASH) |:EX10002 |1 |47 |
|5 | └─MATERIAL | |1 |47 |
|6 | └─INDEX DELETE |pindex(pindex_i2)|1 |47 |
|7 | └─EXCHANGE IN DISTR | |1 |35 |
|8 | └─EXCHANGE OUT DISTR (PKEY HASH) |:EX10001 |1 |35 |
|9 | └─MATERIAL | |1 |35 |
|10| └─UPDATE | |1 |35 |
|11| └─EXCHANGE IN DISTR | |1 |3 |
|12| └─EXCHANGE OUT DISTR (PKEY RANDOM)|:EX10000 |1 |3 |
|13| └─PX BLOCK ITERATOR | |1 |3 |
|14| └─TABLE FULL SCAN |pindex |1 |3 |
|0 |PX COORDINATOR | |3 |104 |
|1 |└─EXCHANGE OUT DISTR |:EX10003 |3 |102 |
|2 | └─INDEX INSERT |pindex(pindex_i2)|3 |101 |
|3 | └─EXCHANGE IN DISTR | |3 |76 |
|4 | └─EXCHANGE OUT DISTR (PKEY HASH) |:EX10002 |3 |75 |
|5 | └─MATERIAL | |3 |74 |
|6 | └─INDEX DELETE |pindex(pindex_i2)|3 |74 |
|7 | └─EXCHANGE IN DISTR | |3 |53 |
|8 | └─EXCHANGE OUT DISTR (PKEY HASH) |:EX10001 |3 |52 |
|9 | └─MATERIAL | |3 |51 |
|10| └─UPDATE | |3 |51 |
|11| └─EXCHANGE IN DISTR | |3 |4 |
|12| └─EXCHANGE OUT DISTR (PKEY RANDOM)|:EX10000 |3 |4 |
|13| └─PX BLOCK ITERATOR | |3 |3 |
|14| └─TABLE FULL SCAN |pindex |3 |3 |
=====================================================================================================
Outputs & filters:
-------------------------------------

View File

@ -73,12 +73,12 @@ Query Plan
=====================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
---------------------------------------------------------------------
|0 |PX COORDINATOR | |2 |20 |
|1 |└─EXCHANGE OUT DISTR |:EX10001|2 |18 |
|2 | └─HASH GROUP BY | |2 |16 |
|3 | └─EXCHANGE IN DISTR | |4 |15 |
|4 | └─EXCHANGE OUT DISTR (HASH)|:EX10000|4 |14 |
|5 | └─HASH GROUP BY | |4 |10 |
|0 |PX COORDINATOR | |28 |108 |
|1 |└─EXCHANGE OUT DISTR |:EX10001|28 |84 |
|2 | └─HASH GROUP BY | |28 |57 |
|3 | └─EXCHANGE IN DISTR | |28 |51 |
|4 | └─EXCHANGE OUT DISTR (HASH)|:EX10000|28 |39 |
|5 | └─HASH GROUP BY | |28 |12 |
|6 | └─PX BLOCK ITERATOR | |28 |8 |
|7 | └─TABLE FULL SCAN |score |28 |8 |
=====================================================================
@ -111,8 +111,8 @@ Query Plan
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
---------------------------------------------------------------------
|0 |PX COORDINATOR | |12 |79 |
|1 |└─EXCHANGE OUT DISTR |:EX10001|12 |68 |
|2 | └─HASH GROUP BY | |12 |55 |
|1 |└─EXCHANGE OUT DISTR |:EX10001|12 |67 |
|2 | └─HASH GROUP BY | |12 |54 |
|3 | └─EXCHANGE IN DISTR | |19 |51 |
|4 | └─EXCHANGE OUT DISTR (HASH)|:EX10000|19 |42 |
|5 | └─HASH GROUP BY | |19 |21 |

View File

@ -73,7 +73,7 @@ Query Plan
========================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------------
|0 |PX COORDINATOR | |28 |81 |
|0 |PX COORDINATOR | |28 |80 |
|1 |└─EXCHANGE OUT DISTR |:EX10001|28 |53 |
|2 | └─SHARED HASH JOIN | |28 |22 |
|3 | ├─EXCHANGE IN DISTR | |2 |11 |
@ -135,71 +135,76 @@ sid subject score tid name subject
64 MA 87 2 Mr Wang MA
explain select /*+ USE_PX parallel(2) */ teacher.name, teacher.subject, avg(score) from score, teacher where teacher.subject = score.subject group by teacher.name, teacher.subject;
Query Plan
=============================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------------------------
|0 |PX COORDINATOR | |2 |31 |
|1 |└─EXCHANGE OUT DISTR |:EX10003|2 |29 |
|2 | └─HASH JOIN | |2 |27 |
|3 | ├─SUBPLAN SCAN |VIEW1 |2 |14 |
|4 | │ └─HASH GROUP BY | |2 |14 |
|5 | │ └─EXCHANGE IN DISTR | |4 |13 |
|6 | │ └─EXCHANGE OUT DISTR (HASH) |:EX10000|4 |12 |
|7 | │ └─HASH GROUP BY | |4 |9 |
|8 | │ └─PX BLOCK ITERATOR | |28 |8 |
|9 | │ └─TABLE FULL SCAN |score |28 |8 |
|10| └─EXCHANGE IN DISTR | |2 |13 |
|11| └─EXCHANGE OUT DISTR (HASH) |:EX10002|2 |13 |
|12| └─SUBPLAN SCAN |VIEW2 |2 |11 |
|13| └─HASH GROUP BY | |2 |11 |
|14| └─EXCHANGE IN DISTR | |2 |11 |
|15| └─EXCHANGE OUT DISTR (HASH)|:EX10001|2 |10 |
|16| └─HASH GROUP BY | |2 |9 |
|17| └─PX BLOCK ITERATOR | |2 |9 |
|18| └─TABLE FULL SCAN |teacher |2 |9 |
=============================================================================
===============================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------------------
|0 |PX COORDINATOR | |2 |28 |
|1 |└─EXCHANGE OUT DISTR |:EX10003|2 |26 |
|2 | └─HASH JOIN | |2 |23 |
|3 | ├─JOIN FILTER CREATE |:RF0000 |2 |13 |
|4 | │ └─EXCHANGE IN DISTR | |2 |13 |
|5 | │ └─EXCHANGE OUT DISTR (HASH) |:EX10001|2 |13 |
|6 | │ └─SUBPLAN SCAN |VIEW2 |2 |11 |
|7 | │ └─HASH GROUP BY | |2 |11 |
|8 | │ └─EXCHANGE IN DISTR | |2 |11 |
|9 | │ └─EXCHANGE OUT DISTR (HASH)|:EX10000|2 |10 |
|10| │ └─HASH GROUP BY | |2 |9 |
|11| │ └─PX BLOCK ITERATOR | |2 |9 |
|12| │ └─TABLE FULL SCAN |teacher |2 |9 |
|13| └─SUBPLAN SCAN |VIEW1 |3 |10 |
|14| └─HASH GROUP BY | |3 |10 |
|15| └─EXCHANGE IN DISTR | |3 |10 |
|16| └─EXCHANGE OUT DISTR (HASH) |:EX10002|3 |9 |
|17| └─HASH GROUP BY | |3 |7 |
|18| └─JOIN FILTER USE |:RF0000 |3 |7 |
|19| └─PX BLOCK ITERATOR | |3 |7 |
|20| └─TABLE FULL SCAN |score |3 |7 |
===============================================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(VIEW2.teacher.name, VIEW2.teacher.subject, cast(cast(cast(cast(VIEW1.T_FUN_SUM(score.score) * cast(VIEW2.T_FUN_COUNT(*),
DECIMAL_INT(20, 0)), DECIMAL_INT(75, 0)), DECIMAL_INT(33, 0)), DECIMAL(33, 0)) / cast(cast(VIEW1.T_FUN_COUNT(score.score) * VIEW2.T_FUN_COUNT(*), BIGINT(20,
0)), DECIMAL(20, 0)), DECIMAL(15, 4)))]), filter(nil), rowset=256
0)), DECIMAL(20, 0)), DECIMAL(15, 4)))]), filter(nil), rowset=16
1 - output([INTERNAL_FUNCTION(VIEW2.teacher.name, VIEW2.teacher.subject, cast(cast(cast(cast(VIEW1.T_FUN_SUM(score.score) * cast(VIEW2.T_FUN_COUNT(*),
DECIMAL_INT(20, 0)), DECIMAL_INT(75, 0)), DECIMAL_INT(33, 0)), DECIMAL(33, 0)) / cast(cast(VIEW1.T_FUN_COUNT(score.score) * VIEW2.T_FUN_COUNT(*), BIGINT(20,
0)), DECIMAL(20, 0)), DECIMAL(15, 4)))]), filter(nil), rowset=256
0)), DECIMAL(20, 0)), DECIMAL(15, 4)))]), filter(nil), rowset=16
dop=2
2 - output([VIEW2.T_FUN_COUNT(*)], [VIEW2.teacher.subject], [VIEW1.T_FUN_SUM(score.score)], [VIEW1.T_FUN_COUNT(score.score)], [VIEW2.teacher.name]), filter(nil), rowset=256
2 - output([VIEW2.T_FUN_COUNT(*)], [VIEW2.teacher.subject], [VIEW2.teacher.name], [VIEW1.T_FUN_SUM(score.score)], [VIEW1.T_FUN_COUNT(score.score)]), filter(nil), rowset=16
equal_conds([VIEW2.teacher.subject = VIEW1.score.subject]), other_conds(nil)
3 - output([VIEW1.score.subject], [VIEW1.T_FUN_SUM(score.score)], [VIEW1.T_FUN_COUNT(score.score)]), filter(nil), rowset=256
access([VIEW1.score.subject], [VIEW1.T_FUN_SUM(score.score)], [VIEW1.T_FUN_COUNT(score.score)])
4 - output([score.subject], [T_FUN_SUM(T_FUN_SUM(score.score))], [T_FUN_COUNT_SUM(T_FUN_COUNT(score.score))]), filter(nil), rowset=256
group([score.subject]), agg_func([T_FUN_SUM(T_FUN_SUM(score.score))], [T_FUN_COUNT_SUM(T_FUN_COUNT(score.score))])
5 - output([score.subject], [T_FUN_SUM(score.score)], [T_FUN_COUNT(score.score)]), filter(nil), rowset=256
6 - output([score.subject], [T_FUN_SUM(score.score)], [T_FUN_COUNT(score.score)]), filter(nil), rowset=256
(#keys=1, [score.subject]), dop=2
7 - output([score.subject], [T_FUN_SUM(score.score)], [T_FUN_COUNT(score.score)]), filter(nil), rowset=256
group([score.subject]), agg_func([T_FUN_SUM(score.score)], [T_FUN_COUNT(score.score)])
8 - output([score.subject], [score.score]), filter(nil), rowset=256
9 - output([score.subject], [score.score]), filter(nil), rowset=256
access([score.subject], [score.score]), partitions(p[0-5])
is_index_back=false, is_global_index=false,
range_key([score.sid], [score.subject]), range(MIN,MIN ; MAX,MAX)always true
10 - output([VIEW2.T_FUN_COUNT(*)], [VIEW2.teacher.subject], [VIEW2.teacher.name]), filter(nil), rowset=256
11 - output([VIEW2.T_FUN_COUNT(*)], [VIEW2.teacher.subject], [VIEW2.teacher.name]), filter(nil), rowset=256
3 - output([VIEW2.T_FUN_COUNT(*)], [VIEW2.teacher.subject], [VIEW2.teacher.name]), filter(nil), rowset=16
RF_TYPE(in, range, bloom), RF_EXPR[VIEW2.teacher.subject]
4 - output([VIEW2.T_FUN_COUNT(*)], [VIEW2.teacher.subject], [VIEW2.teacher.name]), filter(nil), rowset=16
5 - output([VIEW2.T_FUN_COUNT(*)], [VIEW2.teacher.subject], [VIEW2.teacher.name]), filter(nil), rowset=16
(#keys=1, [VIEW2.teacher.subject]), dop=2
12 - output([VIEW2.teacher.subject], [VIEW2.teacher.name], [VIEW2.T_FUN_COUNT(*)]), filter(nil), rowset=256
6 - output([VIEW2.teacher.subject], [VIEW2.teacher.name], [VIEW2.T_FUN_COUNT(*)]), filter(nil), rowset=16
access([VIEW2.teacher.subject], [VIEW2.teacher.name], [VIEW2.T_FUN_COUNT(*)])
13 - output([teacher.subject], [teacher.name], [T_FUN_COUNT_SUM(T_FUN_COUNT(*))]), filter(nil), rowset=256
7 - output([teacher.subject], [teacher.name], [T_FUN_COUNT_SUM(T_FUN_COUNT(*))]), filter(nil), rowset=16
group([teacher.subject], [teacher.name]), agg_func([T_FUN_COUNT_SUM(T_FUN_COUNT(*))])
14 - output([teacher.subject], [teacher.name], [T_FUN_COUNT(*)]), filter(nil), rowset=256
15 - output([teacher.subject], [teacher.name], [T_FUN_COUNT(*)]), filter(nil), rowset=256
8 - output([teacher.subject], [teacher.name], [T_FUN_COUNT(*)]), filter(nil), rowset=16
9 - output([teacher.subject], [teacher.name], [T_FUN_COUNT(*)]), filter(nil), rowset=16
(#keys=2, [teacher.subject], [teacher.name]), dop=2
16 - output([teacher.subject], [teacher.name], [T_FUN_COUNT(*)]), filter(nil), rowset=256
10 - output([teacher.subject], [teacher.name], [T_FUN_COUNT(*)]), filter(nil), rowset=16
group([teacher.subject], [teacher.name]), agg_func([T_FUN_COUNT(*)])
17 - output([teacher.subject], [teacher.name]), filter(nil), rowset=256
18 - output([teacher.subject], [teacher.name]), filter(nil), rowset=256
11 - output([teacher.subject], [teacher.name]), filter(nil), rowset=16
12 - output([teacher.subject], [teacher.name]), filter(nil), rowset=16
access([teacher.subject], [teacher.name]), partitions(p[0-7])
is_index_back=false, is_global_index=false,
range_key([teacher.tid]), range(MIN ; MAX)always true
13 - output([VIEW1.score.subject], [VIEW1.T_FUN_SUM(score.score)], [VIEW1.T_FUN_COUNT(score.score)]), filter(nil), rowset=16
access([VIEW1.score.subject], [VIEW1.T_FUN_SUM(score.score)], [VIEW1.T_FUN_COUNT(score.score)])
14 - output([score.subject], [T_FUN_SUM(T_FUN_SUM(score.score))], [T_FUN_COUNT_SUM(T_FUN_COUNT(score.score))]), filter(nil), rowset=16
group([score.subject]), agg_func([T_FUN_SUM(T_FUN_SUM(score.score))], [T_FUN_COUNT_SUM(T_FUN_COUNT(score.score))])
15 - output([score.subject], [T_FUN_SUM(score.score)], [T_FUN_COUNT(score.score)]), filter(nil), rowset=16
16 - output([score.subject], [T_FUN_SUM(score.score)], [T_FUN_COUNT(score.score)]), filter(nil), rowset=16
(#keys=1, [score.subject]), dop=2
17 - output([score.subject], [T_FUN_SUM(score.score)], [T_FUN_COUNT(score.score)]), filter(nil), rowset=16
group([score.subject]), agg_func([T_FUN_SUM(score.score)], [T_FUN_COUNT(score.score)])
18 - output([score.subject], [score.score]), filter(nil), rowset=16
19 - output([score.subject], [score.score]), filter(nil), rowset=16
20 - output([score.subject], [score.score]), filter([RF_IN_FILTER(score.subject)], [RF_RANGE_FILTER(score.subject)], [RF_BLOOM_FILTER(score.subject)]), rowset=16
access([score.subject], [score.score]), partitions(p[0-5])
is_index_back=false, is_global_index=false, filter_before_indexback[false,false,false],
range_key([score.sid], [score.subject]), range(MIN,MIN ; MAX,MAX)always true
select /*+ USE_PX parallel(2) */ teacher.name, teacher.subject, avg(score) from score, teacher where teacher.subject = score.subject group by teacher.name, teacher.subject;
name subject avg(score)
Miss Zhang EN 83.7143

View File

@ -73,8 +73,8 @@ Query Plan
===============================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
---------------------------------------------------------------
|0 |PX COORDINATOR MERGE SORT | |28 |80 |
|1 |└─EXCHANGE OUT DISTR |:EX10000|28 |52 |
|0 |PX COORDINATOR MERGE SORT | |28 |79 |
|1 |└─EXCHANGE OUT DISTR |:EX10000|28 |51 |
|2 | └─SORT | |28 |20 |
|3 | └─PX PARTITION ITERATOR| |28 |16 |
|4 | └─MERGE JOIN | |28 |16 |

View File

@ -73,7 +73,7 @@ Query Plan
=============================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------
|0 |PX COORDINATOR | |28 |77 |
|0 |PX COORDINATOR | |28 |76 |
|1 |└─EXCHANGE OUT DISTR |:EX10000|28 |48 |
|2 | └─PX PARTITION ITERATOR| |28 |17 |
|3 | └─MERGE JOIN | |28 |17 |

View File

@ -1776,8 +1776,8 @@ Optimization Info:
dop_method:Table DOP
avaiable_index_name:[t1]
stats info:[version=0, is_locked=0, is_expired=0]
dynamic sampling level:1
estimation method:[DYNAMIC SAMPLING FULL]
dynamic sampling level:0
estimation method:[DEFAULT, STORAGE]
t2:
table_rows:22
physical_range_rows:7
@ -1880,8 +1880,8 @@ Optimization Info:
dop_method:Table DOP
avaiable_index_name:[t1]
stats info:[version=0, is_locked=0, is_expired=0]
dynamic sampling level:1
estimation method:[DYNAMIC SAMPLING FULL]
dynamic sampling level:0
estimation method:[DEFAULT, STORAGE]
t2:
table_rows:22
physical_range_rows:7
@ -1984,8 +1984,8 @@ Optimization Info:
dop_method:Table DOP
avaiable_index_name:[t1]
stats info:[version=0, is_locked=0, is_expired=0]
dynamic sampling level:1
estimation method:[DYNAMIC SAMPLING FULL]
dynamic sampling level:0
estimation method:[DEFAULT, STORAGE]
t2:
table_rows:22
physical_range_rows:1
@ -2096,8 +2096,8 @@ Optimization Info:
dop_method:Table DOP
avaiable_index_name:[t1]
stats info:[version=0, is_locked=0, is_expired=0]
dynamic sampling level:1
estimation method:[DYNAMIC SAMPLING FULL]
dynamic sampling level:0
estimation method:[DEFAULT, STORAGE]
t2:
table_rows:22
physical_range_rows:7
@ -2220,8 +2220,8 @@ Optimization Info:
dop_method:Table DOP
avaiable_index_name:[t1]
stats info:[version=0, is_locked=0, is_expired=0]
dynamic sampling level:1
estimation method:[DYNAMIC SAMPLING FULL]
dynamic sampling level:0
estimation method:[DEFAULT, STORAGE]
t2:
table_rows:22
physical_range_rows:7
@ -2344,8 +2344,8 @@ Optimization Info:
dop_method:Table DOP
avaiable_index_name:[t1]
stats info:[version=0, is_locked=0, is_expired=0]
dynamic sampling level:1
estimation method:[DYNAMIC SAMPLING FULL]
dynamic sampling level:0
estimation method:[DEFAULT, STORAGE]
t2:
table_rows:22
physical_range_rows:7
@ -2468,8 +2468,8 @@ Optimization Info:
dop_method:Table DOP
avaiable_index_name:[t1]
stats info:[version=0, is_locked=0, is_expired=0]
dynamic sampling level:1
estimation method:[DYNAMIC SAMPLING FULL]
dynamic sampling level:0
estimation method:[DEFAULT, STORAGE]
t2:
table_rows:22
physical_range_rows:7
@ -2601,8 +2601,8 @@ Optimization Info:
dop_method:Table DOP
avaiable_index_name:[t1]
stats info:[version=0, is_locked=0, is_expired=0]
dynamic sampling level:1
estimation method:[DYNAMIC SAMPLING FULL]
dynamic sampling level:0
estimation method:[DEFAULT, STORAGE]
t2:
table_rows:22
physical_range_rows:7
@ -2788,8 +2788,8 @@ Optimization Info:
dop_method:Table DOP
avaiable_index_name:[t1]
stats info:[version=0, is_locked=0, is_expired=0]
dynamic sampling level:1
estimation method:[DYNAMIC SAMPLING FULL]
dynamic sampling level:0
estimation method:[DEFAULT, STORAGE]
t2:
table_rows:22
physical_range_rows:1
@ -3023,8 +3023,8 @@ Optimization Info:
dop_method:Table DOP
avaiable_index_name:[t1]
stats info:[version=0, is_locked=0, is_expired=0]
dynamic sampling level:1
estimation method:[DYNAMIC SAMPLING FULL]
dynamic sampling level:0
estimation method:[DEFAULT, STORAGE]
t2:
table_rows:22
physical_range_rows:7
@ -3258,8 +3258,8 @@ Optimization Info:
dop_method:Table DOP
avaiable_index_name:[t1]
stats info:[version=0, is_locked=0, is_expired=0]
dynamic sampling level:1
estimation method:[DYNAMIC SAMPLING FULL]
dynamic sampling level:0
estimation method:[DEFAULT, STORAGE]
t2:
table_rows:22
physical_range_rows:7

View File

@ -16,15 +16,15 @@ Query Plan
=======================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------------------
|0 |MERGE JOIN | |2 |30 |
|0 |MERGE JOIN | |3 |31 |
|1 |├─TABLE FULL SCAN |s |3 |3 |
|2 |└─SORT | |2 |27 |
|3 | └─SUBPLAN SCAN |VIEW1 |2 |27 |
|4 | └─UNION ALL | |2 |27 |
|5 | ├─PX COORDINATOR | |1 |12 |
|6 | │ └─EXCHANGE OUT DISTR |:EX10000|1 |12 |
|7 | │ └─PX PARTITION ITERATOR | |1 |11 |
|8 | │ └─TABLE FULL SCAN |a |1 |11 |
|2 |└─SORT | |3 |28 |
|3 | └─SUBPLAN SCAN |VIEW1 |3 |28 |
|4 | └─UNION ALL | |3 |28 |
|5 | ├─PX COORDINATOR | |2 |13 |
|6 | │ └─EXCHANGE OUT DISTR |:EX10000|2 |12 |
|7 | │ └─PX PARTITION ITERATOR | |2 |11 |
|8 | │ └─TABLE FULL SCAN |a |2 |11 |
|9 | └─HASH RIGHT SEMI JOIN | |1 |16 |
|10| ├─TABLE FULL SCAN |r |1 |3 |
|11| └─PX COORDINATOR | |2 |13 |
@ -75,15 +75,15 @@ Query Plan
===========================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
---------------------------------------------------------------------------
|0 |MERGE JOIN | |2 |30 |
|0 |MERGE JOIN | |3 |31 |
|1 |├─TABLE FULL SCAN |s |3 |3 |
|2 |└─SORT | |2 |27 |
|3 | └─SUBPLAN SCAN |VIEW1 |2 |27 |
|4 | └─UNION ALL | |2 |27 |
|5 | ├─PX COORDINATOR | |1 |12 |
|6 | │ └─EXCHANGE OUT DISTR |:EX10000|1 |12 |
|7 | │ └─PX PARTITION ITERATOR | |1 |11 |
|8 | │ └─TABLE FULL SCAN |a |1 |11 |
|2 |└─SORT | |3 |28 |
|3 | └─SUBPLAN SCAN |VIEW1 |3 |28 |
|4 | └─UNION ALL | |3 |28 |
|5 | ├─PX COORDINATOR | |2 |13 |
|6 | │ └─EXCHANGE OUT DISTR |:EX10000|2 |12 |
|7 | │ └─PX PARTITION ITERATOR | |2 |11 |
|8 | │ └─TABLE FULL SCAN |a |2 |11 |
|9 | └─MERGE SEMI JOIN | |1 |15 |
|10| ├─SORT | |1 |13 |
|11| │ └─NESTED-LOOP SEMI JOIN | |1 |13 |
@ -225,15 +225,15 @@ Query Plan
=========================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------------
|0 |MERGE GROUP BY | |2 |30 |
|1 |└─MERGE JOIN | |2 |30 |
|2 | ├─SORT | |2 |27 |
|3 | │ └─SUBPLAN SCAN |VIEW2 |2 |27 |
|4 | │ └─UNION ALL | |2 |27 |
|5 | │ ├─PX COORDINATOR | |1 |12 |
|6 | │ │ └─EXCHANGE OUT DISTR |:EX10000|1 |12 |
|7 | │ │ └─PX PARTITION ITERATOR | |1 |11 |
|8 | │ │ └─TABLE FULL SCAN |a |1 |11 |
|0 |MERGE GROUP BY | |3 |31 |
|1 |└─MERGE JOIN | |3 |31 |
|2 | ├─SORT | |3 |28 |
|3 | │ └─SUBPLAN SCAN |VIEW2 |3 |28 |
|4 | │ └─UNION ALL | |3 |28 |
|5 | │ ├─PX COORDINATOR | |2 |13 |
|6 | │ │ └─EXCHANGE OUT DISTR |:EX10000|2 |12 |
|7 | │ │ └─PX PARTITION ITERATOR | |2 |11 |
|8 | │ │ └─TABLE FULL SCAN |a |2 |11 |
|9 | │ └─HASH RIGHT SEMI JOIN | |1 |16 |
|10| │ ├─TABLE FULL SCAN |r |1 |3 |
|11| │ └─PX COORDINATOR | |2 |13 |
@ -287,15 +287,15 @@ Query Plan
=========================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------------
|0 |MERGE GROUP BY | |2 |30 |
|1 |└─MERGE JOIN | |2 |30 |
|2 | ├─SORT | |2 |27 |
|3 | │ └─SUBPLAN SCAN |VIEW2 |2 |27 |
|4 | │ └─UNION ALL | |2 |27 |
|5 | │ ├─PX COORDINATOR | |1 |12 |
|6 | │ │ └─EXCHANGE OUT DISTR |:EX10000|1 |12 |
|7 | │ │ └─PX PARTITION ITERATOR | |1 |11 |
|8 | │ │ └─TABLE FULL SCAN |a |1 |11 |
|0 |MERGE GROUP BY | |3 |31 |
|1 |└─MERGE JOIN | |3 |31 |
|2 | ├─SORT | |3 |28 |
|3 | │ └─SUBPLAN SCAN |VIEW2 |3 |28 |
|4 | │ └─UNION ALL | |3 |28 |
|5 | │ ├─PX COORDINATOR | |2 |13 |
|6 | │ │ └─EXCHANGE OUT DISTR |:EX10000|2 |12 |
|7 | │ │ └─PX PARTITION ITERATOR | |2 |11 |
|8 | │ │ └─TABLE FULL SCAN |a |2 |11 |
|9 | │ └─HASH RIGHT SEMI JOIN | |1 |16 |
|10| │ ├─TABLE FULL SCAN |r |1 |3 |
|11| │ └─PX COORDINATOR | |2 |13 |