1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-30540 Wrong result with IN list length reaching IN_PREDICATE_CONVERSION_THRESHOLD

The problem was the mysql_derived_prepare() did not correctly set
'distinct' when creating a temporary derivated table.

Fixed by separating checking for distinct for queries with and without
UNION.

Other things:
- Fixed bug in generate_derived_keys_for_table() where we set the wrong
  bit for join_tab->keys
- Cleaned up JOIN::drop_unused_derived_keys()
- Changed TABLE::use_index() to keep unique keys and update
  share->key_parts

Author: Sergei Petrunia <sergey@mariadb.com>, monty@mariadb.org
This commit is contained in:
Monty
2023-02-10 13:18:39 +02:00
parent eb441f6cb7
commit bd9ca2a0e3
16 changed files with 388 additions and 155 deletions

View File

@ -129,7 +129,7 @@ left join
on t1.f1=t.f1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t const f2 NULL NULL NULL 0 Impossible ON condition
1 PRIMARY <derived2> const key1 NULL NULL NULL 0 Impossible ON condition
1 PRIMARY <derived2> const key0,key1 NULL NULL NULL 0 Impossible ON condition
1 PRIMARY t1 ALL NULL NULL NULL NULL 3
2 DERIVED t2 ALL PRIMARY NULL NULL NULL 3 Using temporary; Using filesort
set statement optimizer_switch='split_materialized=off' for explain select t.f2
@ -139,7 +139,7 @@ left join
on t1.f1=t.f1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t const f2 NULL NULL NULL 0 Impossible ON condition
1 PRIMARY <derived3> const key1 NULL NULL NULL 0 Impossible ON condition
1 PRIMARY <derived3> const key0,key1 NULL NULL NULL 0 Impossible ON condition
1 PRIMARY t1 ALL NULL NULL NULL NULL 3
3 DERIVED t2 index NULL PRIMARY 4 NULL 3
drop view v1;