explain.depesz.com

PostgreSQL's explain analyze made readable

Result: aXoh

Settings
# exclusive inclusive rows x rows loops node
1. 0.009 254,460.083 ↑ 1.0 1 1

Limit (cost=77,776.29..77,776.29 rows=1 width=38) (actual time=254,460.074..254,460.083 rows=1 loops=1)

2. 0.334 254,460.074 ↑ 205.0 1 1

Sort (cost=77,776.29..77,776.80 rows=205 width=38) (actual time=254,460.074..254,460.074 rows=1 loops=1)

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

GroupAggregate (cost=77,771.68..77,775.26 rows=205 width=38) (actual time=251,342.606..254,459.740 rows=430 loops=1)

  • Group Key: vr.nome_arquivo
4. 6,575.266 254,159.965 ↓ 8,249.9 1,691,236 1

Sort (cost=77,771.68..77,772.19 rows=205 width=38) (actual time=251,334.741..254,159.965 rows=1,691,236 loops=1)

  • Sort Key: vr.nome_arquivo
  • Sort Method: external merge Disk: 109,088kB
5. 1,225.367 247,584.699 ↓ 8,249.9 1,691,236 1

Nested Loop (cost=1,079.45..77,763.81 rows=205 width=38) (actual time=125.822..247,584.699 rows=1,691,236 loops=1)

6. 970.463 192,848.228 ↓ 8,575.5 1,672,222 1

Nested Loop (cost=1,079.01..77,670.53 rows=195 width=42) (actual time=120.490..192,848.228 rows=1,672,222 loops=1)

7. 286.555 190,205.543 ↓ 8,575.5 1,672,222 1

Nested Loop (cost=1,078.86..77,636.89 rows=195 width=44) (actual time=100.071..190,205.543 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.007..0.009 rows=1 loops=1)

  • Filter: (id = 8)
  • Rows Removed by Filter: 8
9. 631.204 189,918.979 ↓ 8,575.5 1,672,222 1

Nested Loop (cost=1,078.86..77,633.83 rows=195 width=46) (actual time=100.062..189,918.979 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. 735.891 130,904.274 ↓ 51.2 1,769,197 1

Nested Loop (cost=1,078.30..48,940.62 rows=34,552 width=67) (actual time=99.986..130,904.274 rows=1,769,197 loops=1)

  • Join Filter: (la.rv_cod_atendimento = v.rv_cod_atendimento)
11. 646.144 89,476.852 ↓ 51.2 1,769,197 1

Nested Loop (cost=1,077.87..27,310.79 rows=34,552 width=63) (actual time=82.908..89,476.852 rows=1,769,197 loops=1)

12. 349.532 35,754.798 ↓ 51.2 1,769,197 1

Nested Loop (cost=1,077.43..7,288.60 rows=34,552 width=42) (actual time=69.382..35,754.798 rows=1,769,197 loops=1)

13. 22.685 410.490 ↓ 59.2 17,692 1

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

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

Seq Scan on remessa vr (cost=0.00..1,885.13 rows=538 width=42) (actual time=52.201..378.694 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. 4.092 9.111 ↓ 1.0 29,219 1

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

  • Buckets: 32,768 Batches: 1 Memory Usage: 1,398kB
16. 5.019 5.019 ↓ 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..5.019 rows=29,219 loops=1)

17. 34,994.776 34,994.776 ↑ 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.690..1.978 rows=100 loops=17,692)

  • Index Cond: (rv_num_lote = rl.numero_lote)
18. 53,075.910 53,075.910 ↑ 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.029..0.030 rows=1 loops=1,769,197)

  • Index Cond: (rv_cod_atendimento = la.rv_cod_atendimento)
19. 40,691.531 40,691.531 ↑ 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.022..0.023 rows=1 loops=1,769,197)

  • Index Cond: (rv_cod_atendimento = a.rv_cod_atendimento)
20. 58,383.501 58,383.501 ↓ 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.027..0.033 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. 53,511.104 53,511.104 ↑ 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.031..0.032 rows=1 loops=1,672,222)

  • Index Cond: (ve_num_atendimento_doc = (la.rv_cod_atendimento)::double precision)
  • Heap Fetches: 2,336
Planning time : 22.253 ms
Execution time : 254,492.149 ms