explain.depesz.com

PostgreSQL's explain analyze made readable

Result: xbJp

Settings
# exclusive inclusive rows x rows loops node
1. 0.187 1.566 ↑ 1.5 4 1

WindowAgg (cost=2,464.51..2,466.25 rows=6 width=811) (actual time=1.481..1.566 rows=4 loops=1)

2. 0.150 1.379 ↑ 1.5 4 1

Sort (cost=2,464.51..2,464.53 rows=6 width=811) (actual time=1.378..1.379 rows=4 loops=1)

  • Sort Key: v010101.almacen, v010101.pedido, (CASE WHEN (COALESCE((mm_v010101.orden)::integer, 0) <> 0) THEN ((v010101.od_linea * 10000) + mm_v010101.vinculo) ELSE mm_v010101.vinculo END), v010101.od_linea, mm_v010101.orden
  • Sort Method: quicksort Memory: 27kB
3. 0.012 1.229 ↑ 1.5 4 1

Nested Loop Left Join (cost=7.38..2,464.44 rows=6 width=811) (actual time=0.497..1.229 rows=4 loops=1)

4. 0.025 1.213 ↑ 1.5 4 1

Nested Loop Left Join (cost=7.23..2,463.36 rows=6 width=808) (actual time=0.491..1.213 rows=4 loops=1)

5. 0.032 1.152 ↑ 1.5 4 1

Nested Loop Left Join (cost=6.81..2,460.55 rows=6 width=820) (actual time=0.466..1.152 rows=4 loops=1)

  • Join Filter: (direcciones.orden = v0101.orden)
  • Rows Removed by Join Filter: 40
6. 0.018 1.028 ↓ 4.0 4 1

Nested Loop Left Join (cost=6.39..2,460.11 rows=1 width=792) (actual time=0.418..1.028 rows=4 loops=1)

7. 0.012 0.966 ↓ 4.0 4 1

Nested Loop Left Join (cost=5.96..2,459.61 rows=1 width=805) (actual time=0.395..0.966 rows=4 loops=1)

8. 0.008 0.922 ↓ 4.0 4 1

Nested Loop Left Join (cost=5.54..2,459.14 rows=1 width=799) (actual time=0.376..0.922 rows=4 loops=1)

9. 0.016 0.882 ↓ 4.0 4 1

Nested Loop Left Join (cost=5.12..2,458.67 rows=1 width=770) (actual time=0.360..0.882 rows=4 loops=1)

10. 0.172 0.822 ↓ 4.0 4 1

Nested Loop Left Join (cost=4.69..2,452.48 rows=1 width=734) (actual time=0.335..0.822 rows=4 loops=1)

  • Join Filter: ((m_planmeca.mecanizado)::text = (COALESCE(CASE btrim((mm_v010101.mecanizado)::text) WHEN ''::text THEN NULL::character varying ELSE mm_v010101.mecanizado END, CASE btrim((masco_ftart.planmeca)::text) WHEN ''::text THEN NULL::character varying ELSE masco_ftart.planmeca END))::text)
  • Rows Removed by Join Filter: 412
11. 0.010 0.578 ↓ 4.0 4 1

Nested Loop Left Join (cost=4.69..2,448.13 rows=1 width=725) (actual time=0.267..0.578 rows=4 loops=1)

12. 0.007 0.568 ↓ 4.0 4 1

Nested Loop Left Join (cost=4.26..2,447.67 rows=1 width=721) (actual time=0.265..0.568 rows=4 loops=1)

13. 0.018 0.561 ↓ 4.0 4 1

Nested Loop Left Join (cost=3.84..2,447.21 rows=1 width=712) (actual time=0.263..0.561 rows=4 loops=1)

14. 0.009 0.499 ↓ 4.0 4 1

Nested Loop Left Join (cost=3.28..2,446.58 rows=1 width=450) (actual time=0.240..0.499 rows=4 loops=1)

15. 0.012 0.446 ↓ 4.0 4 1

Nested Loop Left Join (cost=2.86..2,442.34 rows=1 width=270) (actual time=0.220..0.446 rows=4 loops=1)

  • Join Filter: (x1401.tipo = ANY ('{3,4,5,7,8,9,10,11,12,13,14,20,21,22,23,24,25}'::integer[]))
16. 0.020 0.390 ↓ 4.0 4 1

Nested Loop Left Join (cost=2.43..2,441.84 rows=1 width=248) (actual time=0.187..0.390 rows=4 loops=1)

  • Join Filter: ((x1401.unidad_gest_1)::text = (m0304.unidad_gest_1)::text)
  • Rows Removed by Join Filter: 12
17. 0.009 0.362 ↓ 4.0 4 1

Nested Loop Left Join (cost=2.43..2,440.78 rows=1 width=246) (actual time=0.177..0.362 rows=4 loops=1)

18. 0.028 0.329 ↓ 4.0 4 1

