mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-31449: Assertion s->table->opt_range_condition_rows <= s->found_records
Fix a typo in make_join_statistics(): when updating statistics for derived table, set s->table->... not "table->..."
This commit is contained in:
@ -3424,3 +3424,18 @@ COUNT(*)
|
|||||||
2
|
2
|
||||||
DROP TABLE t1, t2, t3;
|
DROP TABLE t1, t2, t3;
|
||||||
# End of 10.5 tests
|
# End of 10.5 tests
|
||||||
|
#
|
||||||
|
# MDEV-31449: Assertion s->table->opt_range_condition_rows <= s->found_records
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (a INT, b INT);
|
||||||
|
INSERT INTO t1 VALUES (1,2),(3,4);
|
||||||
|
CREATE TABLE t2 (c INT);
|
||||||
|
INSERT INTO t2 VALUES (5),(6);
|
||||||
|
SET @tmp=@@OPTIMIZER_USE_CONDITION_SELECTIVITY, OPTIMIZER_USE_CONDITION_SELECTIVITY = 1;
|
||||||
|
SELECT * FROM
|
||||||
|
(SELECT t1.* FROM t1 WHERE t1.a IN (SELECT MAX(t2.c) FROM t2 JOIN t1)) AS sq1,
|
||||||
|
(SELECT t2.* FROM t2 JOIN t1 ON (t1.b IN (SELECT t1.b FROM t2 STRAIGHT_JOIN t1))) AS sq2;
|
||||||
|
a b c
|
||||||
|
SET OPTIMIZER_USE_CONDITION_SELECTIVITY=@tmp;
|
||||||
|
DROP TABLE t1,t2;
|
||||||
|
# End of 10.6 tests
|
||||||
|
@ -1835,3 +1835,22 @@ SELECT COUNT(*) FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON t2.b = t3.c) ON t1.a = t2.
|
|||||||
DROP TABLE t1, t2, t3;
|
DROP TABLE t1, t2, t3;
|
||||||
|
|
||||||
--echo # End of 10.5 tests
|
--echo # End of 10.5 tests
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-31449: Assertion s->table->opt_range_condition_rows <= s->found_records
|
||||||
|
--echo #
|
||||||
|
CREATE TABLE t1 (a INT, b INT);
|
||||||
|
INSERT INTO t1 VALUES (1,2),(3,4);
|
||||||
|
|
||||||
|
CREATE TABLE t2 (c INT);
|
||||||
|
INSERT INTO t2 VALUES (5),(6);
|
||||||
|
|
||||||
|
SET @tmp=@@OPTIMIZER_USE_CONDITION_SELECTIVITY, OPTIMIZER_USE_CONDITION_SELECTIVITY = 1;
|
||||||
|
|
||||||
|
SELECT * FROM
|
||||||
|
(SELECT t1.* FROM t1 WHERE t1.a IN (SELECT MAX(t2.c) FROM t2 JOIN t1)) AS sq1,
|
||||||
|
(SELECT t2.* FROM t2 JOIN t1 ON (t1.b IN (SELECT t1.b FROM t2 STRAIGHT_JOIN t1))) AS sq2;
|
||||||
|
|
||||||
|
SET OPTIMIZER_USE_CONDITION_SELECTIVITY=@tmp;
|
||||||
|
DROP TABLE t1,t2;
|
||||||
|
--echo # End of 10.6 tests
|
||||||
|
@ -5575,7 +5575,7 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
|
|||||||
get_delayed_table_estimates(s->table, &s->records, &s->read_time,
|
get_delayed_table_estimates(s->table, &s->records, &s->read_time,
|
||||||
&s->startup_cost);
|
&s->startup_cost);
|
||||||
s->found_records= s->records;
|
s->found_records= s->records;
|
||||||
table->opt_range_condition_rows=s->records;
|
s->table->opt_range_condition_rows=s->records;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
s->scan_time();
|
s->scan_time();
|
||||||
|
Reference in New Issue
Block a user