explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Uzuz : Optimization for: plan #ZjMA

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 82.297 6,487.828 ↓ 111.2 9,567 1

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

2. 2,651.554 6,405.531 ↓ 557.7 47,959 1

Sort (cost=4,024.18..4,024.40 rows=86 width=65) (actual time=6,354.541..6,405.531 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. 374.068 3,753.977 ↓ 557.7 47,959 1

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

4. 338.108 2,852.239 ↓ 557.8 47,970 1

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

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

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

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

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

7. 212.008 553.652 ↓ 557.8 47,970 1

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

  • Merge Cond: ((cobro.id_cobro = venta_caja.id_cobro) AND (cobro.idapertura_cierre = venta_caja.idapertura_cierre))
8. 142.505 142.505 ↑ 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.015..142.505 rows=33,326 loops=1)

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

10. 383.760 383.760 ↑ 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.008 rows=1 loops=47,970)

  • Index Cond: (idapertura_cierre = cobro.idapertura_cierre)
11. 431.723 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.007 0.007 ↑ 1.0 6 1

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

13. 287.814 287.820 ↑ 1.0 3 47,970

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

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. 527.670 527.670 ↑ 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.009..0.011 rows=1 loops=47,970)

  • Index Cond: (idproducto = venta_caja.id_producto)