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 `INVOICES` ADD INDEX `invoices_idx_year_invoicedat_quarter_invoice` (`year_invoicedate`,`quarter_invoicedate`);
SELECT
SUM(INVOICES.invoiceAmt) AS invoiceTotal,
CONCAT('Q',
QUARTER(INVOICES.invoiceDate),
'(',
YEAR(INVOICES.invoiceDate),
')')
FROM
INVOICES
GROUP BY
INVOICES.year_invoicedate,
INVOICES.quarter_invoicedate
ORDER BY
YEAR(INVOICES.invoiceDate),
QUARTER(INVOICES.invoiceDate)