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 emissions_totales_idx_schem_numre_annee_type_pollu_unite ON "emissions_synthese"."emissions_totales" ("schema_source","numreg","annee_ref","type_source_n1","polluant","unites");
SELECT
emissions_synthese.emissions_totales.numreg,
emissions_synthese.emissions_totales.annee_ref,
emissions_synthese.emissions_totales.type_source_n1,
emissions_synthese.emissions_totales.polluant,
emissions_synthese.emissions_totales.unites,
sum(emi) AS emi
FROM
emissions_synthese.emissions_totales
WHERE
emissions_synthese.emissions_totales.schema_source = 'residentiel'
GROUP BY
emissions_synthese.emissions_totales.numreg,
emissions_synthese.emissions_totales.annee_ref,
emissions_synthese.emissions_totales.type_source_n1,
emissions_synthese.emissions_totales.polluant,
emissions_synthese.emissions_totales.unites