explain.depesz.com

PostgreSQL's explain analyze made readable

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

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 1,609.904 4,956.100 ↓ 1.8 165,586 1

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

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

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

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

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

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

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

5. 204.270 2,246.247 ↓ 1.2 54,636 1

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

  • Buckets: 8192 Batches: 1 Memory Usage: 8018kB
6. 199.935 2,041.977 ↓ 1.2 54,636 1

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

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

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

8. 201.353 332.545 ↑ 1.0 33,770 1

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

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

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

10. 3.028 8.734 ↑ 1.0 892 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 58kB
11. 2.354 5.706 ↑ 1.0 892 1

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

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

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

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

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

14. 0.007 0.073 ↑ 1.0 5 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
15. 0.039 0.066 ↑ 1.0 5 1

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

  • Hash Cond: (usuario_caja.idusuario = cajero.idusuario)
16. 0.010 0.010 ↑ 1.0 9 1

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

17. 0.008 0.017 ↑ 1.0 5 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
18. 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)

19. 0.011 0.022 ↑ 1.0 6 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
20. 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)

21. 1,080.640 1,080.640 ↓ 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.025..0.032 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.006 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
23. 0.007 0.007 ↑ 1.0 2 1

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

24. 0.066 0.123 ↑ 1.0 51 1

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

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

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