我们公司最近从OB3.1.5迁移到了4.3.5,用的是OMS做的迁移,迁移完毕过了两天后,同一个查询在2个OB速度差异巨大,能麻烦给看看怎么优化新版本OB吗,新版本OB用的是HTAP。
老的OB执行计划:
|ID|OPERATOR |NAME |EST. ROWS|COST |
|0 |LIMIT | |1000 |14372|
|1 | PX COORDINATOR MERGE SORT | |1000 |14234|
|2 | EXCHANGE OUT DISTR |:EX10000 |1000 |11973|
|3 | LIMIT | |1000 |11973|
|4 | TOP-N SORT | |1000 |11835|
|5 | PX PARTITION ITERATOR | |1000 |1402 |
|6 | TABLE SCAN |gic_emission_mobile|1000 |1402 |
Outputs & filters:
0 - output([gic_emission_mobile.id(0x7f6b2d399dd0)], [gic_emission_mobile.mobile_sha256(0x7f6b2d398180)], [gic_emission_mobile.event_id(0x7f6b2d39c910)], [gic_emission_mobile.remain_emission(0x7f6b2d39be10)], [gic_emission_mobile.region(0x7f6b2d39aee0)], [gic_emission_mobile.behavior_id(0x7f6b2d39d530)], [gic_emission_mobile.event_time(0x7f6b2d39dab0)]), filter(nil), limit(1000), offset(nil)
1 - output([gic_emission_mobile.id(0x7f6b2d399dd0)], [gic_emission_mobile.mobile_sha256(0x7f6b2d398180)], [gic_emission_mobile.event_id(0x7f6b2d39c910)], [gic_emission_mobile.remain_emission(0x7f6b2d39be10)], [gic_emission_mobile.region(0x7f6b2d39aee0)], [gic_emission_mobile.behavior_id(0x7f6b2d39d530)], [gic_emission_mobile.event_time(0x7f6b2d39dab0)]), filter(nil), sort_keys([gic_emission_mobile.id(0x7f6b2d399dd0), ASC])
2 - output([gic_emission_mobile.id(0x7f6b2d399dd0)], [gic_emission_mobile.mobile_sha256(0x7f6b2d398180)], [gic_emission_mobile.event_id(0x7f6b2d39c910)], [gic_emission_mobile.remain_emission(0x7f6b2d39be10)], [gic_emission_mobile.region(0x7f6b2d39aee0)], [gic_emission_mobile.behavior_id(0x7f6b2d39d530)], [gic_emission_mobile.event_time(0x7f6b2d39dab0)]), filter(nil), dop=1
3 - output([gic_emission_mobile.id(0x7f6b2d399dd0)], [gic_emission_mobile.mobile_sha256(0x7f6b2d398180)], [gic_emission_mobile.event_id(0x7f6b2d39c910)], [gic_emission_mobile.remain_emission(0x7f6b2d39be10)], [gic_emission_mobile.region(0x7f6b2d39aee0)], [gic_emission_mobile.behavior_id(0x7f6b2d39d530)], [gic_emission_mobile.event_time(0x7f6b2d39dab0)]), filter(nil), limit(1000), offset(nil)
4 - output([gic_emission_mobile.id(0x7f6b2d399dd0)], [gic_emission_mobile.mobile_sha256(0x7f6b2d398180)], [gic_emission_mobile.event_id(0x7f6b2d39c910)], [gic_emission_mobile.remain_emission(0x7f6b2d39be10)], [gic_emission_mobile.region(0x7f6b2d39aee0)], [gic_emission_mobile.behavior_id(0x7f6b2d39d530)], [gic_emission_mobile.event_time(0x7f6b2d39dab0)]), filter(nil), sort_keys([gic_emission_mobile.id(0x7f6b2d399dd0), ASC]), topn(1000), local merge sort
5 - output([gic_emission_mobile.mobile_sha256(0x7f6b2d398180)], [gic_emission_mobile.id(0x7f6b2d399dd0)], [gic_emission_mobile.region(0x7f6b2d39aee0)], [gic_emission_mobile.remain_emission(0x7f6b2d39be10)], [gic_emission_mobile.event_id(0x7f6b2d39c910)], [gic_emission_mobile.behavior_id(0x7f6b2d39d530)], [gic_emission_mobile.event_time(0x7f6b2d39dab0)]), filter(nil),
force partition granule, asc.
6 - output([gic_emission_mobile.mobile_sha256(0x7f6b2d398180)], [gic_emission_mobile.id(0x7f6b2d399dd0)], [gic_emission_mobile.region(0x7f6b2d39aee0)], [gic_emission_mobile.remain_emission(0x7f6b2d39be10)], [gic_emission_mobile.event_id(0x7f6b2d39c910)], [gic_emission_mobile.behavior_id(0x7f6b2d39d530)], [gic_emission_mobile.event_time(0x7f6b2d39dab0)]), filter([(T_OP_LIKE, gic_emission_mobile.region(0x7f6b2d39aee0), ‘11%’, ‘\’)(0x7f6b2d39a090)], [gic_emission_mobile.tenant_id(0x7f6b87723630) = 14(0x7f6b2d398970)], [gic_emission_mobile.remain_emission(0x7f6b2d39be10) > ?(0x7f6b2d39b760)]),
access([gic_emission_mobile.tenant_id(0x7f6b87723630)], [gic_emission_mobile.mobile_sha256(0x7f6b2d398180)], [gic_emission_mobile.id(0x7f6b2d399dd0)], [gic_emission_mobile.region(0x7f6b2d39aee0)], [gic_emission_mobile.remain_emission(0x7f6b2d39be10)], [gic_emission_mobile.event_id(0x7f6b2d39c910)], [gic_emission_mobile.behavior_id(0x7f6b2d39d530)], [gic_emission_mobile.event_time(0x7f6b2d39dab0)]), partitions(p5sp[0-31]),
limit(1000), offset(nil),
is_index_back=false, filter_before_indexback[false,false,false],
range_key([gic_emission_mobile.id(0x7f6b2d399dd0)], [gic_emission_mobile.tenant_id(0x7f6b87723630)], [gic_emission_mobile.mobile_sha256(0x7f6b2d398180)]), range(5323472,MAX,MAX ; MAX,14,MAX),
range_cond([gic_emission_mobile.id(0x7f6b2d399dd0) > 5323472(0x7f6b2d399720)])
Used Hint:
/*+
*/
Outline Data:
/*+
BEGIN_OUTLINE_DATA
FULL(@“SEL$1” “gic_trade.gic_emission_mobile”@“SEL$1”)
END_OUTLINE_DATA
*/
Plan Type:
DISTRIBUTED
Optimization Info:
gic_emission_mobile:table_rows:1958788910, physical_range_rows:1968168864, logical_range_rows:1968168864, index_back_rows:0, output_rows:681189055, est_method:local_storage, optimization_method=cost_based, avaiable_index_name[idx_tenant_id_region_remain_emission_event_time,gic_emission_mobile], pruned_index_name[uk_tenant_id_mobile_event_id,idx_mobile_sha256,idx_tenant_id_enent_time,idx_event_month,idx_tenant_id_source_name], estimation info[table_id:1100611139453952, (table_type:1, version:0-1744567210372305-1744567210372305, logical_rc:61477104, physical_rc:61477104), (table_type:7, version:1744567201254857-1744567210372305-1744567232798522, logical_rc:0, physical_rc:0), (table_type:7, version:1744567232798522-1744607482491064-1744607482491064, logical_rc:0, physical_rc:0), (table_type:7, version:1744607482491064-1744608326700710-1744608326700710, logical_rc:28173, physical_rc:28173), (table_type:5, version:1744607482491064-1744608326700710-1744608326700710, logical_rc:0, physical_rc:0), (table_type:0, version:1744608326700710-1744608326700710-9223372036854775807, logical_rc:0, physical_rc:0)]
Parameters
{obj:{“DECIMAL”:“0”}, accuracy:{length:-1, precision:1, scale:0}, flag:0, raw_text_pos:-1, raw_text_len:-1, param_meta:{type:“DECIMAL”, collation:“binary”, coercibility:“NUMERIC”}}
新版本OB执行计划:
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
|0 |LIMIT | |1000 |28428 |
|1 |└─PX COORDINATOR MERGE SORT | |1000 |28425 |
|2 | └─EXCHANGE OUT DISTR |:EX10000 |1000 |26381 |
|3 | └─TOP-N SORT | |1000 |21780 |
|4 | └─PX PARTITION ITERATOR | |32000 |5190 |
|5 | └─COLUMN TABLE RANGE SCAN|gic_emission_mobile|32000 |5190 |
Outputs & filters:
0 - output([gic_emission_mobile.id(0x7f0414c2e7e0)], [gic_emission_mobile.mobile_sha256(0x7f0414c27800)], [gic_emission_mobile.event_id(0x7f0414c2fc00)],
[gic_emission_mobile.remain_emission(0x7f0414c2c050)], [gic_emission_mobile.region(0x7f0414c2a750)], [gic_emission_mobile.behavior_id(0x7f0414c30dd0)],
[gic_emission_mobile.event_time(0x7f0414c316a0)]), filter(nil), rowset=256
limit(1000(0x7f0414c31f80)), offset(nil)
1 - output([gic_emission_mobile.id(0x7f0414c2e7e0)], [gic_emission_mobile.mobile_sha256(0x7f0414c27800)], [gic_emission_mobile.event_id(0x7f0414c2fc00)],
[gic_emission_mobile.remain_emission(0x7f0414c2c050)], [gic_emission_mobile.region(0x7f0414c2a750)], [gic_emission_mobile.behavior_id(0x7f0414c30dd0)],
[gic_emission_mobile.event_time(0x7f0414c316a0)]), filter(nil), rowset=256
sort_keys([gic_emission_mobile.id(0x7f0414c2e7e0), ASC])
2 - output([gic_emission_mobile.id(0x7f0414c2e7e0)], [gic_emission_mobile.mobile_sha256(0x7f0414c27800)], [gic_emission_mobile.event_id(0x7f0414c2fc00)],
[gic_emission_mobile.remain_emission(0x7f0414c2c050)], [gic_emission_mobile.region(0x7f0414c2a750)], [gic_emission_mobile.behavior_id(0x7f0414c30dd0)],
[gic_emission_mobile.event_time(0x7f0414c316a0)]), filter(nil), rowset=256
dop=1
3 - output([gic_emission_mobile.id(0x7f0414c2e7e0)], [gic_emission_mobile.mobile_sha256(0x7f0414c27800)], [gic_emission_mobile.event_id(0x7f0414c2fc00)],
[gic_emission_mobile.remain_emission(0x7f0414c2c050)], [gic_emission_mobile.region(0x7f0414c2a750)], [gic_emission_mobile.behavior_id(0x7f0414c30dd0)],
[gic_emission_mobile.event_time(0x7f0414c316a0)]), filter(nil), rowset=256
sort_keys([gic_emission_mobile.id(0x7f0414c2e7e0), ASC]), topn(1000(0x7f0414c31f80)), local merge sort
4 - output([gic_emission_mobile.id(0x7f0414c2e7e0)], [gic_emission_mobile.mobile_sha256(0x7f0414c27800)], [gic_emission_mobile.region(0x7f0414c2a750)],
[gic_emission_mobile.remain_emission(0x7f0414c2c050)], [gic_emission_mobile.event_id(0x7f0414c2fc00)], [gic_emission_mobile.behavior_id(0x7f0414c30dd0)],
[gic_emission_mobile.event_time(0x7f0414c316a0)]), filter(nil), rowset=256
force partition granule
5 - output([gic_emission_mobile.id(0x7f0414c2e7e0)], [gic_emission_mobile.mobile_sha256(0x7f0414c27800)], [gic_emission_mobile.region(0x7f0414c2a750)],
[gic_emission_mobile.remain_emission(0x7f0414c2c050)], [gic_emission_mobile.event_id(0x7f0414c2fc00)], [gic_emission_mobile.behavior_id(0x7f0414c30dd0)],
[gic_emission_mobile.event_time(0x7f0414c316a0)]), filter([(T_OP_LIKE, gic_emission_mobile.region(0x7f0414c2a750), ‘11%’(0x7f0414c29dd0), ‘\’)(0x7f0414c290d0)],
[gic_emission_mobile.remain_emission(0x7f0414c2c050) > cast(0(0x7f0414c2b2f0), DECIMAL_INT(20, 2))(0x7f0414c2c6f0)(0x7f0414c2b780)], [gic_emission_mobile.tenant_id(0x7f0414c25b20)
= 14(0x7f0414c28100)(0x7f0414c28590)], [TOPN_FILTER(gic_emission_mobile.id(0x7f0414c2e7e0))(0x7f12f616ed50)]), rowset=256
access([gic_emission_mobile.id(0x7f0414c2e7e0)], [gic_emission_mobile.tenant_id(0x7f0414c25b20)], [gic_emission_mobile.mobile_sha256(0x7f0414c27800)],
[gic_emission_mobile.region(0x7f0414c2a750)], [gic_emission_mobile.remain_emission(0x7f0414c2c050)], [gic_emission_mobile.event_id(0x7f0414c2fc00)], [gic_emission_mobile.behavior_id(0x7f0414c30dd0)],
[gic_emission_mobile.event_time(0x7f0414c316a0)]), partitions(p5sp[0-31])
limit(1000(0x7f0414c31f80)), offset(nil), is_index_back=false, is_global_index=false, filter_before_indexback[false,false,false,false],
range_key([gic_emission_mobile.id(0x7f0414c2e7e0)], [gic_emission_mobile.tenant_id(0x7f0414c25b20)], [gic_emission_mobile.mobile_sha256(0x7f0414c27800)]),
range(5323472,MAX,MAX ; MAX,MAX,MAX),
range_cond([gic_emission_mobile.id(0x7f0414c2e7e0) > 5323472(0x7f12f617c8c0)(0x7f12f617bea0)])
Used Hint:
/*+
*/
Qb name trace:
stmt_id:0, stmt_type:T_EXPLAIN
stmt_id:1, SEL$1
Outline Data:
/*+
BEGIN_OUTLINE_DATA
FULL(@“SEL$1” “gic_trade”.“gic_emission_mobile”@“SEL$1”)
USE_COLUMN_TABLE(@“SEL$1” “gic_trade”.“gic_emission_mobile”@“SEL$1”)
OPTIMIZER_FEATURES_ENABLE(‘4.3.5.0’)
END_OUTLINE_DATA
*/
Optimization Info:
gic_emission_mobile:
table_rows:1876976959
physical_range_rows:1959934710
logical_range_rows:1959934710
index_back_rows:0
output_rows:1850555618
table_dop:1
dop_method:Table DOP
avaiable_index_name:[uk_tenant_id_mobile_event_id, idx_event_month, idx_mobile_sha256, idx_tenant_id_enent_time, idx_tenant_id_region_remain_emission_event_time, idx_tenant_id_source_name, gic_emission_mobile]
pruned_index_name:[uk_tenant_id_mobile_event_id, idx_event_month, idx_tenant_id_enent_time, idx_tenant_id_source_name]
stats info:[version=2025-04-08 22:15:04.667663, is_locked=0, is_expired=0]
dynamic sampling level:0
estimation method:[OPTIMIZER STATISTICS, STORAGE]
Plan Type:
DISTRIBUTED
Parameters:
:0 => 14
:1 => ‘11%’
:2 => 0
:3 => 5323472
:4 => 1000
Note:
Degree of Parallelisim is 1 because of table property