explain.depesz.com

PostgreSQL's explain analyze made readable

Result: X9r1 : fn_migra_040_atendimento_agenda_V1

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 0.190 385.255 ↑ 1.0 600 1

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

2. 68.771 385.065 ↑ 33,868.6 600 1

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

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

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

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

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

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

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

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

7. 0.000 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.002 0.002 ↓ 0.0 0 1

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

9. 0.003 0.009 ↑ 1.0 1 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
10. 0.006 0.006 ↑ 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.006 rows=1 loops=1)

11. 0.002 0.006 ↑ 100.0 1 1

Hash (cost=11.00..11.00 rows=100 width=222) (actual time=0.006..0.006 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. 161.278 301.547 ↑ 1.0 340,084 1

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

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

Planning time : 1.165 ms
Execution time : 390.873 ms