1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Update matching_candidates_in_table() to treat all conditions similar

Fixed also that the 'with_found_constraint parameter' to
matching_candidates_in_table() is as documented: It is now true only
if there is a reference to a previous table in the WHERE condition for
the current examined table (as it was originally documented)

Changes in test results:
- Filtered was 25% smaller for some queries (expected).
- Some join order changed (probably because the tables had very few rows).
- Some more table scans, probably because there would be fewer returned
  rows.
- Some tests exposes a bug that if there is more filtered rows, then the
  cost for table scan will be higher. This will be fixed in a later commit.
This commit is contained in:
Monty
2021-10-07 20:15:34 +03:00
committed by Sergei Petrunia
parent dc2f0d138d
commit b67144893a
41 changed files with 286 additions and 269 deletions

View File

@ -3260,10 +3260,10 @@ ORDER BY path;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 15 Using filesort
2 DERIVED t2 ALL NULL NULL NULL NULL 15 Using where
3 RECURSIVE UNION t2 ALL NULL NULL NULL NULL 15 Using where
3 RECURSIVE UNION <derived2> ref key0 key0 5 test.t2.id 2
4 RECURSIVE UNION t2 ALL NULL NULL NULL NULL 15 Using where
4 RECURSIVE UNION <derived2> ref key0 key0 5 test.t2.id 2
3 RECURSIVE UNION t2 ALL NULL NULL NULL NULL 15
3 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 15 Using where; Using join buffer (flat, BNL join)
4 RECURSIVE UNION t2 ALL NULL NULL NULL NULL 15
4 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 15 Using where; Using join buffer (flat, BNL join)
NULL UNION RESULT <union2,3,4> ALL NULL NULL NULL NULL NULL
DROP TABLE t1,t2;
set tmp_memory_table_size=default;
@ -4467,8 +4467,8 @@ NULL UNION RESULT <union4,5> ALL NULL NULL NULL NULL NULL
3 DERIVED v ALL NULL NULL NULL NULL 12 Using where
3 DERIVED h ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
3 DERIVED w ALL NULL NULL NULL NULL 12 Using where; Using join buffer (incremental, BNL join)
2 RECURSIVE UNION <derived4> ALL NULL NULL NULL NULL 2
2 RECURSIVE UNION h ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
2 RECURSIVE UNION h ALL NULL NULL NULL NULL 12
2 RECURSIVE UNION <derived4> ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
2 RECURSIVE UNION w ALL NULL NULL NULL NULL 12 Using where; Using join buffer (incremental, BNL join)
NULL UNION RESULT <union3,2> ALL NULL NULL NULL NULL NULL
prepare stmt from "with recursive
@ -4566,8 +4566,8 @@ id select_type table type possible_keys key key_len ref rows Extra
5 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 2
NULL UNION RESULT <union3,4,5> ALL NULL NULL NULL NULL NULL
2 DERIVED h ALL NULL NULL NULL NULL 12
2 DERIVED w ALL NULL NULL NULL NULL 12 Using join buffer (flat, BNL join)
2 DERIVED <derived3> ALL NULL NULL NULL NULL 12 Using where; Using join buffer (incremental, BNL join)
2 DERIVED <derived3> ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
2 DERIVED w ALL NULL NULL NULL NULL 12 Using where; Using join buffer (incremental, BNL join)
prepare stmt from "with recursive
ancestor_couples(h_id, h_name, h_dob, h_father, h_mother,
w_id, w_name, w_dob, w_father, w_mother)