explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 39vO : Optimization for: original; plan #R81y

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 0.205 440.458 ↑ 1.0 600 1

Limit (cost=31,670.06..38,562.37 rows=600 width=164) (actual time=356.700..440.458 rows=600 loops=1)

2. 69.219 440.253 ↑ 33,868.6 600 1

Hash Left Join (cost=31,670.06..233,464,892.84 rows=20,321,189 width=164) (actual time=356.698..440.253 rows=600 loops=1)

  • Hash Cond: (b.numero_prontuario = (c.numero_prontuario)::numeric)
3. 12.744 15.291 ↑ 1,144.6 2,340 1

Hash Left Join (cost=24.17..147,182.84 rows=2,678,448 width=75) (actual time=0.088..15.291 rows=2,340 loops=1)

  • Hash Cond: (translate(translate((b.nome_setor)::text, ';./\¨-_*?,()[]{}@#$%"&'::text, ' '::text), 'áàãââÁÀÃÂéêÉÊíÍóõôÓÔÕúüÚÜçÇ'::text, 'aaaaaAAAAeeEEiIoooOOOuuUUcC'::text) = (sa.nome)::text)
4. 0.642 2.539 ↑ 1,144.6 2,340 1

Hash Left Join (cost=11.92..117,038.05 rows=2,678,448 width=71) (actual time=0.068..2.539 rows=2,340 loops=1)

  • Hash Cond: ((b.tipo_atendimento)::text = (ta.descricao)::text)
5. 1.308 1.886 ↑ 1,144.6 2,340 1

Hash Left Join (cost=10.90..106,580.78 rows=2,678,448 width=67) (actual time=0.048..1.886 rows=2,340 loops=1)

  • Hash Cond: (b."ISN" = ba.isn)
6. 0.574 0.574 ↑ 1,144.6 2,340 1

Seq Scan on tb_boletim_atendimento b (cost=0.00..72,754.48 rows=2,678,448 width=63) (actual time=0.011..0.574 rows=2,340 loops=1)

7. 0.001 0.004 ↓ 0.0 0 1

Hash (cost=10.40..10.40 rows=40 width=8) (actual time=0.004..0.004 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
8. 0.003 0.003 ↓ 0.0 0 1

Seq Scan on tb_boletim_atendimento ba (cost=0.00..10.40 rows=40 width=8) (actual time=0.003..0.003 rows=0 loops=1)

9. 0.003 0.011 ↑ 1.0 1 1

Hash (cost=1.01..1.01 rows=1 width=222) (actual time=0.011..0.011 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
10. 0.008 0.008 ↑ 1.0 1 1

Seq Scan on tb_tipo_atendimento ta (cost=0.00..1.01 rows=1 width=222) (actual time=0.007..0.008 rows=1 loops=1)

11. 0.002 0.008 ↑ 100.0 1 1

Hash (cost=11.00..11.00 rows=100 width=222) (actual time=0.008..0.008 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
12. 0.006 0.006 ↑ 100.0 1 1

Seq Scan on tb_setor_atendimento sa (cost=0.00..11.00 rows=100 width=222) (actual time=0.005..0.006 rows=1 loops=1)

13. 199.431 355.743 ↑ 1.0 340,084 1

Hash (cost=24,404.84..24,404.84 rows=340,084 width=42) (actual time=355.743..355.743 rows=340,084 loops=1)

  • Buckets: 65536 Batches: 8 Memory Usage: 3727kB
14. 156.312 156.312 ↑ 1.0 340,084 1

Seq Scan on tb_migra_controle c (cost=0.00..24,404.84 rows=340,084 width=42) (actual time=0.009..156.312 rows=340,084 loops=1)

Planning time : 1.930 ms
Execution time : 445.466 ms