explain.depesz.com

PostgreSQL's explain analyze made readable

Result: feqno : Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: plan #loWb; plan #MAEG; plan #ZY8K; plan #MZ8N; plan #lJvx; plan #lBf6; plan #MT6a

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 84.297 7,644.636 ↓ 111.2 9,567 1

GroupAggregate (cost=4,024.18..4,027.19 rows=86 width=65) (actual time=7,478.075..7,644.636 rows=9,567 loops=1)

2. 2,238.836 7,560.339 ↓ 557.7 47,959 1

Sort (cost=4,024.18..4,024.40 rows=86 width=65) (actual time=7,478.045..7,560.339 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. 434.574 5,321.503 ↓ 557.7 47,959 1

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

4. 446.836 3,975.499 ↓ 557.8 47,970 1

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

  • Join Filter: (caja.id_regional = regionales.id_regional)
  • Rows Removed by Join Filter: 95940
5. 654.312 3,240.843 ↓ 557.8 47,970 1

Nested Loop (cost=0.98..4,013.70 rows=86 width=24) (actual time=0.089..3,240.843 rows=47,970 loops=1)

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

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

7. 304.891 1,015.241 ↓ 557.8 47,970 1

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

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

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

10. 719.550 719.550 ↑ 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.013..0.015 rows=1 loops=47,970)

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

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

12. 0.018 0.018 ↑ 1.0 6 1

Seq Scan on caja (cost=0.00..1.06 rows=6 width=8) (actual time=0.004..0.018 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. 911.430 911.430 ↑ 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.016..0.019 rows=1 loops=47,970)

  • Index Cond: (idproducto = venta_caja.id_producto)