explain.depesz.com

PostgreSQL's explain analyze made readable

Result: kwcj

Settings
# exclusive inclusive rows x rows loops node
1. 30.136 1,760.107 ↑ 1.6 67 1

GroupAggregate (cost=2,929.49..139,218.08 rows=109 width=12) (actual time=487.356..1,760.107 rows=67 loops=1)

  • Group Key: servicing_servicecontract.service_id
2. 488.463 1,729.971 ↑ 3.4 3,920 1

Merge Join (cost=2,929.49..139,149.96 rows=13,407 width=4) (actual time=453.355..1,729.971 rows=3,920 loops=1)

  • Merge Cond: (servicing_service.id = servicing_servicecontract.service_id)
  • Join Filter: (SubPlan 1)
  • Rows Removed by Join Filter: 24846
3. 2.188 3.482 ↓ 1.0 126 1

Sort (cost=9.59..9.90 rows=123 width=16) (actual time=2.550..3.482 rows=126 loops=1)

  • Sort Key: servicing_service.id
  • Sort Method: quicksort Memory: 30kB
4. 1.294 1.294 ↓ 1.0 126 1

Seq Scan on servicing_service (cost=0.00..5.32 rows=123 width=16) (actual time=0.018..1.294 rows=126 loops=1)

  • Filter: ((frequency IS NOT NULL) AND ("interval" IS NOT NULL))
  • Rows Removed by Filter: 6
5. 434.764 662.706 ↑ 1.0 28,775 1

Sort (cost=2,919.90..2,991.84 rows=28,775 width=8) (actual time=450.648..662.706 rows=28,775 loops=1)

  • Sort Key: servicing_servicecontract.service_id
  • Sort Method: quicksort Memory: 2117kB
6. 227.942 227.942 ↑ 1.0 28,775 1

Seq Scan on servicing_servicecontract (cost=0.00..788.75 rows=28,775 width=8) (actual time=0.032..227.942 rows=28,775 loops=1)

7.          

SubPlan (for Merge Join)

8. 575.320 575.320 ↓ 0.0 0 28,766

Function Scan on generate_series ts (cost=0.07..25.07 rows=5 width=0) (actual time=0.020..0.020 rows=0 loops=28,766)

  • Filter: (date_trunc('month'::text, ((ts)::date)::timestamp with time zone) = date_trunc('month'::text, ('2019-12-01'::date)::timestamp with time zone))
  • Rows Removed by Filter: 10
Planning time : 1.224 ms
Execution time : 1,761.173 ms