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

MDEV-35072: Assertion with optimizer_join_limit_pref_ratio and 1-table select

Variant for 11.2+:

In recompute_join_cost_with_limit(), do not subtract the cost of checking
the WHERE:
   pos->records_read* WHERE_COST_THD(join->thd)

It is already included in pos->read_time.

Also added comments about difference between this fix and the pre-11.2
variant.
This commit is contained in:
Sergei Petrunia
2024-10-10 12:33:59 +03:00
parent 690f8a91f9
commit 66b8d32b75
3 changed files with 32 additions and 15 deletions

View File

@ -208,6 +208,15 @@ select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as
set optimizer_search_depth=@tmp_osd;
set optimizer_trace=@tmp_os;
set optimizer_join_limit_pref_ratio=default;
drop table t1, t10, t11;
--echo #
--echo # MDEV-35072: Assertion failure with optimizer_join_limit_pref_ratio and 1-table select
--echo #
SET optimizer_join_limit_pref_ratio=1;
CREATE TABLE t1 (c1 INT, INDEX(c1));
INSERT INTO t1 VALUES (1),(2);
SELECT * FROM t1 ORDER BY c1 LIMIT 1;
DROP TABLE t1;
set optimizer_join_limit_pref_ratio=default;