mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Adjust costs for rowid filter
- Use log2() insted of log() - Added missing ''+' when calculating rowid setup cost - Adjusted ROWID_FILTER_PER_ELEMENT_MODIFIER (from 3 to 1) Other things: - Adjusted cost for index_merge where rows_out < 1.0 The effects of the changes: - rowid filter will have higher setup cost - rowid filter will have slightly less costs per row This can be seen in mtr where some tests, with 'small tables or that uses rowid filters with many rows, will not use rowid filter anymore.
This commit is contained in:
@ -281,7 +281,7 @@ INSERT INTO t1 VALUES
|
||||
(33,5),(33,5),(33,5),(33,5),(34,5),(35,5);
|
||||
EXPLAIN SELECT * FROM t1 WHERE a IN(1,2) AND b=5;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range|filter a,b a|b 5|5 NULL 2 (41%) Using index condition; Using where; Using rowid filter
|
||||
1 SIMPLE t1 range a,b a 5 NULL 2 Using index condition; Using where
|
||||
SELECT * FROM t1 WHERE a IN(1,2) AND b=5;
|
||||
a b
|
||||
DROP TABLE t1;
|
||||
@ -2563,7 +2563,7 @@ insert into t2 values
|
||||
explain select * from t1,t2
|
||||
where a = d and (a,e) in ((3,3),(7,7),(2,2));
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 range|filter idx1,idx2 idx1|idx2 5|5 NULL 3 (60%) Using index condition; Using where; Using rowid filter
|
||||
1 SIMPLE t2 range idx1,idx2 idx1 5 NULL 3 Using index condition; Using where
|
||||
1 SIMPLE t1 ref idx idx 5 test.t2.d 8
|
||||
explain format=json select * from t1,t2
|
||||
where a = d and (a,e) in ((3,3),(7,7),(2,2));
|
||||
@ -2581,14 +2581,6 @@ EXPLAIN
|
||||
"key": "idx1",
|
||||
"key_length": "5",
|
||||
"used_key_parts": ["d"],
|
||||
"rowid_filter": {
|
||||
"range": {
|
||||
"key": "idx2",
|
||||
"used_key_parts": ["e"]
|
||||
},
|
||||
"rows": 12,
|
||||
"selectivity_pct": 60
|
||||
},
|
||||
"loops": 1,
|
||||
"rows": 3,
|
||||
"cost": "COST_REPLACED",
|
||||
|
Reference in New Issue
Block a user