explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Qbhm

Settings
# exclusive inclusive rows x rows loops node
1. 0.007 531.242 ↑ 1.0 1 1

Unique (cost=20,452.61..20,452.62 rows=1 width=16) (actual time=531.237..531.242 rows=1 loops=1)

2. 0.011 531.235 ↑ 1.0 1 1

Sort (cost=20,452.61..20,452.61 rows=1 width=16) (actual time=531.233..531.235 rows=1 loops=1)

  • Sort Key: (min(horarioturmadia.data)), (max(horarioturmadia.data))
  • Sort Method: quicksort Memory: 25kB
3. 0.066 531.224 ↑ 1.0 1 1

Aggregate (cost=20,452.59..20,452.60 rows=1 width=16) (actual time=531.222..531.224 rows=1 loops=1)

4. 251.004 531.158 ↑ 24,305.2 36 1

Hash Join (cost=2,904.18..16,077.64 rows=874,989 width=8) (actual time=475.763..531.158 rows=36 loops=1)

  • Hash Cond: (horarioturmadia.horarioturma = horarioturma.codigo)
5. 263.960 263.960 ↓ 1.0 160,647 1

Seq Scan on horarioturmadia (cost=0.00..3,018.17 rows=160,617 width=12) (actual time=0.012..263.960 rows=160,647 loops=1)

  • Filter: (data IS NOT NULL)
6. 0.021 16.194 ↑ 1,531.2 12 1

Hash (cost=2,674.49..2,674.49 rows=18,375 width=4) (actual time=16.193..16.194 rows=12 loops=1)

  • Buckets: 32,768 Batches: 1 Memory Usage: 257kB
7. 0.033 16.173 ↑ 1,531.2 12 1

Nested Loop (cost=114.62..2,674.49 rows=18,375 width=4) (actual time=12.733..16.173 rows=12 loops=1)

8. 0.024 16.102 ↑ 1,421.0 1 1

Hash Join (cost=114.20..880.71 rows=1,421 width=12) (actual time=12.710..16.102 rows=1 loops=1)

  • Hash Cond: (turma.codigo = horarioturma.turma)
9. 5.556 5.572 ↑ 3,516.0 2 1

Seq Scan on turma (cost=8.30..725.45 rows=7,032 width=4) (actual time=2.187..5.572 rows=2 loops=1)

  • Filter: (((situacao)::text = 'AB'::text) AND ((codigo = 96,876) OR (hashed SubPlan 1)))
  • Rows Removed by Filter: 16,790
10.          

SubPlan (for Seq Scan)

11. 0.016 0.016 ↑ 1.0 1 1

Index Scan using idx_turmaagrupada_turma on turmaagrupada (cost=0.29..8.30 rows=1 width=4) (actual time=0.013..0.016 rows=1 loops=1)

  • Index Cond: (turma = 96,876)
12. 5.056 10.506 ↓ 1.0 3,374 1

Hash (cost=63.73..63.73 rows=3,373 width=8) (actual time=10.505..10.506 rows=3,374 loops=1)

  • Buckets: 4,096 Batches: 1 Memory Usage: 164kB
13. 5.450 5.450 ↓ 1.0 3,374 1

Seq Scan on horarioturma (cost=0.00..63.73 rows=3,373 width=8) (actual time=0.010..5.450 rows=3,374 loops=1)

14. 0.038 0.038 ↑ 1.2 12 1

Index Only Scan using ch_turmadisciplina_turma on turmadisciplina (cost=0.42..1.12 rows=14 width=4) (actual time=0.016..0.038 rows=12 loops=1)

  • Index Cond: (turma = turma.codigo)
  • Heap Fetches: 4
Planning time : 1.110 ms
Execution time : 531.384 ms