0
EXPLAIN
SELECT actor_id,
(SELECT 1 FROM sakila.film_actor WHERE film_actor.actor_id =
der_1.actor_id LIMIT 1)
FROM (
SELECT actor_id
FROM sakila.actor LIMIT 5
) AS der_1
UNION ALL
SELECT film_id,
(SELECT @var1 FROM sakila.rental LIMIT 1)
FROM (
SELECT film_id,
(SELECT 1 FROM sakila.store LIMIT 1)
FROM sakila.film LIMIT 5
) AS der_2;

I was reading about using EXPLAIN, and the explain result for this query had a row with select_type as UNION_RESULT. However, I don't get this row. Can someone help me understand this behavior?

id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 5 100.00 NULL
3 DERIVED actor NULL index NULL idx_actor_last_name 182 NULL 200 100.00 Using index
2 DEPENDENT SUBQUERY film_actor NULL ref PRIMARY PRIMARY 2 der_1.actor_id 1 100.00 Using index
4 UNION <derived6> NULL ALL NULL NULL NULL NULL 5 100.00 NULL
6 DERIVED film NULL index NULL idx_fk_language_id 1 NULL 881 100.00 Using index
7 SUBQUERY store NULL index NULL idx_unique_manager 1 NULL 2 100.00 Using index
5 UNCACHEABLE SUBQUERY rental NULL index NULL idx_fk_staff_id 1 NULL 15005 100.00 Using index
Rick James
80.7k5 gold badges52 silver badges119 bronze badges
asked Jun 7, 2020 at 17:26
0

1 Answer 1

0

I was reading about using EXPLAIN, and the explain result for this query had a row with select_type as UNION_RESULT. However, I don't get this row.

UNION ALL without any additional operation over a summarized dataset does not need UNION_RESULT. - https://dba.stackexchange.com/users/150107

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.