explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 1KfX

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

Sort (cost=14,522,568.01..14,683,288.82 rows=64,288,324 width=12) (actual rows= loops=)

  • Sort Key: fmstudents.did
2.          

CTE count_minus

3. 0.000 0.000 ↓ 0.0

Finalize GroupAggregate (cost=200,410.40..202,826.36 rows=8,018 width=20) (actual rows= loops=)

  • Group Key: sr.did
4. 0.000 0.000 ↓ 0.0

Gather Merge (cost=200,410.40..202,625.91 rows=16,036 width=20) (actual rows= loops=)

  • Workers Planned: 2
5. 0.000 0.000 ↓ 0.0

Partial GroupAggregate (cost=199,410.38..199,774.93 rows=8,018 width=20) (actual rows= loops=)

  • Group Key: sr.did
6. 0.000 0.000 ↓ 0.0

Sort (cost=199,410.38..199,467.25 rows=22,750 width=10) (actual rows= loops=)

  • Sort Key: sr.did
7. 0.000 0.000 ↓ 0.0

Nested Loop (cost=5,633.48..197,764.01 rows=22,750 width=10) (actual rows= loops=)

8. 0.000 0.000 ↓ 0.0

Hash Join (cost=5,633.05..146,043.99 rows=22,750 width=10) (actual rows= loops=)

  • Hash Cond: (s.sid = mw1.sid)
9. 0.000 0.000 ↓ 0.0

Parallel Seq Scan on students s (cost=0.00..119,491.12 rows=495,579 width=6) (actual rows= loops=)

  • Filter: (gender = 'F'::bpchar)
10. 0.000 0.000 ↓ 0.0

Hash (cost=2,635.69..2,635.69 rows=182,669 width=8) (actual rows= loops=)

11. 0.000 0.000 ↓ 0.0

Seq Scan on mw1 (cost=0.00..2,635.69 rows=182,669 width=8) (actual rows= loops=)

12. 0.000 0.000 ↓ 0.0

Index Scan using pk_rid on student_registrations sr (cost=0.43..2.27 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (rid = mw1.rid)
13.          

CTE fmstudents

14. 0.000 0.000 ↓ 0.0

Finalize GroupAggregate (cost=435,565.32..435,805.86 rows=8,018 width=20) (actual rows= loops=)

  • Group Key: sr_1.did
15. 0.000 0.000 ↓ 0.0

Sort (cost=435,565.32..435,605.41 rows=16,036 width=20) (actual rows= loops=)

  • Sort Key: sr_1.did
16. 0.000 0.000 ↓ 0.0

Gather (cost=432,761.51..434,445.29 rows=16,036 width=20) (actual rows= loops=)

  • Workers Planned: 2
17. 0.000 0.000 ↓ 0.0

Partial HashAggregate (cost=431,761.51..431,841.69 rows=8,018 width=20) (actual rows= loops=)

  • Group Key: sr_1.did
18. 0.000 0.000 ↓ 0.0

Hash Join (cost=203,842.52..398,428.18 rows=3,333,333 width=10) (actual rows= loops=)

  • Hash Cond: (sr_1.sid = s_1.sid)
19. 0.000 0.000 ↓ 0.0

Parallel Seq Scan on student_registrations sr_1 (cost=0.00..94,666.33 rows=3,333,333 width=8) (actual rows= loops=)

20. 0.000 0.000 ↓ 0.0

Hash (cost=138,558.23..138,558.23 rows=3,979,223 width=6) (actual rows= loops=)

21. 0.000 0.000 ↓ 0.0

Seq Scan on students s_1 (cost=0.00..138,558.23 rows=3,979,223 width=6) (actual rows= loops=)

22. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.00..2,250,331.88 rows=64,288,324 width=12) (actual rows= loops=)

23. 0.000 0.000 ↓ 0.0

CTE Scan on fmstudents (cost=0.00..160.36 rows=8,018 width=20) (actual rows= loops=)

24. 0.000 0.000 ↓ 0.0

CTE Scan on count_minus (cost=0.00..160.36 rows=8,018 width=16) (actual rows= loops=)