explain.depesz.com

PostgreSQL's explain analyze made readable

Result: O98 : fn_migra_040_atendimento_agenda_V0

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.164 319.206 ↑ 1.0 600 1

Limit (cost=31,670.06..38,561.67 rows=600 width=164) (actual time=248.624..319.206 rows=600 loops=1)

2. 59.915 319.042 ↑ 33,868.6 600 1

Hash Left Join (cost=31,670.06..233,441,122.02 rows=20,321,189 width=164) (actual time=248.622..319.042 rows=600 loops=1)

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

Hash Left Join (cost=24.17..123,412.02 rows=2,678,448 width=75) (actual time=0.047..11.003 rows=2,340 loops=1)

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

Hash Left Join (cost=11.92..93,267.23 rows=2,678,448 width=71) (actual time=0.033..2.041 rows=2,340 loops=1)

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

Hash Left Join (cost=10.90..82,809.96 rows=2,678,448 width=67) (actual time=0.021..1.465 rows=2,340 loops=1)

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

7. 0.001 0.002 ↓ 0.0 0 1

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

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

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

9. 0.002 0.007 ↑ 1.0 1 1

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

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

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

11. 0.001 0.005 ↑ 100.0 1 1

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

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

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

13. 148.424 248.124 ↑ 1.0 340,084 1

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

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

Planning time : 0.598 ms
Execution time : 323.929 ms