explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 7V9w : Optimization for: Optimization for: plan #ZjMA; plan #Uzuz

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 94.293 6,878.007 ↓ 111.2 9,567 1

GroupAggregate (cost=4,024.18..4,027.19 rows=86 width=65) (actual time=6,733.244..6,878.007 rows=9,567 loops=1)

2. 3,056.858 6,783.714 ↓ 557.7 47,959 1

Sort (cost=4,024.18..4,024.40 rows=86 width=65) (actual time=6,733.223..6,783.714 rows=47,959 loops=1)

  • Sort Key: venta_caja.id_producto, producto.descripcion, (date(apertura_cierre.fecha_apertura)), regionales.descripcion
  • Sort Method: quicksort Memory: 8246kB
3. 363.885 3,726.856 ↓ 557.7 47,959 1

Nested Loop (cost=0.98..4,021.42 rows=86 width=65) (actual time=0.215..3,726.856 rows=47,959 loops=1)

4. 379.070 2,883.271 ↓ 557.8 47,970 1

Nested Loop (cost=0.98..4,018.61 rows=86 width=28) (actual time=0.086..2,883.271 rows=47,970 loops=1)

  • Join Filter: (caja.id_regional = regionales.id_regional)
  • Rows Removed by Join Filter: 95940
5. 612.174 2,264.351 ↓ 557.8 47,970 1

Nested Loop (cost=0.98..4,013.70 rows=86 width=24) (actual time=0.071..2,264.351 rows=47,970 loops=1)

  • Join Filter: (apertura_cierre.idcaja = caja.idcaja)
  • Rows Removed by Join Filter: 239850
6. 270.947 1,220.447 ↓ 557.8 47,970 1

Nested Loop (cost=0.98..4,004.89 rows=86 width=24) (actual time=0.056..1,220.447 rows=47,970 loops=1)

7. 211.525 517.770 ↓ 557.8 47,970 1

Merge Join (cost=0.70..3,978.59 rows=86 width=20) (actual time=0.043..517.770 rows=47,970 loops=1)

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

Index Scan using cobro_pkey on cobro (cost=0.29..1,577.95 rows=33,338 width=12) (actual time=0.023..139.104 rows=33,326 loops=1)

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

Index Scan using venta_caja_pkey on venta_caja (cost=0.41..1,992.44 rows=48,633 width=20) (actual time=0.013..167.141 rows=48,602 loops=1)

10. 431.730 431.730 ↑ 1.0 1 47,970

Index Scan using apertura_cierre_pkey on apertura_cierre (cost=0.28..0.30 rows=1 width=16) (actual time=0.007..0.009 rows=1 loops=47,970)

  • Index Cond: (idapertura_cierre = cobro.idapertura_cierre)
11. 431.721 431.730 ↑ 1.0 6 47,970

Materialize (cost=0.00..1.09 rows=6 width=8) (actual time=0.001..0.009 rows=6 loops=47,970)

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.003..0.009 rows=6 loops=1)

13. 239.840 239.850 ↑ 1.0 3 47,970

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

14. 0.010 0.010 ↑ 1.0 3 1

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

15. 479.700 479.700 ↑ 1.0 1 47,970

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

  • Index Cond: (idproducto = venta_caja.id_producto)