In case you have your own slow SQL query, you can optimize it automatically here.
For the query above, the following recommendations will be helpful as part of the SQL tuning process.
You'll find 3 sections below:
ALTER TABLE `a` ADD INDEX `a_idx_a_b` (`a`,`b`);
ALTER TABLE `a` ADD INDEX `a_idx_a_c` (`a`,`c`);
SELECT
a.*,
a."no" AS indicator,
a.num
FROM
a
WHERE
a.a = a.b
UNION
ALL SELECT
a.*,
a."yes" AS indicator,
a.num
FROM
a
WHERE
a.a = a.c
UNION
ALL SELECT
a.*,
a."no" AS indicator,
a."All" AS num
FROM
a
WHERE
a.a = a.b
UNION
ALL SELECT
a.*,
a."yes" AS indicator,
a."All" AS num
FROM
a
WHERE
a.a = a.c