explain.depesz.com

PostgreSQL's explain analyze made readable

Result: manC

Settings
# exclusive inclusive rows x rows loops node
1. 0.825 0.825 ↑ 1.8 6 1

CTE Scan on tree (cost=310.73..310.95 rows=11 width=76) (actual time=0.391..0.825 rows=6 loops=1)

2.          

CTE c1

3. 0.034 0.299 ↑ 43.3 7 1

Recursive Union (cost=23.05..239.69 rows=303 width=44) (actual time=0.120..0.299 rows=7 loops=1)

4. 0.062 0.130 ↓ 1.3 4 1

Hash Right Join (cost=23.05..40.38 rows=3 width=44) (actual time=0.117..0.130 rows=4 loops=1)

  • Hash Cond: (slaves.lead_id = w.id)
  • Filter: (slaves.id IS NULL)
  • Rows Removed by Filter: 3
5. 0.013 0.013 ↑ 96.7 6 1

Seq Scan on worker slaves (cost=0.00..15.80 rows=580 width=8) (actual time=0.010..0.013 rows=6 loops=1)

6. 0.014 0.055 ↑ 96.7 6 1

Hash (cost=15.80..15.80 rows=580 width=40) (actual time=0.055..0.055 rows=6 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
7. 0.041 0.041 ↑ 96.7 6 1

Seq Scan on worker w (cost=0.00..15.80 rows=580 width=40) (actual time=0.032..0.041 rows=6 loops=1)

8. 0.073 0.135 ↑ 30.0 1 3

Hash Join (cost=0.97..19.33 rows=30 width=44) (actual time=0.041..0.045 rows=1 loops=3)

  • Hash Cond: (w_1.id = c1.lead_id)
9. 0.020 0.020 ↑ 96.7 6 2

Seq Scan on worker w_1 (cost=0.00..15.80 rows=580 width=40) (actual time=0.007..0.010 rows=6 loops=2)

10. 0.024 0.042 ↑ 30.0 1 3

Hash (cost=0.60..0.60 rows=30 width=8) (actual time=0.014..0.014 rows=1 loops=3)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
11. 0.018 0.018 ↑ 15.0 2 3

WorkTable Scan on c1 (cost=0.00..0.60 rows=30 width=8) (actual time=0.004..0.006 rows=2 loops=3)

12.          

CTE ranked_workers

13. 0.051 0.367 ↑ 33.3 6 1

HashAggregate (cost=9.09..11.09 rows=200 width=44) (actual time=0.356..0.367 rows=6 loops=1)

  • Group Key: c1_1.id, c1_1.lead_id, c1_1.first_name
14. 0.316 0.316 ↑ 43.3 7 1

CTE Scan on c1 c1_1 (cost=0.00..6.06 rows=303 width=44) (actual time=0.122..0.316 rows=7 loops=1)

15.          

CTE tree

16. 0.047 0.809 ↑ 1.8 6 1

Recursive Union (cost=0.00..59.95 rows=11 width=76) (actual time=0.387..0.809 rows=6 loops=1)

17. 0.420 0.420 ↓ 4.0 4 1

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

  • Filter: (lvl = 0)
  • Rows Removed by Filter: 2
18. 0.009 0.342 ↑ 1.0 1 3

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

19. 0.093 0.333 ↑ 1.0 1 3

GroupAggregate (cost=5.49..5.52 rows=1 width=108) (actual time=0.110..0.111 rows=1 loops=3)

  • 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.054 0.240 ↑ 1.0 1 3

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

  • Sort Key: next_masters_ranked.id, next_masters_ranked.lead_id, next_masters_ranked.first_name, next_masters_ranked.lvl, next_masters_ranked.j
  • Sort Method: quicksort Memory: 25kB
21. 0.012 0.186 ↑ 1.0 1 3

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

  • Filter: (next_masters_ranked.lvl = (next_masters_ranked.max_processed_level + 1))
  • Rows Removed by Filter: 0
22. 0.069 0.174 ↑ 10.0 1 3

WindowAgg (cost=0.33..5.33 rows=10 width=84) (actual time=0.055..0.058 rows=1 loops=3)

23. 0.056 0.105 ↑ 10.0 1 3

Hash Join (cost=0.33..5.17 rows=10 width=84) (actual time=0.028..0.035 rows=1 loops=3)

  • Hash Cond: (next_masters.id = processed_slaves.lead_id)
24. 0.010 0.010 ↑ 33.3 6 2

CTE Scan on ranked_workers next_masters (cost=0.00..4.00 rows=200 width=44) (actual time=0.001..0.005 rows=6 loops=2)

25. 0.024 0.039 ↑ 10.0 1 3

Hash (cost=0.20..0.20 rows=10 width=40) (actual time=0.013..0.013 rows=1 loops=3)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
26. 0.015 0.015 ↑ 5.0 2 3

WorkTable Scan on tree processed_slaves (cost=0.00..0.20 rows=10 width=40) (actual time=0.003..0.005 rows=2 loops=3)

Planning time : 1.231 ms
Execution time : 1.185 ms