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 pg_activity_idx_state_change ON "pg_stat_activity" ("state_change" desc);
SELECT
pg_stat_activity.backend_start,
pg_stat_activity.query_start,
pg_stat_activity.state_change,
pg_stat_activity.wait_event_type,
pg_stat_activity.wait_event,
pg_stat_activity.state,
pg_stat_activity.query,
pg_stat_activity.backend_type
FROM
pg_stat_activity
ORDER BY
pg_stat_activity.state_change DESC