explain.depesz.com

PostgreSQL's explain analyze made readable

Result: qe7K

Settings
# exclusive inclusive rows x rows loops node
1. 0.211 6,991.260 ↑ 1.5 4 1

WindowAgg (cost=739,552.71..739,554.45 rows=6 width=811) (actual time=6,991.191..6,991.260 rows=4 loops=1)

2. 0.097 6,991.049 ↑ 1.5 4 1

Sort (cost=739,552.71..739,552.73 rows=6 width=811) (actual time=6,991.048..6,991.049 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.019 6,990.952 ↑ 1.5 4 1

Nested Loop Left Join (cost=713,187.33..739,552.63 rows=6 width=811) (actual time=6,990.356..6,990.952 rows=4 loops=1)

4. 0.023 6,990.933 ↑ 1.5 4 1

Nested Loop Left Join (cost=713,187.18..739,551.55 rows=6 width=808) (actual time=6,990.347..6,990.933 rows=4 loops=1)

5. 0.021 6,990.878 ↑ 1.5 4 1

Nested Loop Left Join (cost=713,186.76..739,548.75 rows=6 width=820) (actual time=6,990.323..6,990.878 rows=4 loops=1)

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

Nested Loop Left Join (cost=713,186.34..739,548.30 rows=1 width=792) (actual time=6,990.286..6,990.777 rows=4 loops=1)

7. 0.011 6,990.697 ↓ 4.0 4 1

Nested Loop Left Join (cost=713,185.92..739,547.81 rows=1 width=805) (actual time=6,990.238..6,990.697 rows=4 loops=1)

8. 0.013 6,990.650 ↓ 4.0 4 1

Nested Loop Left Join (cost=713,185.49..739,547.33 rows=1 width=799) (actual time=6,990.215..6,990.650 rows=4 loops=1)

9. 0.010 6,990.609 ↓ 4.0 4 1

Nested Loop Left Join (cost=713,185.07..739,546.86 rows=1 width=770) (actual time=6,990.194..6,990.609 rows=4 loops=1)

10. 0.049 6,990.559 ↓ 4.0 4 1

Nested Loop Left Join (cost=713,184.64..739,540.66 rows=1 width=734) (actual time=6,990.172..6,990.559 rows=4 loops=1)

11. 0.009 6,990.510 ↓ 4.0 4 1

Nested Loop Left Join (cost=713,184.49..739,540.48 rows=1 width=725) (actual time=6,990.141..6,990.510 rows=4 loops=1)

12. 0.013 6,990.501 ↓ 4.0 4 1

Nested Loop Left Join (cost=713,184.07..739,540.03 rows=1 width=721) (actual time=6,990.137..6,990.501 rows=4 loops=1)

13. 0.015 6,990.488 ↓ 4.0 4 1

Nested Loop Left Join (cost=713,183.64..739,539.57 rows=1 width=712) (actual time=6,990.132..6,990.488 rows=4 loops=1)

14. 0.009 6,990.429 ↓ 4.0 4 1

Nested Loop Left Join (cost=713,183.08..739,538.74 rows=1 width=450) (actual time=6,990.105..6,990.429 rows=4 loops=1)

15. 0.016 6,990.376 ↓ 4.0 4 1

Nested Loop Left Join (cost=713,182.66..739,534.50 rows=1 width=270) (actual time=6,990.082..6,990.376 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.029 6,984.404 ↓ 4.0 4 1

Nested Loop Left Join (cost=713,182.23..739,533.97 rows=1 width=248) (actual time=6,984.134..6,984.404 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 6,984.367 ↓ 4.0 4 1

Nested Loop Left Join (cost=713,182.23..739,532.90 rows=1 width=246) (actual time=6,984.121..6,984.367 rows=4 loops=1)

18. 0.018 6,984.334 ↓ 4.0 4 1

Nested Loop Left Join (cost=713,181.94..739,532.57 rows=1 width=225) (actual time=6,984.107..6,984.334 rows=4 loops=1)

19. 0.020 6,984.264 ↓ 4.0 4 1

Nested Loop Left Join (cost=713,181.51..739,531.98 rows=1 width=204) (actual time=6,984.079..6,984.264 rows=4 loops=1)

20. 0.010 6,984.188 ↓ 4.0 4 1

Nested Loop (cost=713,181.09..739,531.47 rows=1 width=155) (actual time=6,984.048..6,984.188 rows=4 loops=1)

  • Join Filter: (v010101.empresa = m0301.empresa)
21. 0.022 6,984.138 ↓ 4.0 4 1

Nested Loop (cost=713,180.66..739,530.98 rows=1 width=167) (actual time=6,984.026..6,984.138 rows=4 loops=1)

22. 32.720 6,984.068 ↓ 4.0 4 1

Hash Join (cost=713,180.24..739,526.78 rows=1 width=144) (actual time=6,983.989..6,984.068 rows=4 loops=1)

  • Hash Cond: ((tconsumoini.emp = v010101.empresa) AND (tconsumoini.eje = v010101.ejercicio) AND ((tconsumoini.alm)::text = (v010101.almacen)::text) AND ((tconsumoini.td)::text = (v010101.tipo_movimiento)::text) AND (tconsumoini.ped = v010101.pedido))
  • Join Filter: (((v010101.od_linea = tconsumoini.odl) AND (tconsumoini.odl <> 0)) OR ((v010101.od_linea > tconsumoini.odl) AND (tconsumoini.odl = 0)))
23. 0.008 0.008 ↑ 540.0 1 1

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

24. 171.749 6,951.340 ↑ 5.0 276,824 1

Hash (cost=664,128.05..664,128.05 rows=1,393,697 width=78) (actual time=6,951.340..6,951.340 rows=276,824 loops=1)

  • Buckets: 131072 Batches: 2 Memory Usage: 14417kB
25. 6,637.393 6,779.591 ↑ 5.0 276,824 1

Seq Scan on v010101 (cost=13,776.02..664,128.05 rows=1,393,697 width=78) (actual time=142.791..6,779.591 rows=276,824 loops=1)

  • Filter: (((articulo)::text !~~ '..%'::text) AND (NOT (hashed SubPlan 1)) AND ((cantidad - cantidad_s) > 0::numeric) AND (("substring"((campo1)::text, 1, 6) <> 'BLQFAB'::text) OR ("substring"((campo1)::text, 1, 6) IS NULL) OR ("current_user"() = 'pgjalti'::name) OR ("substring"((campo1)::text, 1, 8) = 'BLQFABRP'::text) OR ("substring"((campo1)::text, 1, 8) = 'BLQFABCJ'::text) OR ("substring"((campo1)::text, 1, 18) = 'BLQFAB-SERIEMANUAL'::text)))
  • Rows Removed by Filter: 8155221
26.          

SubPlan (forSeq Scan)

27. 142.198 142.198 ↑ 1.4 856 1

Seq Scan on m0301 m0301_1 (cost=0.00..13,772.96 rows=1,221 width=14) (actual time=0.307..142.198 rows=856 loops=1)

  • Filter: ((codigo_a)::text = ANY ('{Z40,D01}'::text[]))
  • Rows Removed by Filter: 648601
28. 0.048 0.048 ↑ 1.0 1 4

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

  • Index Cond: (((codigo)::text = (COALESCE(v010101.articulo, tconsumoini.art_m))::text) AND (empresa = v010101.empresa))
29. 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))
30. 0.056 0.056 ↑ 1.0 1 4

Index Scan using v0101_1 on v0101 (cost=0.43..0.51 rows=1 width=49) (actual time=0.014..0.014 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))
31. 0.052 0.052 ↑ 1.0 1 4

