explain.depesz.com

PostgreSQL's explain analyze made readable

Result: loWb

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 1,429.910 3,701.795 ↓ 1.8 165,584 1

Sort (cost=24,860.36..25,091.11 rows=92,301 width=152) (actual time=3,433.721..3,701.795 rows=165,584 loops=1)

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

Hash Join (cost=3,767.82..12,288.27 rows=92,301 width=152) (actual time=209.968..2,271.885 rows=165,584 loops=1)

  • Hash Cond: (venta_caja.id_producto = producto.idproducto)
3. 441.922 1,862.059 ↓ 1.8 165,654 1

Hash Join (cost=3,765.67..11,016.88 rows=92,329 width=119) (actual time=209.813..1,862.059 rows=165,654 loops=1)

  • Hash Cond: (cobro.idapertura_cierre = apertura_cierre.idapertura_cierre)
4. 470.375 1,415.152 ↓ 1.8 165,654 1

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

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

Merge Join (cost=3,710.22..6,202.10 rows=46,236 width=84) (actual time=204.752..588.537 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. 105.413 105.413 ↓ 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.023..105.413 rows=33,768 loops=1)

7. 121.895 269.264 ↓ 1.7 58,288 1

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

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

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

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

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

10. 0.005 0.011 ↑ 1.0 2 1

Hash (cost=1.02..1.02 rows=2 width=12) (actual time=0.011..0.011 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. 232.861 356.240 ↓ 3.4 165,654 1

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

13. 123.379 123.379 ↑ 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.032..123.379 rows=48,600 loops=1)

14. 0.971 4.985 ↓ 1.0 892 1

Hash (cost=43.90..43.90 rows=891 width=35) (actual time=4.985..4.985 rows=892 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 58kB
15. 1.541 4.014 ↓ 1.0 892 1

Hash Join (cost=3.48..43.90 rows=891 width=35) (actual time=0.146..4.014 rows=892 loops=1)

  • Hash Cond: (apertura_cierre.idcaja = caja.idcaja)
16. 1.580 2.456 ↓ 1.0 892 1

Hash Join (cost=2.35..30.51 rows=891 width=26) (actual time=0.097..2.456 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.91 rows=891 width=12) (actual time=0.006..0.809 rows=892 loops=1)

18. 0.007 0.067 ↑ 1.0 5 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
19. 0.037 0.060 ↑ 1.0 5 1

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

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

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

21. 0.005 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.009 0.009 ↑ 1.0 5 1

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

23. 0.006 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.011 0.011 ↑ 1.0 6 1

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

25. 0.068 0.126 ↑ 1.0 51 1

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

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

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

Total runtime : 3,853.776 ms