explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 7L2l

Settings
# exclusive inclusive rows x rows loops node
1. 0.009 64,462.038 ↑ 1.0 1 1

Limit (cost=77,772.11..77,772.11 rows=1 width=38) (actual time=64,462.029..64,462.038 rows=1 loops=1)

2. 0.205 64,462.029 ↑ 205.0 1 1

Sort (cost=77,772.11..77,772.62 rows=205 width=38) (actual time=64,462.029..64,462.029 rows=1 loops=1)

  • Sort Key: (max(vr.created_at)) DESC
  • Sort Method: top-N heapsort Memory: 25kB
3. 287.538 64,461.824 ↓ 2.1 430 1

GroupAggregate (cost=77,767.50..77,771.08 rows=205 width=38) (actual time=61,487.874..64,461.824 rows=430 loops=1)

  • Group Key: vr.nome_arquivo
4. 6,270.893 64,174.286 ↓ 8,249.9 1,691,236 1

Sort (cost=77,767.50..77,768.01 rows=205 width=38) (actual time=61,479.883..64,174.286 rows=1,691,236 loops=1)

  • Sort Key: vr.nome_arquivo
  • Sort Method: external merge Disk: 109,088kB
5. 876.918 57,903.393 ↓ 8,249.9 1,691,236 1

Nested Loop (cost=1,079.45..77,759.62 rows=205 width=38) (actual time=32.379..57,903.393 rows=1,691,236 loops=1)

6. 617.168 52,009.809 ↓ 8,575.5 1,672,222 1

Nested Loop (cost=1,079.01..77,666.35 rows=195 width=42) (actual time=27.656..52,009.809 rows=1,672,222 loops=1)

7. 257.119 49,720.419 ↓ 8,575.5 1,672,222 1

Nested Loop (cost=1,078.86..77,632.71 rows=195 width=44) (actual time=23.336..49,720.419 rows=1,672,222 loops=1)

8. 0.009 0.009 ↑ 1.0 1 1

Seq Scan on ve_licenciamento_status ls (cost=0.00..1.11 rows=1 width=2) (actual time=0.008..0.009 rows=1 loops=1)

  • Filter: (id = 8)
  • Rows Removed by Filter: 8
9. 896.314 49,463.291 ↓ 8,575.5 1,672,222 1

Nested Loop (cost=1,078.86..77,629.65 rows=195 width=46) (actual time=23.325..49,463.291 rows=1,672,222 loops=1)

  • Join Filter: (v.rv_ano_licenciamento = (l.ve_ano_exercicio)::double precision)
  • Rows Removed by Join Filter: 1,276,308
10. 1,319.210 16,721.431 ↓ 51.2 1,769,197 1

Nested Loop (cost=1,078.30..48,938.19 rows=34,550 width=67) (actual time=23.279..16,721.431 rows=1,769,197 loops=1)

  • Join Filter: (la.rv_cod_atendimento = v.rv_cod_atendimento)
11. 191.728 10,094.630 ↓ 51.2 1,769,197 1

Nested Loop (cost=1,077.87..27,309.81 rows=34,550 width=63) (actual time=17.621..10,094.630 rows=1,769,197 loops=1)

12. 293.826 2,826.114 ↓ 51.2 1,769,197 1

Nested Loop (cost=1,077.43..7,288.63 rows=34,550 width=42) (actual time=14.488..2,826.114 rows=1,769,197 loops=1)

13. 10.442 73.100 ↓ 59.2 17,692 1

Hash Join (cost=1,077.00..3,055.94 rows=299 width=42) (actual time=8.098..73.100 rows=17,692 loops=1)

  • Hash Cond: (vr.id = rl.remessa_id)
14. 54.893 54.893 ↑ 1.3 430 1

Seq Scan on remessa vr (cost=0.00..1,885.16 rows=538 width=42) (actual time=0.286..54.893 rows=430 loops=1)

  • Filter: ((canceled_at IS NULL) AND ((nome_arquivo)::text ~~* '%CRLV%'::text) AND (empresa_id = 8))
  • Rows Removed by Filter: 52,181
15. 3.325 7.765 ↓ 1.0 29,219 1

Hash (cost=712.00..712.00 rows=29,200 width=8) (actual time=7.765..7.765 rows=29,219 loops=1)

  • Buckets: 32,768 Batches: 1 Memory Usage: 1,398kB
16. 4.440 4.440 ↓ 1.0 29,219 1

Seq Scan on remessa_lotes rl (cost=0.00..712.00 rows=29,200 width=8) (actual time=0.004..4.440 rows=29,219 loops=1)

17. 2,459.188 2,459.188 ↑ 1.2 100 17,692

Index Scan using idx_rv_lote_atendimento_rv_num_lote2 on rv_lote_atendimento la (cost=0.43..13.00 rows=116 width=8) (actual time=0.099..0.139 rows=100 loops=17,692)

  • Index Cond: (rv_num_lote = rl.numero_lote)
18. 7,076.788 7,076.788 ↑ 1.0 1 1,769,197

Index Scan using rv_atendimento_pkey on rv_atendimento a (cost=0.43..0.57 rows=1 width=21) (actual time=0.003..0.004 rows=1 loops=1,769,197)

  • Index Cond: (rv_cod_atendimento = la.rv_cod_atendimento)
19. 5,307.591 5,307.591 ↑ 1.0 1 1,769,197

Index Scan using rv_veiculo_atendimento_pkey on rv_veiculo_atendimento v (cost=0.43..0.61 rows=1 width=12) (actual time=0.003..0.003 rows=1 loops=1,769,197)

  • Index Cond: (rv_cod_atendimento = a.rv_cod_atendimento)
20. 31,845.546 31,845.546 ↓ 2.0 2 1,769,197

Index Scan using ve_licenciamento_pk on ve_licenciamento l (cost=0.56..0.82 rows=1 width=25) (actual time=0.017..0.018 rows=2 loops=1,769,197)

  • Index Cond: ((ve_chassi)::text = (a.rv_num_chassi)::text)
  • Filter: (ve_status = 8)
  • Rows Removed by Filter: 5
21. 1,672.222 1,672.222 ↑ 1.0 1 1,672,222

Index Only Scan using ve_impedimento_dual_pk on ve_impedimento_dual lid (cost=0.14..0.16 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1,672,222)

  • Index Cond: (id = l.ve_impedimento)
  • Heap Fetches: 0
22. 5,016.666 5,016.666 ↑ 1.0 1 1,672,222

Index Only Scan using idx_vdoc_num_atendimento_doc4 on ve_documento d (cost=0.44..0.47 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=1,672,222)

  • Index Cond: (ve_num_atendimento_doc = (la.rv_cod_atendimento)::double precision)
  • Heap Fetches: 2,450
Planning time : 11.672 ms
Execution time : 64,501.369 ms