Nested Loop Left Join (cost=2.14..2,440.45 rows=1 width=225) (actual time=0.161..0.329 rows=4 loops=1)

19. 0.019 0.237 ↓ 4.0 4 1

Nested Loop Left Join (cost=1.71..2,439.86 rows=1 width=204) (actual time=0.114..0.237 rows=4 loops=1)

20. 0.012 0.158 ↓ 4.0 4 1

Nested Loop (cost=1.28..2,439.39 rows=1 width=155) (actual time=0.083..0.158 rows=4 loops=1)

  • Join Filter: (v010101.empresa = m0301.empresa)
21. 0.014 0.106 ↓ 4.0 4 1

Nested Loop (cost=0.86..2,438.90 rows=1 width=167) (actual time=0.060..0.106 rows=4 loops=1)

22. 0.011 0.056 ↓ 4.0 4 1

Nested Loop (cost=0.43..2,434.70 rows=1 width=144) (actual time=0.041..0.056 rows=4 loops=1)

23. 0.004 0.004 ↑ 540.0 1 1

Seq Scan on tconsumoini (cost=0.00..15.40 rows=540 width=68) (actual time=0.004..0.004 rows=1 loops=1)

24. 0.041 0.041 ↓ 4.0 4 1

Index Scan using v010101_1 on v010101 (cost=0.43..4.47 rows=1 width=78) (actual time=0.030..0.041 rows=4 loops=1)

  • Index Cond: ((pedido = tconsumoini.ped) AND ((almacen)::text = (tconsumoini.alm)::text) AND ((tipo_movimiento)::text = (tconsumoini.td)::text) AND (ejercicio = tconsumoini.eje) AND (empresa = tconsumoini.emp))
  • Filter: (((od_linea = tconsumoini.odl) AND (tconsumoini.odl <> 0)) OR ((od_linea > tconsumoini.odl) AND (tconsumoini.odl = 0)))
25. 0.036 0.036 ↑ 1.0 1 4

Index Scan using m0304_1 on m0304 (cost=0.42..4.19 rows=1 width=23) (actual time=0.009..0.009 rows=1 loops=4)

  • Index Cond: (((codigo)::text = (COALESCE(v010101.articulo, tconsumoini.art_m))::text) AND (empresa = v010101.empresa))
26. 0.040 0.040 ↑ 1.0 1 4

Index Scan using m0301_pkey on m0301 (cost=0.42..0.48 rows=1 width=20) (actual time=0.009..0.010 rows=1 loops=4)

  • Index Cond: (((codigo)::text = (m0304.codigo)::text) AND (empresa = m0304.empresa))
27. 0.060 0.060 ↑ 1.0 1 4

Index Scan using v0101_1 on v0101 (cost=0.43..0.46 rows=1 width=49) (actual time=0.014..0.015 rows=1 loops=4)

  • Index Cond: ((empresa = v010101.empresa) AND (ejercicio = v010101.ejercicio) AND ((almacen)::text = (v010101.almacen)::text) AND ((tipo_doc)::text = (v010101.tipo_movimiento)::text) AND (documento = v010101.pedido))
28. 0.064 0.064 ↑ 1.0 1 4

Index Scan using vxx03_1 on vxx03 (cost=0.43..0.58 rows=1 width=38) (actual time=0.015..0.016 rows=1 loops=4)

  • Index Cond: ((empresa = v0101.empresa) AND (ejercicio = v0101.ejercicio) AND ((almacen)::text = (v0101.almacen)::text) AND ((tipo_doc)::text = (v0101.tipo_doc)::text) AND (documento = v0101.documento))
29. 0.024 0.024 ↓ 0.0 0 4

Index Scan using manual_2 on manual (cost=0.29..0.32 rows=1 width=33) (actual time=0.006..0.006 rows=0 loops=4)

  • Index Cond: ((documento = v010101.pedido) AND ((almacen)::text = (v010101.almacen)::text) AND ((tipo_doc)::text = (v010101.tipo_movimiento)::text) AND (ejercicio = v010101.ejercicio) AND (empresa = v010101.empresa))
30. 0.008 0.008 ↑ 1.0 3 4

Seq Scan on x1401 (cost=0.00..1.03 rows=3 width=5) (actual time=0.001..0.002 rows=3 loops=4)

31. 0.044 0.044 ↓ 0.0 0 4

Index Scan using vxxxx09_pkey on vxxxx09 (cost=0.43..0.46 rows=1 width=38) (actual time=0.011..0.011 rows=0 loops=4)

  • Index Cond: ((documento = v010101.pedido) AND ((almacen)::text = (v010101.almacen)::text) AND ((tipo_movimiento)::text = (v010101.tipo_movimiento)::text) AND (ejercicio = v010101.ejercicio) AND (empresa = v010101.empresa) AND (linea_documento = v010101.od_linea))
32. 0.044 0.044 ↑ 1.0 1 4

