mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
c5a9a63293
The optimizer erroneously allowed to use join cache when joining a splittable materialized table together with splitting optimization. As a consequence in some rare cases the server returned wrong result sets for queries with materialized derived. This patch allows to use either join cache without usage of splitting technique for materialization of a splittable derived table or splitting without usage of join cache when joining such table. The costs the these alternatives are compared and the best variant is chosen.
26 lines
530 B
Text
26 lines
530 B
Text
--source include/have_innodb.inc
|
|
|
|
--echo #
|
|
--echo # MDEV-16917: do not use splitting for derived with join cache
|
|
--echo #
|
|
|
|
CREATE TABLE t1 (
|
|
n1 int(10) NOT NULL,
|
|
n2 int(10) NOT NULL,
|
|
c1 char(1) NOT NULL,
|
|
KEY c1 (c1),
|
|
KEY n1_c1_n2 (n1,c1,n2)
|
|
) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (0, 2, 'a'), (1, 3, 'a');
|
|
|
|
ANALYZE TABLE t1;
|
|
|
|
Let $q=
|
|
SELECT t1.n1 FROM t1, (SELECT n1, n2 FROM t1 WHERE c1 = 'a' GROUP BY n1) as t
|
|
WHERE t.n1 = t1.n1 AND t.n2 = t1.n2 AND c1 = 'a' GROUP BY n1;
|
|
|
|
eval EXPLAIN $q;
|
|
eval $q;
|
|
|
|
DROP TABLE t1;
|
|
|