[FEAT MERGE] [CP] Improve the rowcount estimation

Co-authored-by: akaError <lzg020616@163.com>
This commit is contained in:
xianyu-w
2024-02-09 19:58:18 +00:00
committed by ob-robot
parent da232dc640
commit dc32079645
70 changed files with 5953 additions and 3722 deletions

View File

@ -1953,7 +1953,8 @@ int ObOptStatSqlService::fetch_table_rowcnt(const uint64_t tenant_id,
ObSchemaUtils::get_real_table_mappings_tid(table_id) : table_id;
if (OB_FAIL(gen_tablet_list_str(all_tablet_ids, all_ls_ids, tablet_list_str, tablet_ls_list_str))) {
LOG_WARN("failed to gen tablet list str", K(ret));
} else if (OB_FAIL(raw_sql.append_fmt("select /*+opt_param('enable_in_range_optimization','true')*/ tablet_id, max(row_count) from "\
} else if (OB_FAIL(raw_sql.append_fmt("select /*+opt_param('enable_in_range_optimization','true') opt_param('use_default_opt_stat','true')*/"\
"tablet_id, max(row_count) from "\
"(select cast(tablet_id as unsigned) as tablet_id, cast(inserts - deletes as signed) as row_count "\
"from %s where tenant_id = %lu and table_id = %lu and tablet_id in %s union all "\
"select cast(tablet_id as unsigned) as tablet_id, cast(row_count as signed) as row_count from %s, "\