explain.depesz.com

PostgreSQL's explain analyze made readable

Result: s42h

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

Finalize GroupAggregate (cost=24,929.63..24,937.23 rows=608 width=40) (actual rows= loops=)

  • Group Key: (timezone('Etc/UTC'::text, (date_trunc('week'::text, timezone('Etc/UTC'::text, ((insights_metrics.calculated_on)::timestamp with time zone - '6 days'::interval))) + '6 days'::interval)))
2. 0.000 0.000 ↓ 0.0

Sort (cost=24,929.63..24,930.54 rows=1,824 width=40) (actual rows= loops=)

  • Sort Key: (timezone('Etc/UTC'::text, (date_trunc('week'::text, timezone('Etc/UTC'::text, ((insights_metrics.calculated_on)::timestamp with time zone - '6 days'::interval))) + '6 days'::interval)))
3. 0.000 0.000 ↓ 0.0

Gather (cost=24,723.52..24,909.87 rows=1,824 width=40) (actual rows= loops=)

  • Workers Planned: 3
4. 0.000 0.000 ↓ 0.0

Partial HashAggregate (cost=23,723.52..23,727.47 rows=608 width=40) (actual rows= loops=)

  • Group Key: timezone('Etc/UTC'::text, (date_trunc('week'::text, timezone('Etc/UTC'::text, ((insights_metrics.calculated_on)::timestamp with time zone - '6 days'::interval))) + '6 days'::interval))
5. 0.000 0.000 ↓ 0.0

Hash Semi Join (cost=274.65..23,615.75 rows=43,106 width=119) (actual rows= loops=)

  • Hash Cond: ((insights_metrics.target_id)::integer = "ANY_subquery".id)
6. 0.000 0.000 ↓ 0.0

Parallel Index Scan using index_insights_metrics_on_calculated_on on insights_metrics (cost=0.09..23,003.89 rows=86,212 width=119) (actual rows= loops=)

  • Index Cond: ((calculated_on >= '2019-01-01'::date) AND (calculated_on <= '2019-09-10'::date) AND (calculated_on IS NOT NULL))
  • Filter: (((type)::text = 'Insights::Metrics::StoreExecution'::text) AND ((target_type)::text = 'Team'::text))
7. 0.000 0.000 ↓ 0.0

Hash (cost=270.58..270.58 rows=1,136 width=4) (actual rows= loops=)

8. 0.000 0.000 ↓ 0.0

Subquery Scan on ANY_subquery (cost=266.61..270.58 rows=1,136 width=4) (actual rows= loops=)

9. 0.000 0.000 ↓ 0.0

Sort (cost=266.61..267.18 rows=1,136 width=21) (actual rows= loops=)

  • Sort Key: teams.name
10. 0.000 0.000 ↓ 0.0

Seq Scan on teams (cost=0.00..255.08 rows=1,136 width=21) (actual rows= loops=)

  • Filter: ((deleted_at IS NULL) AND ((closed_at IS NULL) OR (closed_at > '2019-01-01 08:00:00'::timestamp without time zone)) AND (created_at < '2019-09-11 06:59:59.999999'::timestamp without time zone) AND (team_type_id = 4))