explain.depesz.com

PostgreSQL's explain analyze made readable

Result: f5t2

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

Sort (cost=6,455,615.35..6,455,757.56 rows=56,882 width=32) (actual rows= loops=)

  • Sort Key: bottom_network.customer_network_id
2.          

CTE bottom_network

3. 0.000 0.000 ↓ 0.0

Recursive Union (cost=1,000.00..3,224,846.79 rows=56,761 width=32) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Gather (cost=1,000.00..187,168.23 rows=1 width=32) (actual rows= loops=)

  • Workers Planned: 2
5. 0.000 0.000 ↓ 0.0

Parallel Seq Scan on customer_network_normalized a1 (cost=0.00..186,168.12 rows=1 width=32) (actual rows= loops=)

  • Filter: (customer_id = 1)
6. 0.000 0.000 ↓ 0.0

Hash Join (cost=0.33..303,654.34 rows=5,676 width=32) (actual rows= loops=)

  • Hash Cond: (a2.parent_customer_id = a1_1.customer_id)
7. 0.000 0.000 ↓ 0.0

Seq Scan on customer_network_normalized a2 (cost=0.00..252,043.00 rows=13,747,800 width=32) (actual rows= loops=)

8. 0.000 0.000 ↓ 0.0

Hash (cost=0.20..0.20 rows=10 width=8) (actual rows= loops=)

9. 0.000 0.000 ↓ 0.0

WorkTable Scan on bottom_network a1_1 (cost=0.00..0.20 rows=10 width=8) (actual rows= loops=)

10.          

CTE top_network

11. 0.000 0.000 ↓ 0.0

Recursive Union (cost=1,000.00..3,223,147.59 rows=121 width=32) (actual rows= loops=)

12. 0.000 0.000 ↓ 0.0

Gather (cost=1,000.00..187,168.23 rows=1 width=32) (actual rows= loops=)

  • Workers Planned: 2
13. 0.000 0.000 ↓ 0.0

Parallel Seq Scan on customer_network_normalized a1_2 (cost=0.00..186,168.12 rows=1 width=32) (actual rows= loops=)

  • Filter: (customer_id = 1)
14. 0.000 0.000 ↓ 0.0

Hash Join (cost=0.33..303,597.70 rows=12 width=32) (actual rows= loops=)

  • Hash Cond: (a2_1.customer_id = a1_3.parent_customer_id)
15. 0.000 0.000 ↓ 0.0

Seq Scan on customer_network_normalized a2_1 (cost=0.00..252,043.00 rows=13,747,800 width=32) (actual rows= loops=)

16. 0.000 0.000 ↓ 0.0

Hash (cost=0.20..0.20 rows=10 width=8) (actual rows= loops=)

17. 0.000 0.000 ↓ 0.0

WorkTable Scan on top_network a1_3 (cost=0.00..0.20 rows=10 width=8) (actual rows= loops=)

18. 0.000 0.000 ↓ 0.0

HashAggregate (cost=2,559.69..3,128.51 rows=56,882 width=32) (actual rows= loops=)

  • Group Key: bottom_network.id, bottom_network.parent_customer_id, bottom_network.customer_id, bottom_network.customer_network_id
19. 0.000 0.000 ↓ 0.0

Append (cost=0.00..1,990.87 rows=56,882 width=32) (actual rows= loops=)

20. 0.000 0.000 ↓ 0.0

CTE Scan on bottom_network (cost=0.00..1135.22 rows=56761 width=32)" -> CTE Scan on top_network (cost=0.00..2.42 rows=121 width=32) (actual rows= loops=)