mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Added rowid_filter support to Aria
This includes: - cleanup and optimization of filtering and pushdown engine code. - Adjusted costs for rowid filters (based on extensive testing and profiling). This made a small two changes to the handler_rowid_filter_is_active() API: - One should not call it with a zero pointer! - One does not need to call handler_rowid_filter_is_active() for every row anymore. It is enough to check if filter is active by calling it call it during index_init() or when handler::rowid_filter_changed() is called The changes was to avoid unnecessary function calls and checks if pushdown conditions and rowid_filter is not used. Updated costs for rowid_filter_lookup() to be closer to reality. The old cost was based only on rowid_compare_cost. This is now changed to take into account the overhead in checking the rowid. Changed the Range_rowid_filter class to use DYNAMIC_ARRAY directly instead of Dynamic_array<>. This was done to be able to use the new append_dynamic() functions which gives a notable speed improvment compared to the old code. Removing the abstraction also makes the code easier to understand. The cost of filtering is now slightly lower than before, which is reflected in some test cases that is now using rowid filters.
This commit is contained in:
@ -329,7 +329,7 @@ set optimizer_trace='enabled=on';
|
||||
# 3-way ROR-intersection
|
||||
explain select key1,key2,key3 from t1 where key1=100 and key2=100 and key3=100;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref|filter key1,key2,key3 key1|key2 5|5 const 2243 (3%) Using where; Using rowid filter
|
||||
1 SIMPLE t1 index_merge key1,key2,key3 key1,key2 5,5 NULL 77 Using intersect(key1,key2); Using where
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
|
||||
[
|
||||
@ -423,22 +423,6 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
|
||||
},
|
||||
"analyzing_index_merge_union":
|
||||
[]
|
||||
},
|
||||
{
|
||||
"range_scan_alternatives":
|
||||
[
|
||||
{
|
||||
"index": "key2",
|
||||
"ranges":
|
||||
["(100) <= (key2) <= (100)"],
|
||||
"rowid_ordered": true,
|
||||
"using_mrr": false,
|
||||
"index_only": true,
|
||||
"rows": 2243,
|
||||
"cost": 0.312832109,
|
||||
"chosen": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.chosen_range_access_summary')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
@ -473,19 +457,6 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.chosen_range_access_summary'))
|
||||
"rows_for_plan": 77,
|
||||
"cost_for_plan": 0.572490756,
|
||||
"chosen": true
|
||||
},
|
||||
{
|
||||
"range_access_plan":
|
||||
{
|
||||
"type": "range_scan",
|
||||
"index": "key2",
|
||||
"rows": 2243,
|
||||
"ranges":
|
||||
["(100) <= (key2) <= (100)"]
|
||||
},
|
||||
"rows_for_plan": 2243,
|
||||
"cost_for_plan": 0.312832109,
|
||||
"chosen": true
|
||||
}
|
||||
]
|
||||
# ROR-union(ROR-intersection, ROR-range)
|
||||
|
Reference in New Issue
Block a user