explain.depesz.com

PostgreSQL's explain analyze made readable

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

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 1,428.989 4,747.469 ↓ 1.8 165,586 1

Sort (cost=23,254.68..23,484.71 rows=92,012 width=152) (actual time=4,505.432..4,747.469 rows=165,586 loops=1)

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

Hash Join (cost=4,645.03..10,726.01 rows=92,012 width=152) (actual time=2,036.321..3,318.480 rows=165,586 loops=1)

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

Hash Join (cost=4,642.88..9,458.59 rows=92,040 width=119) (actual time=2,036.195..2,791.569 rows=165,656 loops=1)

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

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

5. 204.007 2,036.104 ↓ 1.2 54,636 1

Hash (cost=4,064.67..4,064.67 rows=46,257 width=111) (actual time=2,036.104..2,036.104 rows=54,636 loops=1)

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

Hash Join (cost=56.13..4,064.67 rows=46,257 width=111) (actual time=13.952..1,832.097 rows=54,636 loops=1)

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

Nested Loop (cost=55.08..3,427.59 rows=46,257 width=107) (actual time=13.926..1,638.131 rows=54,636 loops=1)

8. 166.036 285.102 ↓ 1.0 33,770 1

Hash Join (cost=55.08..1,362.10 rows=33,769 width=83) (actual time=10.063..285.102 rows=33,770 loops=1)

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

Seq Scan on cobro (cost=0.00..842.69 rows=33,769 width=56) (actual time=0.027..109.049 rows=33,770 loops=1)

10. 1.059 10.017 ↑ 1.0 892 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 58kB
11. 1.719 8.958 ↑ 1.0 892 1

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

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

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

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

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

14. 0.007 0.065 ↑ 1.0 5 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
15. 0.027 0.058 ↑ 1.0 5 1

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

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

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

17. 0.006 0.016 ↑ 1.0 5 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
18. 0.010 0.010 ↑ 1.0 5 1

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

19. 0.011 0.021 ↑ 1.0 6 1

Hash (cost=1.06..1.06 rows=6 width=17) (actual time=0.021..0.021 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. 878.020 878.020 ↓ 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.019..0.026 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.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
23. 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)

24. 0.057 0.111 ↑ 1.0 51 1

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

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

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