explain.depesz.com

PostgreSQL's explain analyze made readable

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

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 129.374 8,636.414 ↓ 111.2 9,567 1

GroupAggregate (cost=4,027.67..4,030.68 rows=86 width=65) (actual time=8,431.004..8,636.414 rows=9,567 loops=1)

2. 2,898.575 8,507.040 ↓ 557.7 47,960 1

Sort (cost=4,027.67..4,027.88 rows=86 width=65) (actual time=8,430.981..8,507.040 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. 514.784 5,608.465 ↓ 557.7 47,960 1

Nested Loop (cost=0.98..4,024.91 rows=86 width=65) (actual time=0.230..5,608.465 rows=47,960 loops=1)

4. 421.607 4,086.290 ↓ 557.8 47,971 1

Nested Loop (cost=0.98..4,022.09 rows=86 width=28) (actual time=0.184..4,086.290 rows=47,971 loops=1)

  • Join Filter: (caja.id_regional = regionales.id_regional)
  • Rows Removed by Join Filter: 95942
5. 673.080 3,376.857 ↓ 557.8 47,971 1

Nested Loop (cost=0.98..4,017.19 rows=86 width=24) (actual time=0.175..3,376.857 rows=47,971 loops=1)

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

Nested Loop (cost=0.98..4,008.37 rows=86 width=24) (actual time=0.159..2,176.096 rows=47,971 loops=1)

7. 299.462 984.340 ↓ 557.8 47,971 1

Merge Join (cost=0.70..3,982.08 rows=86 width=20) (actual time=0.149..984.340 rows=47,971 loops=1)

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

Index Scan using cobro_pkey on cobro (cost=0.29..1,577.95 rows=33,338 width=12) (actual time=0.132..337.653 rows=33,327 loops=1)

  • Filter: (estado IS NULL)
  • Rows Removed by Filter: 444
9. 347.225 347.225 ↑ 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.010..347.225 rows=48,603 loops=1)

10. 863.478 863.478 ↑ 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.016..0.018 rows=1 loops=47,971)

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

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

12. 0.008 0.008 ↑ 1.0 6 1

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

13. 287.820 287.826 ↑ 1.0 3 47,971

Materialize (cost=0.00..1.04 rows=3 width=12) (actual time=0.001..0.006 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.003..0.006 rows=3 loops=1)

15. 1,007.391 1,007.391 ↑ 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.019..0.021 rows=1 loops=47,971)

  • Index Cond: (idproducto = venta_caja.id_producto)