Saying I have this query:
EXPLAIN SELECT *
FROM (
SELECT "A" as a, i.n FROM (SELECT 1 AS n) AS i
UNION ALL SELECT "B" as a, i.n FROM (SELECT 1 AS n) AS i) AS t
WHERE a = "B";
MySQL says
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> \N ref <auto_key0> <auto_key0> 6 const 1 100.00 \N
2 DERIVED <derived3> \N system \N \N \N \N 1 100.00 \N
3 DERIVED \N \N \N \N \N \N \N \N \N No tables used
4 UNION <derived5> \N system \N \N \N \N 1 100.00 \N
5 DERIVED \N \N \N \N \N \N \N \N \N No tables used
So MySQL generated an intermediate index <auto_key0>
but what is behind this index? What columns are used in it? And is there a way I can set this index manually, and force MySQL to use some columns.