explain.depesz.com

PostgreSQL's explain analyze made readable

Result: R81y : original

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.181 1,067.210 ↑ 1.0 600 1

Limit (cost=11,864.32..18,764.59 rows=600 width=164) (actual time=856.670..1,067.210 rows=600 loops=1)

2. 302.994 1,067.029 ↑ 20,336.2 600 1

Hash Left Join (cost=11,864.32..140,337,457.18 rows=12,201,736 width=164) (actual time=856.668..1,067.029 rows=600 loops=1)

  • Hash Cond: (b.numero_prontuario = (c.numero_prontuario)::numeric)
3. 0.929 55.230 ↑ 1,125.5 2,499 1

Hash Left Join (cost=37.88..218,110.51 rows=2,812,566 width=75) (actual time=35.473..55.230 rows=2,499 loops=1)

  • Hash Cond: ((b.tipo_atendimento)::text = (ta.descricao)::text)
4. 9.889 48.689 ↑ 1,071.9 2,499 1

Hash Left Join (cost=23.15..112,959.40 rows=2,678,634 width=71) (actual time=29.837..48.689 rows=2,499 loops=1)

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

Hash Left Join (cost=10.90..82,812.52 rows=2,678,634 width=67) (actual time=25.935..34.920 rows=2,499 loops=1)

  • Hash Cond: (b."ISN" = ba.isn)
6. 33.663 33.663 ↑ 1,071.9 2,499 1

Seq Scan on tb_boletim_atendimento b (cost=0.00..72,756.34 rows=2,678,634 width=63) (actual time=25.858..33.663 rows=2,499 loops=1)

7. 0.000 0.006 ↓ 0.0 0 1

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

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

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

9. 0.009 3.880 ↑ 100.0 1 1

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

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

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

11. 0.010 5.612 ↑ 210.0 1 1

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

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

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

13. 94.670 708.805 ↑ 1.1 170,042 1

Hash (cost=7,685.64..7,685.64 rows=194,464 width=42) (actual time=708.805..708.805 rows=170,042 loops=1)

  • Buckets: 65536 Batches: 4 Memory Usage: 3651kB
14. 614.135 614.135 ↑ 1.1 170,042 1

Seq Scan on tb_migra_controle c (cost=0.00..7,685.64 rows=194,464 width=42) (actual time=11.143..614.135 rows=170,042 loops=1)

Planning time : 423.426 ms
Execution time : 1,135.643 ms