explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 4AyM

Settings
# exclusive inclusive rows x rows loops node
1. 0.786 515.453 ↑ 1.0 1 1

Aggregate (cost=24,768.15..24,768.16 rows=1 width=8) (actual time=515.453..515.453 rows=1 loops=1)

  • Buffers: shared hit=21365
2. 9.348 514.667 ↓ 1.0 427 1

Hash Left Join (cost=18,324.28..24,767.09 rows=426 width=16) (actual time=311.627..514.667 rows=427 loops=1)

  • Hash Cond: (matricula2_.unidadeensino = unidadeens3_.codigo)
  • Filter: ((pessoasei5_.codigo = 556882) OR (unidadeens3_.codigo = ANY ('{2,56}'::integer[])))
  • Rows Removed by Filter: 15932
  • Buffers: shared hit=21365
3. 15.247 505.178 ↑ 1.0 16,359 1

Hash Left Join (cost=18,314.02..24,710.38 rows=16,386 width=24) (actual time=310.852..505.178 rows=16,359 loops=1)

  • Hash Cond: (matricula2_.consultor = funcionari4_.codigo)
  • Buffers: shared hit=21330
4. 126.685 460.998 ↑ 1.0 16,359 1

Hash Right Join (cost=9,578.18..15,810.96 rows=16,386 width=24) (actual time=281.868..460.998 rows=16,359 loops=1)

  • Hash Cond: ((matricula2_.matricula)::text = (matriculap1_.matricula)::text)
  • Buffers: shared hit=9150
5. 52.531 52.531 ↓ 1.0 154,548 1

Seq Scan on matricula matricula2_ (cost=0.00..5,103.95 rows=154,395 width=22) (actual time=0.011..52.531 rows=154,548 loops=1)

  • Buffers: shared hit=3560
6. 15.557 281.782 ↑ 1.0 16,359 1

Hash (cost=9,373.35..9,373.35 rows=16,386 width=30) (actual time=281.782..281.782 rows=16,359 loops=1)

  • Buckets: 32768 Batches: 1 Memory Usage: 1324kB
  • Buffers: shared hit=5590
7. 30.816 266.225 ↑ 1.0 16,359 1

Hash Left Join (cost=8,567.51..9,373.35 rows=16,386 width=30) (actual time=225.528..266.225 rows=16,359 loops=1)

  • Hash Cond: (contrato0_.matricula_periodo = matriculap1_.codigo)
  • Buffers: shared hit=5590
8. 11.306 11.306 ↑ 1.0 16,359 1

Seq Scan on tb_gestao_contrato contrato0_ (cost=0.00..762.83 rows=16,386 width=20) (actual time=0.018..11.306 rows=16,359 loops=1)

  • Filter: (status = 1)
  • Buffers: shared hit=558
9. 108.685 224.103 ↓ 1.0 157,305 1

Hash (cost=6,603.34..6,603.34 rows=157,134 width=22) (actual time=224.102..224.103 rows=157,305 loops=1)

  • Buckets: 262144 Batches: 1 Memory Usage: 10752kB
  • Buffers: shared hit=5032
10. 115.418 115.418 ↓ 1.0 157,305 1

Seq Scan on matriculaperiodo matriculap1_ (cost=0.00..6,603.34 rows=157,134 width=22) (actual time=0.014..115.418 rows=157,305 loops=1)

  • Buffers: shared hit=5032
11. 3.787 28.933 ↑ 1.0 3,831 1

Hash (cost=8,687.95..8,687.95 rows=3,831 width=8) (actual time=28.933..28.933 rows=3,831 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 182kB
  • Buffers: shared hit=12180
12. 4.890 25.146 ↑ 1.0 3,831 1

Nested Loop Left Join (cost=0.42..8,687.95 rows=3,831 width=8) (actual time=1.291..25.146 rows=3,831 loops=1)

  • Buffers: shared hit=12180
13. 1.101 1.101 ↑ 1.0 3,831 1

Seq Scan on funcionario funcionari4_ (cost=0.00..74.31 rows=3,831 width=8) (actual time=0.010..1.101 rows=3,831 loops=1)

  • Buffers: shared hit=36
14. 19.155 19.155 ↑ 1.0 1 3,831

Index Only Scan using pessoa_pkey on pessoa pessoasei5_ (cost=0.42..2.25 rows=1 width=4) (actual time=0.005..0.005 rows=1 loops=3,831)

  • Index Cond: (codigo = funcionari4_.pessoa)
  • Heap Fetches: 644
  • Buffers: shared hit=12144
15. 0.023 0.141 ↑ 1.0 77 1

Hash (cost=9.30..9.30 rows=77 width=4) (actual time=0.141..0.141 rows=77 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 11kB
  • Buffers: shared hit=35
16. 0.118 0.118 ↑ 1.0 77 1

Index Only Scan using unidadeensino_pkey on unidadeensino unidadeens3_ (cost=0.14..9.30 rows=77 width=4) (actual time=0.023..0.118 rows=77 loops=1)

  • Heap Fetches: 35
  • Buffers: shared hit=35
Planning time : 2.770 ms
Execution time : 515.794 ms