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 `TABLE_A` ADD INDEX `table_a_idx_mode` (`mode`);
SELECT
TABLE_A.amount,
NULL AS from_bank_id,
TABLE_A.bank_id AS to_bank_id
FROM
TABLE_A
WHERE
TABLE_A.mode = 'Incoming'
UNION
ALL SELECT
TABLE_A.amount,
NULL AS to_bank_id,
TABLE_A.bank_id AS from_bank_id
FROM
TABLE_A
WHERE
TABLE_A.mode = 'Outgoing'