explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ZY8K : Optimization for: Optimization for: plan #loWb; plan #MAEG

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 5,337.443 10,324.364 ↓ 1.8 165,586 1

Sort (cost=24,785.09..25,014.87 rows=91,912 width=152) (actual time=10,070.704..10,324.364 rows=165,586 loops=1)

  • Sort Key: cobro.fecha
  • Sort Method: external merge Disk: 28552kB
2. 640.062 4,986.921 ↓ 1.8 165,586 1

Hash Join (cost=3,767.87..12,270.39 rows=91,912 width=152) (actual time=284.037..4,986.921 rows=165,586 loops=1)

  • Hash Cond: (venta_caja.id_producto = producto.idproducto)
3. 618.766 4,346.755 ↓ 1.8 165,656 1

Hash Join (cost=3,765.72..11,004.34 rows=91,940 width=119) (actual time=283.916..4,346.755 rows=165,656 loops=1)

  • Hash Cond: (cobro.idapertura_cierre = apertura_cierre.idapertura_cierre)
4. 726.606 3,715.237 ↓ 1.8 165,656 1

Merge Join (cost=3,710.64..9,685.08 rows=91,940 width=92) (actual time=271.149..3,715.237 rows=165,656 loops=1)

  • Merge Cond: (cobro.id_cobro = venta_caja.id_cobro)
5. 325.956 1,749.938 ↓ 1.2 54,636 1

Merge Join (cost=3,710.22..6,201.75 rows=46,207 width=84) (actual time=271.109..1,749.938 rows=54,636 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. 1,054.154 1,054.154 ↓ 1.0 33,770 1

Index Scan using cobro_pkey on cobro (cost=0.29..1,577.46 rows=33,769 width=56) (actual time=0.024..1,054.154 rows=33,770 loops=1)

7. 197.731 369.828 ↓ 1.7 58,290 1

Sort (cost=3,709.91..3,794.64 rows=33,890 width=36) (actual time=271.066..369.828 rows=58,290 loops=1)

  • Sort Key: cobro_detalle.id_cobro
  • Sort Method: quicksort Memory: 4188kB
8. 93.728 172.097 ↓ 1.0 33,941 1

Hash Join (cost=1.04..1,159.93 rows=33,890 width=36) (actual time=0.073..172.097 rows=33,941 loops=1)

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

Seq Scan on cobro_detalle (cost=0.00..692.90 rows=33,890 width=32) (actual time=0.038..78.356 rows=33,941 loops=1)

10. 0.005 0.013 ↑ 1.0 2 1

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

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

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

12. 356.549 1,238.693 ↓ 3.4 165,656 1

Materialize (cost=0.41..2,114.02 rows=48,633 width=20) (actual time=0.031..1,238.693 rows=165,656 loops=1)

13. 882.144 882.144 ↑ 1.0 48,602 1

Index Scan using venta_caja_pkey on venta_caja (cost=0.41..1,992.44 rows=48,633 width=20) (actual time=0.024..882.144 rows=48,602 loops=1)

14. 2.538 12.752 ↑ 1.0 892 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 58kB
15. 2.855 10.214 ↑ 1.0 892 1

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

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

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

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

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

18. 0.007 0.055 ↑ 1.0 5 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
19. 0.021 0.048 ↑ 1.0 5 1

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

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

Seq Scan on usuario_caja (cost=0.00..1.09 rows=9 width=18) (actual time=0.004..0.013 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.008 0.017 ↑ 1.0 6 1

Hash (cost=1.06..1.06 rows=6 width=17) (actual time=0.017..0.017 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.003..0.009 rows=6 loops=1)

25. 0.054 0.104 ↑ 1.0 51 1

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

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

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