explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 9PuH

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

CTE Scan on tree (cost=310.73..310.95 rows=11 width=76) (actual rows= loops=)

2.          

CTE c1

3. 0.000 0.000 ↓ 0.0

Recursive Union (cost=23.05..239.69 rows=303 width=44) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=23.05..40.38 rows=3 width=44) (actual rows= loops=)

  • Hash Cond: (slaves.lead_id = w.id)
  • Filter: (slaves.id IS NULL)
5. 0.000 0.000 ↓ 0.0

Seq Scan on worker slaves (cost=0.00..15.80 rows=580 width=8) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

Hash (cost=15.80..15.80 rows=580 width=40) (actual rows= loops=)

7. 0.000 0.000 ↓ 0.0

Seq Scan on worker w (cost=0.00..15.80 rows=580 width=40) (actual rows= loops=)

8. 0.000 0.000 ↓ 0.0

Hash Join (cost=0.97..19.33 rows=30 width=44) (actual rows= loops=)

  • Hash Cond: (w_1.id = c1.lead_id)
9. 0.000 0.000 ↓ 0.0

Seq Scan on worker w_1 (cost=0.00..15.80 rows=580 width=40) (actual rows= loops=)

10. 0.000 0.000 ↓ 0.0

Hash (cost=0.60..0.60 rows=30 width=8) (actual rows= loops=)

11. 0.000 0.000 ↓ 0.0

WorkTable Scan on c1 (cost=0.00..0.60 rows=30 width=8) (actual rows= loops=)

12.          

CTE ranked_workers

13. 0.000 0.000 ↓ 0.0

HashAggregate (cost=9.09..11.09 rows=200 width=44) (actual rows= loops=)

  • Group Key: c1_1.id, c1_1.lead_id, c1_1.first_name
14. 0.000 0.000 ↓ 0.0

CTE Scan on c1 c1_1 (cost=0.00..6.06 rows=303 width=44) (actual rows= loops=)

15.          

CTE tree

16. 0.000 0.000 ↓ 0.0

Recursive Union (cost=0.00..59.95 rows=11 width=76) (actual rows= loops=)

17. 0.000 0.000 ↓ 0.0

CTE Scan on ranked_workers (cost=0.00..4.50 rows=1 width=76) (actual rows= loops=)

  • Filter: (lvl = 0)
18. 0.000 0.000 ↓ 0.0

Subquery Scan on *SELECT* 2 (cost=5.49..5.53 rows=1 width=76) (actual rows= loops=)

19. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=5.49..5.52 rows=1 width=108) (actual rows= loops=)

  • Group Key: next_masters_ranked.id, next_masters_ranked.lead_id, next_masters_ranked.first_name, next_masters_ranked.lvl, next_masters_ranked.j
20. 0.000 0.000 ↓ 0.0

Sort (cost=5.49..5.49 rows=1 width=76) (actual rows= loops=)

  • Sort Key: next_masters_ranked.id, next_masters_ranked.lead_id, next_masters_ranked.first_name, next_masters_ranked.lvl, next_masters_ranked.j
21. 0.000 0.000 ↓ 0.0

Subquery Scan on next_masters_ranked (cost=0.33..5.48 rows=1 width=76) (actual rows= loops=)

  • Filter: (next_masters_ranked.lvl = (next_masters_ranked.max_processed_level + 1))
22. 0.000 0.000 ↓ 0.0

WindowAgg (cost=0.33..5.33 rows=10 width=84) (actual rows= loops=)

23. 0.000 0.000 ↓ 0.0

Hash Join (cost=0.33..5.17 rows=10 width=84) (actual rows= loops=)

  • Hash Cond: (next_masters.id = processed_slaves.lead_id)
24. 0.000 0.000 ↓ 0.0

CTE Scan on ranked_workers next_masters (cost=0.00..4.00 rows=200 width=44) (actual rows= loops=)

25. 0.000 0.000 ↓ 0.0

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

26. 0.000 0.000 ↓ 0.0

WorkTable Scan on tree processed_slaves (cost=0.00..0.20 rows=10 width=40) (actual rows= loops=)