explain.depesz.com

PostgreSQL's explain analyze made readable

Result: NKvW : Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: plan #ZjMA; plan #Uzuz; plan #7V9w; plan #24qB; plan #WNWn

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 79.579 7,070.084 ↓ 111.2 9,567 1

GroupAggregate (cost=4,027.49..4,030.50 rows=86 width=65) (actual time=6,948.462..7,070.084 rows=9,567 loops=1)

2. 2,556.772 6,990.505 ↓ 557.7 47,960 1

Sort (cost=4,027.49..4,027.71 rows=86 width=65) (actual time=6,948.441..6,990.505 rows=47,960 loops=1)

  • Sort Key: venta_caja.id_producto, producto.descripcion, (date(apertura_cierre.fecha_apertura)), regionales.descripcion
  • Sort Method: quicksort Memory: 8246kB
3. 465.539 4,433.733 ↓ 557.7 47,960 1

Nested Loop (cost=0.98..4,024.73 rows=86 width=65) (actual time=0.129..4,433.733 rows=47,960 loops=1)

4. 451.028 3,440.513 ↓ 557.8 47,971 1

Nested Loop (cost=0.98..4,021.92 rows=86 width=28) (actual time=0.076..3,440.513 rows=47,971 loops=1)

  • Join Filter: (caja.id_regional = regionales.id_regional)
  • Rows Removed by Join Filter: 95942
5. 663.159 2,749.630 ↓ 557.8 47,971 1

Nested Loop (cost=0.98..4,017.01 rows=86 width=24) (actual time=0.067..2,749.630 rows=47,971 loops=1)

  • Join Filter: (apertura_cierre.idcaja = caja.idcaja)
  • Rows Removed by Join Filter: 239855
6. 345.966 1,606.761 ↓ 557.8 47,971 1

Nested Loop (cost=0.98..4,008.20 rows=86 width=24) (actual time=0.052..1,606.761 rows=47,971 loops=1)

7. 237.840 685.143 ↓ 557.8 47,971 1

Merge Join (cost=0.70..3,981.90 rows=86 width=20) (actual time=0.043..685.143 rows=47,971 loops=1)

  • Merge Cond: ((cobro.id_cobro = venta_caja.id_cobro) AND (cobro.idapertura_cierre = venta_caja.idapertura_cierre))
8. 211.627 211.627 ↓ 1.0 33,327 1

Index Scan using cobro_pkey on cobro (cost=0.29..1,577.77 rows=33,321 width=12) (actual time=0.019..211.627 rows=33,327 loops=1)

  • Filter: (estado IS NULL)
  • Rows Removed by Filter: 444
9. 235.676 235.676 ↑ 1.0 48,603 1

Index Scan using venta_caja_pkey on venta_caja (cost=0.41..1,993.66 rows=48,603 width=20) (actual time=0.016..235.676 rows=48,603 loops=1)

10. 575.652 575.652 ↑ 1.0 1 47,971

Index Scan using apertura_cierre_pkey on apertura_cierre (cost=0.28..0.30 rows=1 width=16) (actual time=0.010..0.012 rows=1 loops=47,971)

  • Index Cond: (idapertura_cierre = cobro.idapertura_cierre)
11. 479.701 479.710 ↑ 1.0 6 47,971

Materialize (cost=0.00..1.09 rows=6 width=8) (actual time=0.002..0.010 rows=6 loops=47,971)

12. 0.009 0.009 ↑ 1.0 6 1

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

13. 239.849 239.855 ↑ 1.0 3 47,971

Materialize (cost=0.00..1.04 rows=3 width=12) (actual time=0.001..0.005 rows=3 loops=47,971)

14. 0.006 0.006 ↑ 1.0 3 1

Seq Scan on regionales (cost=0.00..1.03 rows=3 width=12) (actual time=0.004..0.006 rows=3 loops=1)

15. 527.681 527.681 ↑ 1.0 1 47,971

Index Scan using producto_idproducto_idx on producto (cost=0.00..0.02 rows=1 width=41) (actual time=0.010..0.011 rows=1 loops=47,971)

  • Index Cond: (idproducto = venta_caja.id_producto)