explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 9ZsM

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 6.310 17,084.934 ↓ 2.9 2,056 1

Nested Loop (cost=167.91..938,165.11 rows=709 width=120) (actual time=843.366..17,084.934 rows=2,056 loops=1)

  • Functions: 54
  • Options: Inlining true, Optimization true, Expressions true, Deforming true
  • Timing: Generation 5.048 ms, Inlining 41.321 ms, Optimization 487.361 ms, Emission 294.711 ms, Total 828.441 ms
2. 5.007 1,821.048 ↓ 2.9 2,056 1

Hash Join (cost=147.67..751.02 rows=709 width=108) (actual time=835.491..1,821.048 rows=2,056 loops=1)

  • Hash Cond: ((pagamento.convenio_id)::text = (convenio.id)::text)
3. 5.547 991.451 ↑ 18.3 3,258 1

Merge Join (cost=144.98..584.19 rows=59,524 width=123) (actual time=10.375..991.451 rows=3,258 loops=1)

  • Merge Cond: ((guia.lote_recurso_id)::text = (lote_recurso.id)::text)
4. 8.133 984.823 ↑ 1.0 3,258 1

Nested Loop (cost=142.35..7,298.91 rows=3,276 width=136) (actual time=10.344..984.823 rows=3,258 loops=1)

5. 5.542 328.348 ↑ 1.0 3,258 1

Nested Loop (cost=141.93..4,703.65 rows=3,276 width=125) (actual time=10.312..328.348 rows=3,258 loops=1)

6. 7.740 289.656 ↓ 1.0 3,315 1

Nested Loop (cost=141.65..3,720.83 rows=3,276 width=141) (actual time=5.761..289.656 rows=3,315 loops=1)

7. 9.706 205.671 ↓ 1.0 3,315 1

Nested Loop (cost=141.37..2,668.60 rows=3,276 width=157) (actual time=5.743..205.671 rows=3,315 loops=1)

8. 12.787 99.830 ↓ 1.0 3,315 1

Merge Join (cost=141.09..1,372.03 rows=3,276 width=142) (actual time=5.722..99.830 rows=3,315 loops=1)

  • Merge Cond: ((guia.lote_recurso_id)::text = (registro_envio_recurso_lote.lote_recurso_id)::text)
9. 79.258 79.258 ↑ 19.6 3,331 1

Index Scan using guia_lote_recurso_fk on guia (cost=0.29..23,385.55 rows=65,260 width=105) (actual time=0.017..79.258 rows=3,331 loops=1)

10. 7.398 7.785 ↓ 2.5 4,249 1

Sort (cost=140.56..144.89 rows=1,733 width=37) (actual time=5.669..7.785 rows=4,249 loops=1)

  • Sort Key: registro_envio_recurso_lote.lote_recurso_id
  • Sort Method: quicksort Memory: 184kB
11. 0.387 0.387 ↑ 1.0 1,733 1

Seq Scan on registro_envio_recurso_lote (cost=0.00..47.33 rows=1,733 width=37) (actual time=0.009..0.387 rows=1,733 loops=1)

12. 96.135 96.135 ↑ 1.0 1 3,315

Index Scan using pagamento_pkey on pagamento (cost=0.28..0.40 rows=1 width=31) (actual time=0.029..0.029 rows=1 loops=3,315)

  • Index Cond: (id = guia.pagamento_id)
13. 76.245 76.245 ↑ 1.0 1 3,315

Index Only Scan using remessa_pkey on remessa (cost=0.29..0.32 rows=1 width=16) (actual time=0.023..0.023 rows=1 loops=3,315)

  • Index Cond: (id = (guia.remessa_id)::text)
  • Heap Fetches: 3,315
14. 33.150 33.150 ↑ 1.0 1 3,315

Index Only Scan using recebimento_pkey on recebimento (cost=0.28..0.30 rows=1 width=16) (actual time=0.010..0.010 rows=1 loops=3,315)

  • Index Cond: (id = (guia.recebimento_id)::text)
  • Heap Fetches: 0
15. 648.342 648.342 ↑ 1.0 1 3,258

Index Scan using beneficiario_pkey on beneficiario (cost=0.42..0.79 rows=1 width=43) (actual time=0.199..0.199 rows=1 loops=3,258)

  • Index Cond: ((id)::text = (guia.beneficiario_id)::text)
16. 1.081 1.081 ↑ 1.0 1,900 1

Index Only Scan using lote_recurso_pkey on lote_recurso (cost=0.28..76.78 rows=1,900 width=13) (actual time=0.011..1.081 rows=1,900 loops=1)

  • Heap Fetches: 0
17. 0.005 824.590 ↑ 1.0 1 1

Hash (cost=2.68..2.68 rows=1 width=15) (actual time=824.590..824.590 rows=1 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
18. 824.585 824.585 ↑ 1.0 1 1

Seq Scan on convenio (cost=0.00..2.68 rows=1 width=15) (actual time=824.579..824.585 rows=1 loops=1)

  • Filter: (((nome)::text = 'Bradesco'::text) AND (cliente_id = ANY ('{116688,90937,109408,91579,115837,119591}'::bigint[])))
  • Rows Removed by Filter: 83
19. 14.392 15,257.576 ↑ 1.0 1 2,056

GroupAggregate (cost=20.23..1,322.14 rows=1 width=24) (actual time=7.421..7.421 rows=1 loops=2,056)

  • Group Key: item.guia_id
20. 7,973.168 15,243.184 ↓ 2.0 2 2,056

Hash Join (cost=20.23..1,322.13 rows=1 width=16) (actual time=3.331..7.414 rows=2 loops=2,056)

  • Hash Cond: ((recurso.item_id)::text = (item.id)::text)
21. 6,517.520 6,517.520 ↑ 1.0 44,031 2,056

Seq Scan on recurso (cost=0.00..1,186.31 rows=44,031 width=16) (actual time=0.003..3.170 rows=44,031 loops=2,056)

22. 10.280 752.496 ↑ 1.3 3 2,056

Hash (cost=20.18..20.18 rows=4 width=32) (actual time=0.366..0.366 rows=3 loops=2,056)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
23. 666.144 742.216 ↑ 1.3 3 2,056

Bitmap Heap Scan on item (cost=4.45..20.18 rows=4 width=32) (actual time=0.164..0.361 rows=3 loops=2,056)

  • Recheck Cond: ((guia_id)::text = (guia.id)::text)
  • Heap Blocks: exact=5,705
24. 76.072 76.072 ↑ 1.3 3 2,056

Bitmap Index Scan on item_guia_fk (cost=0.00..4.45 rows=4 width=0) (actual time=0.037..0.037 rows=3 loops=2,056)

  • Index Cond: ((guia_id)::text = (guia.id)::text)
Execution time : 17,102.962 ms