explain.depesz.com

PostgreSQL's explain analyze made readable

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

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 74.414 6,616.333 ↓ 111.2 9,567 1

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

2. 2,258.345 6,541.919 ↓ 557.7 47,959 1

Sort (cost=4,024.18..4,024.40 rows=86 width=65) (actual time=6,497.152..6,541.919 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. 463.478 4,283.574 ↓ 557.7 47,959 1

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

4. 429.869 3,244.456 ↓ 557.8 47,970 1

Nested Loop (cost=0.98..4,018.61 rows=86 width=28) (actual time=0.114..3,244.456 rows=47,970 loops=1)

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

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

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

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

7. 258.995 683.971 ↓ 557.8 47,970 1

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

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

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

10. 527.670 527.670 ↑ 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.009..0.011 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.002..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.004..0.009 rows=6 loops=1)

13. 239.843 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.007 0.007 ↑ 1.0 3 1

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

15. 575.640 575.640 ↑ 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.010..0.012 rows=1 loops=47,970)

  • Index Cond: (idproducto = venta_caja.id_producto)