Details
Description
Looks like it is possible to skip the building sorted Ordered_key structures for subselect_rowid_merge_engine when there is only one key in the materialized subquery.
We have predicate
left_expr IN (SELECT <subq1>)
|
where left_expr is a scalar (not a tuple). The logic in this case looks as follows:
if (left_expr is NULL) {
|
if (subq1 produced any rows) {
|
// note that we don't care if subq1 has produced
|
// NULLs or not.
|
NULL IN (<some values>) -> UNKNOWN, i.e. NULL.
|
} else {
|
NULL IN ({empty-set}) -> FALSE.
|
}
|
} else {
|
// left_expr is a non-NULL value
|
if (subq1 output has a match for left_expr) {
|
left_expr IN (..., left_expr ...) -> TRUE
|
} else {
|
// no "known" matches.
|
if (subq1 output has a NULL) {
|
left_expr IN ( ... NULL ...) ->
|
(NULL could have been a match or not)
|
-> NULL.
|
} else {
|
// subq1 didn't produce any "UNKNOWNs" so
|
// we're positive there weren't any matches
|
-> FALSE.
|
}
|
}
|
}
|
Attachments
Issue Links
- relates to
-
MDEV-34041 Additional information for materialized subqueries must be displayed in EXPLAIN/ANALYZE FORMAT=JSON
- Closed