explain.depesz.com

PostgreSQL's explain analyze made readable

Result: jGQq

Settings
# exclusive inclusive rows x rows loops node
1. 0.009 239,618.510 ↑ 1.0 1 1

Limit (cost=77,780.26..77,780.26 rows=1 width=38) (actual time=239,618.502..239,618.510 rows=1 loops=1)

2. 0.191 239,618.501 ↑ 210.0 1 1

Sort (cost=77,780.26..77,780.78 rows=210 width=38) (actual time=239,618.501..239,618.501 rows=1 loops=1)

  • Sort Key: (max(vr.created_at)) DESC
  • Sort Method: top-N heapsort Memory: 25kB
3. 295.316 239,618.310 ↓ 2.0 430 1

GroupAggregate (cost=77,775.53..77,779.21 rows=210 width=38) (actual time=236,540.128..239,618.310 rows=430 loops=1)

  • Group Key: vr.nome_arquivo
4. 6,558.740 239,322.994 ↓ 8,053.5 1,691,236 1

Sort (cost=77,775.53..77,776.06 rows=210 width=38) (actual time=236,532.304..239,322.994 rows=1,691,236 loops=1)

  • Sort Key: vr.nome_arquivo
  • Sort Method: external merge Disk: 109088kB
5. 1,227.576 232,764.254 ↓ 8,053.5 1,691,236 1

Nested Loop (cost=1,079.45..77,767.43 rows=210 width=38) (actual time=8.220..232,764.254 rows=1,691,236 loops=1)

6. 919.997 191,403.350 ↓ 8,361.1 1,672,222 1

Nested Loop (cost=1,079.01..77,671.77 rows=200 width=42) (actual time=8.206..191,403.350 rows=1,672,222 loops=1)

7. 273.299 188,811.131 ↓ 8,361.1 1,672,222 1

Nested Loop (cost=1,078.86..77,637.27 rows=200 width=44) (actual time=8.197..188,811.131 rows=1,672,222 loops=1)

8. 0.012 0.012 ↑ 1.0 1 1

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

  • Filter: (id = 8)
  • Rows Removed by Filter: 8
9. 999.421 188,537.820 ↓ 8,361.1 1,672,222 1

Nested Loop (cost=1,078.86..77,634.16 rows=200 width=46) (actual time=8.185..188,537.820 rows=1,672,222 loops=1)

  • Join Filter: (v.rv_ano_licenciamento = (l.ve_ano_exercicio)::double precision)
  • Rows Removed by Join Filter: 1276308
10. 601.116 138,000.883 ↓ 51.2 1,769,197 1

Nested Loop (cost=1,078.30..48,940.75 rows=34,552 width=67) (actual time=8.153..138,000.883 rows=1,769,197 loops=1)

  • Join Filter: (la.rv_cod_atendimento = v.rv_cod_atendimento)
11. 559.613 107,323.418 ↓ 51.2 1,769,197 1

Nested Loop (cost=1,077.87..27,310.53 rows=34,552 width=63) (actual time=8.141..107,323.418 rows=1,769,197 loops=1)

12. 348.818 67,841.471 ↓ 51.2 1,769,197 1

Nested Loop (cost=1,077.43..7,288.57 rows=34,552 width=42) (actual time=8.130..67,841.471 rows=1,769,197 loops=1)

13. 23.766 333.821 ↓ 59.2 17,692 1

Hash Join (cost=1,077.00..3,055.91 rows=299 width=42) (actual time=8.113..333.821 rows=17,692 loops=1)

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

Seq Scan on remessa vr (cost=0.00..1,885.13 rows=538 width=42) (actual time=0.298..302.280 rows=430 loops=1)

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

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

  • Buckets: 32768 Batches: 1 Memory Usage: 1398kB
16. 4.392 4.392 ↓ 1.0 29,219 1

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

17. 67,158.832 67,158.832 ↑ 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=1.555..3.796 rows=100 loops=17,692)

  • Index Cond: (rv_num_lote = rl.numero_lote)
18. 38,922.334 38,922.334 ↑ 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.021..0.022 rows=1 loops=1,769,197)

  • Index Cond: (rv_cod_atendimento = la.rv_cod_atendimento)
19. 30,076.349 30,076.349 ↑ 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.016..0.017 rows=1 loops=1,769,197)

  • Index Cond: (rv_cod_atendimento = a.rv_cod_atendimento)
20. 49,537.516 49,537.516 ↓ 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.023..0.028 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. 40,133.328 40,133.328 ↑ 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.023..0.024 rows=1 loops=1,672,222)

  • Index Cond: (ve_num_atendimento_doc = (la.rv_cod_atendimento)::double precision)
  • Heap Fetches: 1410
Planning time : 10.490 ms
Execution time : 239,645.657 ms