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:
CREATE INDEX table1_idx_id ON Table1 (ID);
CREATE INDEX table2_idx_type_id ON Table2 (TYPE,ID);
SELECT
SUM(T.TOTALS_TO_DATE),
R.ID
FROM
Table2 T,
Table1 R
WHERE
T.ID = R.ID
AND T.TYPE = 'type5'
GROUP BY
R.ID