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 run_item_idx_completed_at_started_at ON "run_item" ("completed_at","started_at");
SELECT
run_item.id,
(EXTRACT(epoch
FROM
now()) - EXTRACT(epoch
FROM
started_at)) completed_time
FROM
run_item
WHERE
run_item.started_at IS NOT NULL
AND run_item.completed_at IS NULL