Skip to content

Commit 8d08350

Browse files
MDEV-36321 keys generated on derived tables produce wrong out_rows estimates
record per key statistics on keys generated for derived tables are missing, causing a fallback to the usage of MATCHING_ROWS_IN_OTHER_TABLE in best_access_path(). This can grossly overestimate the number of rows expected during a join and cause a bad join order. This patch tries to infer a few simple things about the derived table, like when the key being created matches the group by list inside (if any) inside the derived table. Approved by Sergei Petrunia (sergey@mariadb.com) Tested by Lena Startseva (lena.startseva@mariadb.com)
1 parent 28f5322 commit 8d08350

13 files changed

+1114
-187
lines changed

mysql-test/main/derived_cond_pushdown.result

Lines changed: 152 additions & 149 deletions
Large diffs are not rendered by default.

mysql-test/main/derived_cond_pushdown.test

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4280,6 +4280,9 @@ INSERT INTO t1 VALUES
42804280
(97,3290777,983,'2021-02-15 19:00:10'),(98,3290811,488,'2021-02-15 19:00:10'),
42814281
(99,3290917,1283,'2021-02-15 19:00:36'),(100,3290858,482,'2021-02-15 19:00:42');
42824282

4283+
insert into t1 select seq, 3300000+seq, 100+seq, '2021-02-09 18:31:35'
4284+
from seq_101_to_1000;
4285+
42834286
CREATE TABLE t2 (a int) ENGINE=MYISAM;
42844287
INSERT INTO t2 VALUES
42854288
(3289475),(3289496),(3289562),(3289593),(3289594),(3289595),(3289626),

0 commit comments

Comments
 (0)