explain.depesz.com

PostgreSQL's explain analyze made readable

Result: yLnm : fn_migra_040_atendimento_agenda_V3

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.237 509.822 ↑ 1.0 600 1

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

2. 93.539 509.585 ↑ 33,868.6 600 1

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

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

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

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

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

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

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

  • Hash Cond: (b."ISN" = ba.isn)
6. 0.632 0.632 ↑ 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.009..0.632 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.002 0.008 ↑ 1.0 1 1

Hash (cost=1.01..1.01 rows=1 width=222) (actual time=0.008..0.008 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.005..0.006 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. 226.191 400.889 ↑ 1.0 340,084 1

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

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

Planning time : 1.577 ms
Execution time : 517.045 ms