explain.depesz.com

PostgreSQL's explain analyze made readable

Result: HRzk : Optimization for: original; plan #R81y

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.210 2,626.242 ↑ 1.0 600 1

Limit (cost=31,683.76..38,578.53 rows=600 width=164) (actual time=2,511.510..2,626.242 rows=600 loops=1)

2. 173.573 2,626.032 ↑ 35,562.1 600 1

Hash Left Join (cost=31,683.76..245,223,698.01 rows=21,337,246 width=164) (actual time=2,511.508..2,626.032 rows=600 loops=1)

  • Hash Cond: (b.numero_prontuario = (c.numero_prontuario)::numeric)
3. 22.758 94.244 ↑ 1,201.9 2,340 1

Hash Left Join (cost=37.88..241,869.37 rows=2,812,370 width=75) (actual time=80.626..94.244 rows=2,340 loops=1)

  • Hash Cond: ((b.tipo_atendimento)::text = (ta.descricao)::text)
4. 12.094 47.655 ↑ 1,144.6 2,340 1

Hash Left Join (cost=23.15..136,725.57 rows=2,678,448 width=71) (actual time=35.014..47.655 rows=2,340 loops=1)

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

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

  • Hash Cond: (b."ISN" = ba.isn)
6. 1.162 1.162 ↑ 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.020..1.162 rows=2,340 loops=1)

7. 0.001 0.008 ↓ 0.0 0 1

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

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

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

9. 21.798 31.591 ↑ 100.0 1 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
10. 9.793 9.793 ↑ 100.0 1 1

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

11. 15.043 23.831 ↑ 210.0 1 1

Hash (cost=12.10..12.10 rows=210 width=222) (actual time=23.831..23.831 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
12. 8.788 8.788 ↑ 210.0 1 1

Seq Scan on tb_tipo_atendimento ta (cost=0.00..12.10 rows=210 width=222) (actual time=8.780..8.788 rows=1 loops=1)

13. 608.906 2,358.215 ↑ 1.0 340,084 1

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

  • Buckets: 65536 Batches: 8 Memory Usage: 3727kB
14. 1,749.309 1,749.309 ↑ 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=7.566..1,749.309 rows=340,084 loops=1)

Planning time : 94.153 ms
Execution time : 2,697.224 ms