explain.depesz.com

PostgreSQL's explain analyze made readable

Result: uj4A

Settings
# exclusive inclusive rows x rows loops node
1. 44.604 44.604 ↑ 1,198.1 13,662 1

CTE Scan on cte (cost=1,790,924.72..2,118,280.26 rows=16,367,777 width=32) (actual time=0.141..44.604 rows=13,662 loops=1)

2.          

CTE cte

3. 5.532 40.602 ↑ 1,198.1 13,662 1

Recursive Union (cost=3,247.21..1,790,924.72 rows=16,367,777 width=32) (actual time=0.139..40.602 rows=13,662 loops=1)

4. 2.483 10.850 ↓ 12.9 13,662 1

Merge Semi Join (cost=3,247.21..4,713.68 rows=1,057 width=32) (actual time=0.137..10.850 rows=13,662 loops=1)

  • Merge Cond: (a.customer_internal_id = al.parent_customer_internal_id)
5. 2.048 5.037 ↑ 46.4 13,801 1

Merge Join (cost=3,236.25..187,435.68 rows=640,220 width=40) (actual time=0.062..5.037 rows=13,801 loops=1)

  • Merge Cond: (a.customer_internal_id = aa.parent_customer_internal_id)
6. 0.131 0.131 ↑ 10,209.7 101 1

Index Scan using idx_alignment_team_id_start_end_date on alignment a (cost=0.56..638,681.40 rows=1,031,177 width=24) (actual time=0.034..0.131 rows=101 loops=1)

  • Index Cond: ((team_internal_id = 103) AND ((alignment_type)::text = 'explicit'::text) AND (start_date <= '2020-09-09'::date) AND (end_date > '2020-09-09'::date))
7. 2.858 2.858 ↑ 360.0 13,801 1

Index Scan using idx_affiliation_alignment_parent_customer_internal_id on affiliation_alignment aa (cost=0.43..165,550.63 rows=4,968,080 width=16) (actual time=0.022..2.858 rows=13,801 loops=1)

8. 3.330 3.330 ↓ 1.0 13,662 1

Index Scan using idx_affiliation_alignment_parent_customer_internal_id on affiliation_alignment al (cost=0.43..546.66 rows=13,210 width=8) (actual time=0.022..3.330 rows=13,662 loops=1)

  • Index Cond: ((parent_customer_internal_id > 15001) AND (parent_customer_internal_id <= 15,100))
  • Filter: (team_internal_id = 103)
9. 9.614 24.220 ↓ 0.0 0 1

Nested Loop (cost=0.43..145,885.55 rows=1,636,672 width=32) (actual time=24.220..24.220 rows=0 loops=1)

10. 0.944 0.944 ↓ 1.3 13,662 1

WorkTable Scan on cte c (cost=0.00..211.40 rows=10,570 width=24) (actual time=0.002..0.944 rows=13,662 loops=1)

11. 13.662 13.662 ↓ 0.0 0 13,662

Index Scan using idx_affiliation_alignment_parent_customer_internal_id on affiliation_alignment aa_1 (cost=0.43..12.23 rows=155 width=16) (actual time=0.001..0.001 rows=0 loops=13,662)

  • Index Cond: (parent_customer_internal_id = c.customer_internal_id)
Planning time : 0.866 ms
Execution time : 49.083 ms