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 `EXTRA_MAPPINGS_PRE` ADD INDEX `extra_pre_idx_charge_mig_cod_mig_act_extras` (`CHARGE_ARRANGEMENT_NUMBER`,`MIG_MAIN_PROD_CODE`,`MIG_EXTRA_ACTION`,`EXTRAS_LIST`);
SELECT
E.CHARGE_ARRANGEMENT_NUMBER,
E.MIG_MAIN_PROD_CODE,
MAX(DECODE(UPPER(E.MIG_EXTRA_ACTION),
'KEEP',
E.MIG_EXTRA_ACTION)) AS EXTRAS_KEEP,
MAX(DECODE(UPPER(E.MIG_EXTRA_ACTION),
'DROP',
E.EXTRAS_LIST)) AS EXTRAS_DROP
FROM
EXTRA_MAPPINGS_PRE E
GROUP BY
E.CHARGE_ARRANGEMENT_NUMBER,
E.MIG_MAIN_PROD_CODE
ORDER BY
NULL