Index Scan using masco_ftart01 on masco_ftart (cost=0.42..4.23 rows=1 width=194) (actual time=0.011..0.011 rows=1 loops=4)

  • Index Cond: ((codigo)::text = (COALESCE(v010101.articulo, tconsumoini.art_m))::text)
33. 0.044 0.044 ↑ 1.0 1 4

Index Scan using mm_v010101_pkey on mm_v010101 (cost=0.56..0.63 rows=1 width=280) (actual time=0.011..0.011 rows=1 loops=4)

  • Index Cond: ((pedido = v010101.pedido) AND ((almacen)::text = (v010101.almacen)::text) AND ((tipo_doc)::text = (v010101.tipo_movimiento)::text) AND (ejercicio = v010101.ejercicio) AND (empresa = v010101.empresa) AND (od_linea = v010101.od_linea))
34. 0.000 0.000 ↓ 0.0 0 4

Index Scan using masco_ftart01 on masco_ftart mm_masco_ftart (cost=0.42..0.45 rows=1 width=23) (actual time=0.000..0.000 rows=0 loops=4)

  • Index Cond: ((codigo)::text = (mm_v010101.componente)::text)
35. 0.000 0.000 ↓ 0.0 0 4

Index Scan using masco_ftart01 on masco_ftart tirador_masco_ftart (cost=0.42..0.45 rows=1 width=18) (actual time=0.000..0.000 rows=0 loops=4)

  • Index Cond: ((codigo)::text = (mm_v010101.codigo_tirador)::text)
36. 0.072 0.072 ↑ 1.0 103 4

Seq Scan on m_planmeca (cost=0.00..2.03 rows=103 width=18) (actual time=0.004..0.018 rows=103 loops=4)

37. 0.044 0.044 ↑ 2.0 1 4

Index Scan using m0302_2 on m0302 (cost=0.43..6.18 rows=2 width=52) (actual time=0.010..0.011 rows=1 loops=4)

  • Index Cond: (((codigo)::text = (COALESCE(v010101.articulo, tconsumoini.art_m))::text) AND (tipo = 0) AND (empresa = tconsumoini.emp))
38. 0.032 0.032 ↓ 0.0 0 4

Index Scan using vxxxx01_1 on vxxxx01 (cost=0.42..0.45 rows=1 width=50) (actual time=0.008..0.008 rows=0 loops=4)

  • Index Cond: ((documento = v010101.pedido) AND ((almacen)::text = (v010101.almacen)::text) AND ((tipo_doc)::text = (v010101.tipo_movimiento)::text) AND (ejercicio = v010101.ejercicio) AND (empresa = v010101.empresa) AND (orden = v010101.linea_pedido))
39. 0.032 0.032 ↑ 1.0 1 4

Index Scan using edi_procesado02 on edi_procesado (cost=0.42..0.46 rows=1 width=23) (actual time=0.007..0.008 rows=1 loops=4)

  • Index Cond: ((documento_pv = v0101.documento) AND ((almacen_pv)::text = (v0101.almacen)::text) AND (ejercicio_pv = v0101.ejercicio) AND (empresa_pv = v0101.empresa))
40. 0.044 0.044 ↑ 1.0 1 4

Index Scan using masco_rutes01 on masco_rutes (cost=0.43..0.49 rows=1 width=17) (actual time=0.010..0.011 rows=1 loops=4)

  • Index Cond: (((su)::text = (v0101.subcta)::text) AND (ord = v0101.orden) AND ((almacen)::text = (CASE WHEN ((v0101.almacen)::text = '25'::text) THEN v0101.almacen ELSE '00'::character varying END)::text) AND (em = v0101.empresa))
41. 0.092 0.092 ↓ 11.0 11 4

Index Scan using direcciones_1 on direcciones (cost=0.41..0.44 rows=1 width=42) (actual time=0.012..0.023 rows=11 loops=4)

  • Index Cond: ((empresa = v010101.empresa) AND ((subcta)::text = (v010101.subcta)::text))
42. 0.036 0.036 ↑ 1.0 1 4

Index Scan using direcciones_1 on direcciones diredi (cost=0.42..0.46 rows=1 width=38) (actual time=0.009..0.009 rows=1 loops=4)

  • Index Cond: ((empresa = v010101.empresa) AND ((subcta)::text = ((COALESCE(mm_v010101.edi_subcta_desti, edi_procesado.subcta_desti))::character varying(9))::text) AND (orden = ("substring"((COALESCE(mm_v010101.edi_subcta_desti, edi_procesado.subcta_desti))::text, 10, 3))::integer))
43. 0.004 0.004 ↓ 0.0 0 4

Index Scan using m_rutasprov_pkey on m_rutasprov (cost=0.15..0.17 rows=1 width=7) (actual time=0.001..0.001 rows=0 loops=4)

  • Index Cond: (((almacen)::text = '00'::text) AND (provincia = COALESCE(manual.provincia, direcciones.provincia)) AND (pais = COALESCE(manual.pais, direcciones.pais)))