explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Lp8E : Optimization for: Optimization for: v3; plan #qXbP; plan #1hSH

Settings

Optimization path:

Optimization(s) for this plan:

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

HashAggregate (cost=1,157,279,052.92..1,157,282,999.89 rows=394,697 width=16) (actual rows= loops=)

  • Group Key: learnerset_learner.learnerid
2. 0.000 0.000 ↓ 0.0

Nested Loop (cost=20,393.74..929,260,449.75 rows=91,207,441,271 width=16) (actual rows= loops=)

3. 0.000 0.000 ↓ 0.0

Seq Scan on learnerset (cost=0.00..112.97 rows=2,176 width=16) (actual rows= loops=)

  • Filter: COALESCE((id = ANY ('{1bf91618-07e0-465e-a55d-9cfe00f75c2a}'::uuid[])), true)
4. 0.000 0.000 ↓ 0.0

Hash Join (cost=20,393.74..28,282.31 rows=41,915,184 width=16) (actual rows= loops=)

  • Hash Cond: (learnerset_learner.learnersetid = descendantsets.childid)
5. 0.000 0.000 ↓ 0.0

Seq Scan on learnerset_learner (cost=0.00..6,849.97 rows=394,697 width=32) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

Hash (cost=18,089.29..18,089.29 rows=184,356 width=16) (actual rows= loops=)

7. 0.000 0.000 ↓ 0.0

HashAggregate (cost=14,402.17..16,245.73 rows=184,356 width=16) (actual rows= loops=)

  • Group Key: descendantsets.childid
8.          

CTE descendantsets

9. 0.000 0.000 ↓ 0.0

Recursive Union (cost=0.28..8,412.08 rows=184,256 width=32) (actual rows= loops=)

10. 0.000 0.000 ↓ 0.0

Index Scan using learnerset_learnerset_ix_parentid on learnerset_learnerset base (cost=0.28..30.89 rows=86 width=32) (actual rows= loops=)

  • Index Cond: (parentid = $1)
11. 0.000 0.000 ↓ 0.0

Merge Join (cost=59.40..469.61 rows=18,417 width=32) (actual rows= loops=)

  • Merge Cond: (child.parentid = ancestor.childid)
12. 0.000 0.000 ↓ 0.0

Index Scan using learnerset_learnerset_ix_parentid on learnerset_learnerset child (cost=0.28..123.53 rows=4,283 width=32) (actual rows= loops=)

13. 0.000 0.000 ↓ 0.0

Sort (cost=59.12..61.27 rows=860 width=16) (actual rows= loops=)

  • Sort Key: ancestor.childid
14. 0.000 0.000 ↓ 0.0

WorkTable Scan on descendantsets ancestor (cost=0.00..17.20 rows=860 width=16) (actual rows= loops=)

15. 0.000 0.000 ↓ 0.0

Append (cost=0.00..5,529.20 rows=184,356 width=16) (actual rows= loops=)

16. 0.000 0.000 ↓ 0.0

CTE Scan on descendantsets (cost=0.00..3,685.12 rows=184,256 width=16) (actual rows= loops=)

17. 0.000 0.000 ↓ 0.0

ProjectSet (cost=0.00..0.52 rows=100 width=16) (actual rows= loops=)

18. 0.000 0.000 ↓ 0.0

Result (cost=0.00..0.01 rows=1 width=0) (actual rows= loops=)