explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Fu4s

Settings
# exclusive inclusive rows x rows loops node
1. 23,567.511 23,812.965 ↓ 2.7 90,188 1

Merge Right Join (cost=20,732.31..89,304.01 rows=32,882 width=422) (actual time=212.831..23,812.965 rows=90,188 loops=1)

  • Merge Cond: (pc.parent_contract_id = (COALESCE(rd.parent_contract_id, rd.contract_id)))
2.          

CTE parent_contract

3. 1.072 1.072 ↑ 1.0 2,481 1

Seq Scan on crm_contracts cc (cost=0.00..148.55 rows=2,547 width=19) (actual time=0.011..1.072 rows=2,481 loops=1)

  • Filter: (kind = 1)
  • Rows Removed by Filter: 2368
4. 1.052 2.913 ↑ 1.0 2,481 1

Sort (cost=195.03..201.40 rows=2,547 width=40) (actual time=2.505..2.913 rows=2,481 loops=1)

  • Sort Key: pc.parent_contract_id
  • Sort Method: quicksort Memory: 278kB
5. 1.861 1.861 ↑ 1.0 2,481 1

CTE Scan on parent_contract pc (cost=0.00..50.94 rows=2,547 width=40) (actual time=0.013..1.861 rows=2,481 loops=1)

6. 83.343 242.541 ↓ 34.9 90,188 1

Sort (cost=20,388.73..20,395.18 rows=2,582 width=131) (actual time=210.037..242.541 rows=90,188 loops=1)

  • Sort Key: (COALESCE(rd.parent_contract_id, rd.contract_id))
  • Sort Method: quicksort Memory: 20298kB
7. 159.198 159.198 ↓ 34.9 90,188 1

Seq Scan on resident_days rd (cost=0.00..20,242.40 rows=2,582 width=131) (actual time=0.019..159.198 rows=90,188 loops=1)

  • Filter: ((COALESCE(product_id, 0) <> 32) AND (date_part('year'::text, (date_actual)::timestamp without time zone) = '2019'::double precision))
  • Rows Removed by Filter: 428832
Planning time : 0.448 ms
Execution time : 23,824.131 ms