1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge commit '10.4' into 10.5

This commit is contained in:
Oleksandr Byelkin
2021-01-06 10:53:00 +01:00
160 changed files with 2757 additions and 1356 deletions

View File

@@ -7801,6 +7801,30 @@ SEL_TREE *Item_func_in::get_func_mm_tree(RANGE_OPT_PARAM *param,
if (array->count > NOT_IN_IGNORE_THRESHOLD || !value_item)
DBUG_RETURN(0);
/*
If this is "unique_key NOT IN (...)", do not consider it sargable (for
any index, not just the unique one). The logic is as follows:
- if there are only a few constants, this condition is not selective
(unless the table is also very small in which case we won't gain
anything)
- If there are a lot of constants, the overhead of building and
processing enormous range list is not worth it.
*/
if (param->using_real_indexes)
{
key_map::Iterator it(field->key_start);
uint key_no;
while ((key_no= it++) != key_map::Iterator::BITMAP_END)
{
KEY *key_info= &field->table->key_info[key_no];
if (key_info->user_defined_key_parts == 1 &&
(key_info->flags & HA_NOSAME))
{
DBUG_RETURN(0);
}
}
}
/* Get a SEL_TREE for "(-inf|NULL) < X < c_0" interval. */
uint i=0;
do