explain.depesz.com

PostgreSQL's explain analyze made readable

Result: MT6a : Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: plan #loWb; plan #MAEG; plan #ZY8K; plan #MZ8N; plan #lJvx; plan #lBf6

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 1,348.610 4,227.242 ↓ 1.8 165,586 1

Sort (cost=23,323.69..23,554.69 rows=92,400 width=152) (actual time=3,977.843..4,227.242 rows=165,586 loops=1)

  • Sort Key: cobro.fecha
  • Sort Method: external merge Disk: 28576kB
2. 513.989 2,878.632 ↓ 1.8 165,586 1

Hash Join (cost=4,647.53..10,737.72 rows=92,400 width=152) (actual time=1,784.199..2,878.632 rows=165,586 loops=1)

  • Hash Cond: (venta_caja.id_producto = producto.idproducto)
3. 503.165 2,364.526 ↓ 1.8 165,656 1

Hash Join (cost=4,645.38..9,464.97 rows=92,428 width=119) (actual time=1,783.050..2,364.526 rows=165,656 loops=1)

  • Hash Cond: (venta_caja.id_cobro = cobro.id_cobro)
4. 78.391 78.391 ↑ 1.0 48,602 1

Seq Scan on venta_caja (cost=0.00..977.33 rows=48,633 width=20) (actual time=0.016..78.391 rows=48,602 loops=1)

5. 200.282 1,782.970 ↓ 1.2 54,636 1

Hash (cost=4,066.00..4,066.00 rows=46,350 width=111) (actual time=1,782.970..1,782.970 rows=54,636 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 8018kB
6. 216.089 1,582.688 ↓ 1.2 54,636 1

Hash Join (cost=56.13..4,066.00 rows=46,350 width=111) (actual time=5.441..1,582.688 rows=54,636 loops=1)

  • Hash Cond: (cobro_detalle.id_forma_cobro = forma_de_cobro.idforma_de_cobro)
7. 397.316 1,366.589 ↓ 1.2 54,636 1

Nested Loop (cost=55.08..3,427.65 rows=46,350 width=107) (actual time=5.413..1,366.589 rows=54,636 loops=1)

8. 158.854 293.873 ↑ 1.0 33,770 1

Hash Join (cost=55.08..1,362.12 rows=33,770 width=83) (actual time=5.335..293.873 rows=33,770 loops=1)

  • Hash Cond: (cobro.idapertura_cierre = apertura_cierre.idapertura_cierre)
9. 129.719 129.719 ↑ 1.0 33,770 1

Seq Scan on cobro (cost=0.00..842.70 rows=33,770 width=56) (actual time=0.010..129.719 rows=33,770 loops=1)

10. 1.056 5.300 ↑ 1.0 892 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 58kB
11. 1.608 4.244 ↑ 1.0 892 1

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

  • Hash Cond: (apertura_cierre.idcaja = caja.idcaja)
12. 1.676 2.620 ↑ 1.0 892 1

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

  • Hash Cond: (apertura_cierre.idcajero = cajero.idcajero)
13. 0.883 0.883 ↑ 1.0 892 1

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

14. 0.005 0.061 ↑ 1.0 5 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
15. 0.033 0.056 ↑ 1.0 5 1

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

  • Hash Cond: (usuario_caja.idusuario = cajero.idusuario)
16. 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.002..0.009 rows=9 loops=1)

17. 0.006 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
18. 0.008 0.008 ↑ 1.0 5 1

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

19. 0.006 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
20. 0.010 0.010 ↑ 1.0 6 1

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

21. 675.400 675.400 ↓ 2.0 2 33,770

Index Scan using cobro_detalle_id_cobro_idx on cobro_detalle (cost=0.00..0.05 rows=1 width=32) (actual time=0.014..0.020 rows=2 loops=33,770)

  • Index Cond: (id_cobro = cobro.id_cobro)
  • Filter: (cobro.idtipo_documento = idtipo_documento)
  • Rows Removed by Filter: 0
22. 0.005 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
23. 0.005 0.005 ↑ 1.0 2 1

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

24. 0.065 0.117 ↑ 1.0 51 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 4kB
25. 0.052 0.052 ↑ 1.0 51 1

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