explain.depesz.com

PostgreSQL's explain analyze made readable

Result: MAEG : Optimization for: plan #loWb

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 2,749.926 6,358.676 ↓ 1.8 165,584 1

Sort (cost=24,860.41..25,091.16 rows=92,301 width=152) (actual time=6,130.584..6,358.676 rows=165,584 loops=1)

  • Sort Key: cobro.fecha
  • Sort Method: external merge Disk: 28544kB
2. 684.496 3,608.750 ↓ 1.8 165,584 1

Hash Join (cost=3,767.87..12,288.32 rows=92,301 width=152) (actual time=236.176..3,608.750 rows=165,584 loops=1)

  • Hash Cond: (venta_caja.id_producto = producto.idproducto)
3. 664.513 2,924.149 ↓ 1.8 165,654 1

Hash Join (cost=3,765.72..11,016.93 rows=92,329 width=119) (actual time=236.057..2,924.149 rows=165,654 loops=1)

  • Hash Cond: (cobro.idapertura_cierre = apertura_cierre.idapertura_cierre)
4. 759.221 2,254.589 ↓ 1.8 165,654 1

Merge Join (cost=3,710.64..9,692.32 rows=92,329 width=92) (actual time=230.995..2,254.589 rows=165,654 loops=1)

  • Merge Cond: (cobro.id_cobro = venta_caja.id_cobro)
5. 343.400 943.088 ↓ 1.2 54,634 1

Merge Join (cost=3,710.22..6,202.10 rows=46,236 width=84) (actual time=230.961..943.088 rows=54,634 loops=1)

  • Merge Cond: (cobro.id_cobro = cobro_detalle.id_cobro)
  • Join Filter: (cobro_detalle.idtipo_documento = cobro.idtipo_documento)
  • Rows Removed by Join Filter: 3654
6. 252.985 252.985 ↓ 1.0 33,768 1

Index Scan using cobro_pkey on cobro (cost=0.29..1,577.14 rows=33,719 width=56) (actual time=0.018..252.985 rows=33,768 loops=1)

7. 174.296 346.703 ↓ 1.7 58,288 1

Sort (cost=3,709.91..3,794.64 rows=33,890 width=36) (actual time=230.928..346.703 rows=58,288 loops=1)

  • Sort Key: cobro_detalle.id_cobro
  • Sort Method: quicksort Memory: 4188kB
8. 108.052 172.407 ↓ 1.0 33,939 1

Hash Join (cost=1.04..1,159.93 rows=33,890 width=36) (actual time=0.047..172.407 rows=33,939 loops=1)

  • Hash Cond: (cobro_detalle.id_forma_cobro = forma_de_cobro.idforma_de_cobro)
9. 64.345 64.345 ↓ 1.0 33,939 1

Seq Scan on cobro_detalle (cost=0.00..692.90 rows=33,890 width=32) (actual time=0.022..64.345 rows=33,939 loops=1)

10. 0.004 0.010 ↑ 1.0 2 1

Hash (cost=1.02..1.02 rows=2 width=12) (actual time=0.010..0.010 rows=2 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
11. 0.006 0.006 ↑ 1.0 2 1

Seq Scan on forma_de_cobro (cost=0.00..1.02 rows=2 width=12) (actual time=0.004..0.006 rows=2 loops=1)

12. 288.199 552.280 ↓ 3.4 165,654 1

Materialize (cost=0.41..2,114.02 rows=48,633 width=20) (actual time=0.026..552.280 rows=165,654 loops=1)

13. 264.081 264.081 ↑ 1.0 48,600 1

Index Scan using venta_caja_pkey on venta_caja (cost=0.41..1,992.44 rows=48,633 width=20) (actual time=0.020..264.081 rows=48,600 loops=1)

14. 0.997 5.047 ↑ 1.0 892 1

Hash (cost=43.93..43.93 rows=892 width=35) (actual time=5.047..5.047 rows=892 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 58kB
15. 1.577 4.050 ↑ 1.0 892 1

Hash Join (cost=3.48..43.93 rows=892 width=35) (actual time=0.090..4.050 rows=892 loops=1)

  • Hash Cond: (apertura_cierre.idcaja = caja.idcaja)
16. 1.594 2.457 ↑ 1.0 892 1

Hash Join (cost=2.35..30.53 rows=892 width=26) (actual time=0.066..2.457 rows=892 loops=1)

  • Hash Cond: (apertura_cierre.idcajero = cajero.idcajero)
17. 0.809 0.809 ↑ 1.0 892 1

Seq Scan on apertura_cierre (cost=0.00..15.92 rows=892 width=12) (actual time=0.005..0.809 rows=892 loops=1)

18. 0.008 0.054 ↑ 1.0 5 1

Hash (cost=2.29..2.29 rows=5 width=18) (actual time=0.054..0.054 rows=5 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
19. 0.024 0.046 ↑ 1.0 5 1

Hash Join (cost=1.11..2.29 rows=5 width=18) (actual time=0.028..0.046 rows=5 loops=1)

  • Hash Cond: (usuario_caja.idusuario = cajero.idusuario)
20. 0.008 0.008 ↑ 1.0 9 1

Seq Scan on usuario_caja (cost=0.00..1.09 rows=9 width=18) (actual time=0.002..0.008 rows=9 loops=1)

21. 0.007 0.014 ↑ 1.0 5 1

Hash (cost=1.05..1.05 rows=5 width=8) (actual time=0.014..0.014 rows=5 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
22. 0.007 0.007 ↑ 1.0 5 1

Seq Scan on cajero (cost=0.00..1.05 rows=5 width=8) (actual time=0.003..0.007 rows=5 loops=1)

23. 0.007 0.016 ↑ 1.0 6 1

Hash (cost=1.06..1.06 rows=6 width=17) (actual time=0.016..0.016 rows=6 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
24. 0.009 0.009 ↑ 1.0 6 1

Seq Scan on caja (cost=0.00..1.06 rows=6 width=17) (actual time=0.004..0.009 rows=6 loops=1)

25. 0.057 0.105 ↑ 1.0 51 1

Hash (cost=1.51..1.51 rows=51 width=41) (actual time=0.105..0.105 rows=51 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 4kB
26. 0.048 0.048 ↑ 1.0 51 1

Seq Scan on producto (cost=0.00..1.51 rows=51 width=41) (actual time=0.004..0.048 rows=51 loops=1)