Index Scan using vxx03_1 on vxx03 (cost=0.43..0.58 rows=1 width=38) (actual time=0.013..0.013 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))
32. 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))
33. 0.008 0.008 ↑ 1.0 3 4

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

34. 5.956 5.956 ↓ 0.0 0 4

Index Scan using vxxxx09_pkey on vxxxx09 (cost=0.43..0.50 rows=1 width=38) (actual time=1.489..1.489 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))
35. 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.010..0.011 rows=1 loops=4)

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

Index Scan using mm_v010101_pkey on mm_v010101 (cost=0.56..0.82 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))
37. 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)
38. 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)
39. 0.000 0.000 ↓ 0.0 0 4

Index Scan using m_planmeca_pkey on m_planmeca (cost=0.15..0.17 rows=1 width=18) (actual time=0.000..0.000 rows=0 loops=4)

  • Index Cond: ((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)
40. 0.040 0.040 ↑ 2.0 1 4

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

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

Index Scan using vxxxx01_1 on vxxxx01 (cost=0.42..0.46 rows=1 width=50) (actual time=0.007..0.007 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))
42. 0.036 0.036 ↑ 1.0 1 4

Index Scan using edi_procesado02 on edi_procesado (cost=0.42..0.46 rows=1 width=23) (actual time=0.009..0.009 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))
43. 0.040 0.040 ↑ 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.010 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))
44. 0.080 0.080 ↓ 11.0 11 4

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

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

Index Scan using direcciones_1 on direcciones diredi (cost=0.42..0.46 rows=1 width=38) (actual time=0.008..0.008 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))
46. 0.000 0.000 ↓ 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.000..0.000 rows=0 loops=4)

  • Index Cond: (((almacen)::text = '00'::text) AND (provincia = COALESCE(manual.provincia, direcciones.provincia)) AND (pais = COALESCE(manual.pais, direcciones.pais)))
Planning time : 84.990 ms
Execution time : 6,993.925 ms