explain.depesz.com

PostgreSQL's explain analyze made readable

Result: PmSb : Optimization for: plan #QTY4

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 3.332 172,645.210 ↓ 796.0 796 1

GroupAggregate (cost=1,881,593.84..3,928,433.20 rows=1 width=4) (actual time=1,090.774..172,645.210 rows=796 loops=1)

  • Group Key: sub.pedido_id
2.          

Initplan (for GroupAggregate)

3. 0.010 0.010 ↑ 1.0 1 1

Seq Scan on negociaciones_estado (cost=0.00..1.07 rows=1 width=4) (actual time=0.010..0.010 rows=1 loops=1)

  • Filter: ((cod_ext)::text = '1'::text)
  • Rows Removed by Filter: 5
4. 76.062 172,641.868 ↓ 1,259.0 1,259 1

Nested Loop Left Join (cost=1,881,592.76..3,928,432.11 rows=1 width=4) (actual time=1,046.204..172,641.868 rows=1,259 loops=1)

  • Join Filter: ((t.mes_inicio <= (date_part('month'::text, (CASE WHEN (NULLIF(lower(NULLIF(replace(((("*SELECT* 1".negociacion_personalizacion)::json -> (npf_fa.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) IS NOT NULL) THEN to_date(NULLIF(lower(NULLIF(replace(((("*SELECT* 1".negociacion_personalizacion)::json -> (npf_fa.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text), 'YYYY/MM/DD'::text) ELSE NULL::date END)::timestamp without time zone))::integer) AND (t.mes_fin >= (date_part('month'::text, (CASE WHEN (NULLIF(lower(NULLIF(replace(((("*SELECT* 1".negociacion_personalizacion)::json -> (npf_fa.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) IS NOT NULL) THEN to_date(NULLIF(lower(NULLIF(replace(((("*SELECT* 1".negociacion_personalizacion)::json -> (npf_fa.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text), 'YYYY/MM/DD'::text) ELSE NULL::date END)::timestamp without time zone))::integer))
  • Rows Removed by Join Filter: 3,795
5. 4.698 172,563.288 ↓ 1,259.0 1,259 1

Nested Loop Left Join (cost=1,881,592.76..3,928,430.49 rows=1 width=55) (actual time=1,046.111..172,563.288 rows=1,259 loops=1)

  • Join Filter: (npf_fa.empresa_id = "*SELECT* 1".negociacion_empresa_id)
6. 2.819 172,524.597 ↓ 1,259.0 1,259 1

Nested Loop (cost=1,881,592.76..3,928,426.93 rows=1 width=55) (actual time=1,046.080..172,524.597 rows=1,259 loops=1)

7. 237.926 172,507.698 ↓ 640.0 1,280 1

Nested Loop (cost=1,881,591.24..3,928,423.15 rows=2 width=59) (actual time=1,046.011..172,507.698 rows=1,280 loops=1)

  • Join Filter: (ent_2.negociacion_id = "*SELECT* 1".negociacion_id)
  • Rows Removed by Join Filter: 1,207,224
8. 1.707 694.940 ↓ 1,364.0 1,364 1

Merge Join (cost=1,881,576.74..1,881,607.88 rows=1 width=12) (actual time=680.626..694.940 rows=1,364 loops=1)

  • Merge Cond: (ent_1.id = ent_4.id)
9. 1.267 144.945 ↓ 2.0 917 1

Merge Join (cost=469,481.84..469,492.97 rows=453 width=8) (actual time=142.988..144.945 rows=917 loops=1)

  • Merge Cond: (ent_1.id = pp.pedido_id)
10. 0.550 1.314 ↓ 2.0 948 1

Sort (cost=63.84..65.03 rows=475 width=4) (actual time=1.023..1.314 rows=948 loops=1)

  • Sort Key: ent_1.id
  • Sort Method: quicksort Memory: 69kB
11. 0.259 0.764 ↓ 2.0 948 1

Hash Left Join (cost=4.79..42.72 rows=475 width=4) (actual time=0.125..0.764 rows=948 loops=1)

  • Hash Cond: (ent_1.empresa_id = npf_tp.empresa_id)
12. 0.448 0.462 ↓ 2.0 948 1

Seq Scan on pedidos ent_1 (cost=1.24..35.72 rows=475 width=8) (actual time=0.059..0.462 rows=948 loops=1)

  • Filter: ((NOT nnjl_remove) AND (NOT (hashed SubPlan 3)))
  • Rows Removed by Filter: 51
13.          

SubPlan (for Seq Scan)

14. 0.014 0.014 ↑ 1.0 7 1

Seq Scan on users users_1 (cost=0.00..1.22 rows=7 width=4) (actual time=0.008..0.014 rows=7 loops=1)

  • Filter: sysadmin
  • Rows Removed by Filter: 15
15. 0.001 0.043 ↑ 1.0 1 1

Hash (cost=3.54..3.54 rows=1 width=4) (actual time=0.043..0.043 rows=1 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
16. 0.042 0.042 ↑ 1.0 1 1

Seq Scan on nnmas_personal_fields npf_tp (cost=0.00..3.54 rows=1 width=4) (actual time=0.020..0.042 rows=1 loops=1)

  • Filter: ((NOT nnjl_remove) AND ((tabla)::text = 'pedidos'::text) AND ((nombre)::text = 'tipo_pedido'::text))
  • Rows Removed by Filter: 102
17. 0.649 142.364 ↓ 1.0 919 1

Sort (cost=469,418.00..469,420.24 rows=898 width=4) (actual time=141.961..142.364 rows=919 loops=1)

  • Sort Key: pp.pedido_id
  • Sort Method: quicksort Memory: 68kB
18. 1.036 141.715 ↓ 1.0 919 1

HashAggregate (cost=469,364.97..469,373.95 rows=898 width=4) (actual time=141.623..141.715 rows=919 loops=1)

  • Group Key: pp.pedido_id
19. 1.006 140.679 ↑ 6.2 4,847 1

Hash Join (cost=204.82..469,289.87 rows=30,038 width=4) (actual time=138.976..140.679 rows=4,847 loops=1)

  • Hash Cond: ("*SELECT* 1_1".producto_id = pp.producto_id)
20. 0.077 137.342 ↑ 1.2 1,073 1

Append (cost=14.50..468,452.24 rows=1,303 width=4) (actual time=136.617..137.342 rows=1,073 loops=1)

21. 0.000 0.011 ↓ 0.0 0 1

Subquery Scan on *SELECT* 1_1 (cost=14.50..29.30 rows=240 width=4) (actual time=0.011..0.011 rows=0 loops=1)

22. 0.003 0.011 ↓ 0.0 0 1

Result (cost=14.50..26.90 rows=240 width=309) (actual time=0.011..0.011 rows=0 loops=1)

  • One-Time Filter: ($74 IS NOT NULL)
23.          

Initplan (for Result)

24. 0.008 0.008 ↓ 0.0 0 1

Seq Scan on materialized_views mv_12 (cost=0.00..14.50 rows=1 width=4) (actual time=0.008..0.008 rows=0 loops=1)

  • Filter: (active AND ((matviewname)::text = 'vism_bi_productos'::text))
  • Rows Removed by Filter: 33
25. 0.000 0.000 ↓ 0.0 0

Seq Scan on vism_bi_productos visbi (cost=0.00..12.40 rows=240 width=309) (never executed)

26. 0.116 137.254 ↓ 1.0 1,073 1

Subquery Scan on *SELECT* 2_1 (cost=468,385.74..468,422.94 rows=1,063 width=4) (actual time=136.605..137.254 rows=1,073 loops=1)

27. 0.138 137.138 ↓ 1.0 1,073 1

Result (cost=468,385.74..468,412.31 rows=1,063 width=309) (actual time=136.603..137.138 rows=1,073 loops=1)

  • One-Time Filter: ($75 IS NOT NULL)
28.          

Initplan (for Result)

29. 0.013 0.013 ↑ 1.0 1 1

Seq Scan on materialized_views mv_13 (cost=0.00..14.50 rows=1 width=4) (actual time=0.008..0.013 rows=1 loops=1)

  • Filter: ((NOT active) AND ((matviewname)::text = 'vism_bi_productos'::text))
  • Rows Removed by Filter: 32
30. 2.893 136.987 ↓ 1.0 1,073 1

HashAggregate (cost=468,371.24..468,387.18 rows=1,063 width=293) (actual time=136.589..136.987 rows=1,073 loops=1)

  • Group Key: (clock_timestamp())::timestamp without time zone, ent_5.empresa_id, ent_5.id, ent_5.cod_ext, ent_5.descripcion, ent_5.precio, ent_5.precio_distribuidor, CASE WHEN (ent_5.precio_distribuidor IS NOT NULL) THEN ent_5.precio_distribuidor ELSE ent_5.precio END, ent_5.modulos, c.id, c.nombre, m.id, m.nombre, f.id, f.nombre, ent_5.personalizacion, ((json_object_agg(npf.nombre, CASE WHEN ((NULLIF(lower(NULLIF(replace((((ent_6.personalizacion)::json -> (npf.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) IS NOT NULL) AND (((npf.tipo)::text = 'select'::text) OR ((npf.tipo)::text = 'select_mandatory'::text) OR ((npf.tipo)::text = 'select_readonly'::text)) AND (NULLIF(lower(NULLIF(replace((((ent_6.personalizacion)::json -> (npf.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) ~ '^[0-9]'::text)) THEN (SubPlan 40) WHEN ((NULLIF(lower(NULLIF(replace((((ent_6.personalizacion)::json -> (npf.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) IS NOT NULL) AND ((npf.tipo)::text = 'selectmultiple'::text) AND (NULLIF(lower(NULLIF(replace((((ent_6.personalizacion)::json -> (npf.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) ~ '^[0-9]'::text)) THEN (array_to_string((SubPlan 41), ','::text))::character varying WHEN ((NULLIF(lower(NULLIF(replace((((ent_6.personalizacion)::json -> (npf.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) IS NOT NULL) AND ((npf.tipo)::text ~~* 'selectreference%'::text) AND ((npf.nombre)::text = 'distribuidor'::text) AND (NULLIF(lower(NULLIF(replace((((ent_6.personalizacion)::json -> (npf.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) ~ '^[0-9]'::text)) THEN (SubPlan 42) WHEN (NULLIF(lower(NULLIF(replace((((ent_6.personalizacion)::json -> (npf.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) IS NOT NULL) THEN (NULLIF(lower(NULLIF(replace((((ent_6.personalizacion)::json -> (npf.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text))::character varying ELSE NULL::character varying END))::text), ent_5.nnjl_remove
31. 1.327 134.094 ↓ 1.0 1,073 1

Hash Left Join (cost=353.11..468,323.40 rows=1,063 width=293) (actual time=8.245..134.094 rows=1,073 loops=1)

  • Hash Cond: (pc.categoria_id = c.id)
32. 0.511 132.760 ↓ 1.0 1,073 1

Hash Left Join (cost=351.93..468,312.49 rows=1,063 width=261) (actual time=8.207..132.760 rows=1,073 loops=1)

  • Hash Cond: (ent_5.familia_id = f.id)
33. 1.095 132.238 ↓ 1.0 1,073 1

Nested Loop Left Join (cost=350.57..468,296.52 rows=1,063 width=229) (actual time=8.175..132.238 rows=1,073 loops=1)

34. 0.692 128.997 ↓ 1.0 1,073 1

Hash Left Join (cost=350.42..468,097.15 rows=1,063 width=221) (actual time=8.165..128.997 rows=1,073 loops=1)

  • Hash Cond: (ent_5.id = pc.producto_id)
35. 1.307 127.395 ↑ 1.0 1,063 1

Merge Left Join (cost=289.25..467,887.58 rows=1,063 width=217) (actual time=7.239..127.395 rows=1,063 loops=1)

  • Merge Cond: (ent_5.id = ent_6.id)
36. 0.862 0.862 ↑ 1.0 1,063 1

Index Scan using productos_pkey on productos ent_5 (cost=0.28..152.01 rows=1,063 width=185) (actual time=0.016..0.862 rows=1,063 loops=1)

37. 0.479 125.226 ↓ 1.0 1,058 1

Materialize (cost=288.97..467,719.70 rows=1,057 width=36) (actual time=7.218..125.226 rows=1,058 loops=1)

38. 103.895 124.747 ↓ 1.0 1,058 1

GroupAggregate (cost=288.97..467,706.49 rows=1,057 width=120) (actual time=7.212..124.747 rows=1,058 loops=1)

  • Group Key: ent_6.id
39. 4.387 8.036 ↓ 2.9 6,408 1

Sort (cost=288.97..294.51 rows=2,217 width=120) (actual time=6.908..8.036 rows=6,408 loops=1)

  • Sort Key: ent_6.id
  • Sort Method: quicksort Memory: 1,640kB
40. 1.330 3.649 ↓ 2.9 6,408 1

Hash Join (cost=98.66..165.77 rows=2,217 width=120) (actual time=1.796..3.649 rows=6,408 loops=1)

  • Hash Cond: (ent_6.empresa_id = npf.empresa_id)
41. 0.409 2.138 ↓ 1.0 1,068 1

Hash Right Join (cost=94.53..128.89 rows=1,057 width=92) (actual time=1.591..2.138 rows=1,068 loops=1)

  • Hash Cond: (pc_1.producto_id = ent_6.id)
42. 0.467 0.722 ↓ 1.0 1,030 1

HashAggregate (cost=28.02..38.23 rows=1,020 width=12) (actual time=0.555..0.722 rows=1,030 loops=1)

  • Group Key: pc_1.empresa_id, pc_1.producto_id, pc_1.categoria_id
43. 0.255 0.255 ↑ 1.0 1,030 1

Seq Scan on productos_categoria pc_1 (cost=0.00..20.30 rows=1,030 width=12) (actual time=0.006..0.255 rows=1,030 loops=1)

  • Filter: (NOT nnjl_remove)
44. 0.390 1.007 ↓ 1.0 1,058 1

Hash (cost=53.29..53.29 rows=1,057 width=92) (actual time=1.007..1.007 rows=1,058 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 131kB
45. 0.617 0.617 ↓ 1.0 1,058 1

Seq Scan on productos ent_6 (cost=0.00..53.29 rows=1,057 width=92) (actual time=0.017..0.617 rows=1,058 loops=1)

  • Filter: ((personalizacion IS NOT NULL) AND ((personalizacion)::text <> ''::text))
  • Rows Removed by Filter: 5
46. 0.003 0.181 ↑ 1.0 6 1

Hash (cost=4.06..4.06 rows=6 width=32) (actual time=0.181..0.181 rows=6 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
47. 0.178 0.178 ↑ 1.0 6 1

Seq Scan on nnmas_personal_fields npf (cost=0.00..4.06 rows=6 width=32) (actual time=0.037..0.178 rows=6 loops=1)

  • Filter: ((NOT nnjl_remove) AND (descripcion IS NOT NULL) AND ((descripcion)::text <> ''::text) AND ((tipo)::text !~~* 'nnmas_images%'::text) AND ((tipo)::text !~~* 'textarea%'::text) AND ((tabla)::text = 'productos'::text))
  • Rows Removed by Filter: 97
48.          

SubPlan (for GroupAggregate)

49. 12.816 12.816 ↑ 1.0 1 4,272

Index Scan using nnmas_selects_pkey on nnmas_selects nnmas_selects_10 (cost=0.31..8.33 rows=1 width=17) (actual time=0.003..0.003 rows=1 loops=4,272)

  • Index Cond: (id = (NULLIF(lower(NULLIF(replace((((ent_6.personalizacion)::json -> (npf.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text))::integer)
  • Filter: (empresa_id = ent_6.empresa_id)
50. 0.000 0.000 ↓ 0.0 0

Seq Scan on nnmas_selects nnmas_selects_11 (cost=0.00..193.92 rows=126 width=17) (never executed)

  • Filter: ((empresa_id = ent_6.empresa_id) AND ((id)::text = ANY (string_to_array(NULLIF(lower(NULLIF(replace((((ent_6.personalizacion)::json -> (npf.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text), ','::text))))
51. 0.000 0.000 ↓ 0.0 0

Seq Scan on distribuidores d_5 (cost=0.00..8.32 rows=1 width=22) (never executed)

  • Filter: ((empresa_id = ent_6.empresa_id) AND (id = (NULLIF(lower(NULLIF(replace((((ent_6.personalizacion)::json -> (npf.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text))::integer))
52. 0.209 0.910 ↓ 1.0 1,030 1

Hash (cost=48.43..48.43 rows=1,020 width=8) (actual time=0.910..0.910 rows=1,030 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 41kB
53. 0.117 0.701 ↓ 1.0 1,030 1

Subquery Scan on pc (cost=28.02..48.43 rows=1,020 width=8) (actual time=0.467..0.701 rows=1,030 loops=1)

54. 0.381 0.584 ↓ 1.0 1,030 1

HashAggregate (cost=28.02..38.23 rows=1,020 width=12) (actual time=0.466..0.584 rows=1,030 loops=1)

  • Group Key: pc_2.empresa_id, pc_2.producto_id, pc_2.categoria_id
55. 0.203 0.203 ↑ 1.0 1,030 1

Seq Scan on productos_categoria pc_2 (cost=0.00..20.30 rows=1,030 width=12) (actual time=0.005..0.203 rows=1,030 loops=1)

  • Filter: (NOT nnjl_remove)
56. 2.146 2.146 ↑ 1.0 1 1,073

Index Scan using marcas_pkey on marcas m (cost=0.14..0.18 rows=1 width=12) (actual time=0.002..0.002 rows=1 loops=1,073)

  • Index Cond: (id = ent_5.marca_id)
57. 0.007 0.011 ↑ 1.0 16 1

Hash (cost=1.16..1.16 rows=16 width=36) (actual time=0.011..0.011 rows=16 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
58. 0.004 0.004 ↑ 1.0 16 1

Seq Scan on familias f (cost=0.00..1.16 rows=16 width=36) (actual time=0.003..0.004 rows=16 loops=1)

59. 0.002 0.007 ↑ 1.0 8 1

Hash (cost=1.08..1.08 rows=8 width=36) (actual time=0.007..0.007 rows=8 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
60. 0.005 0.005 ↑ 1.0 8 1

Seq Scan on categorias c (cost=0.00..1.08 rows=8 width=36) (actual time=0.004..0.005 rows=8 loops=1)

61. 0.943 2.331 ↑ 1.0 4,818 1

Hash (cost=130.10..130.10 rows=4,818 width=8) (actual time=2.331..2.331 rows=4,818 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 189kB
62. 1.388 1.388 ↑ 1.0 4,818 1

Seq Scan on productos_pedido pp (cost=0.00..130.10 rows=4,818 width=8) (actual time=0.009..1.388 rows=4,818 loops=1)

  • Filter: (NOT nnjl_remove)
  • Rows Removed by Filter: 292
63. 1.039 548.288 ↓ 1,364.0 1,364 1

Materialize (cost=1,412,094.90..1,412,113.76 rows=1 width=24) (actual time=537.625..548.288 rows=1,364 loops=1)

64. 2.003 547.249 ↓ 1,364.0 1,364 1

Merge Join (cost=1,412,094.90..1,412,113.76 rows=1 width=24) (actual time=537.620..547.249 rows=1,364 loops=1)

  • Merge Cond: (ent_4.id = sub.pedido_id)
65. 2.022 149.286 ↓ 3.8 908 1

Merge Semi Join (cost=469,587.16..469,605.33 rows=239 width=20) (actual time=143.906..149.286 rows=908 loops=1)

  • Merge Cond: (ent_2.pedido_id = ent_4.id)
66. 0.701 2.262 ↓ 1.7 939 1

Sort (cost=112.16..113.51 rows=540 width=12) (actual time=1.828..2.262 rows=939 loops=1)

  • Sort Key: ent_2.pedido_id
  • Sort Method: quicksort Memory: 70kB
67. 0.315 1.561 ↓ 1.8 972 1

Hash Join (cost=54.10..87.65 rows=540 width=12) (actual time=1.061..1.561 rows=972 loops=1)

  • Hash Cond: (ent_2.negociacion_id = ent_3.id)
68. 0.212 0.212 ↑ 1.0 995 1

Seq Scan on negociaciones_pedido ent_2 (cost=0.00..25.21 rows=995 width=8) (actual time=0.008..0.212 rows=995 loops=1)

  • Filter: (NOT nnjl_remove)
  • Rows Removed by Filter: 26
69. 0.382 1.034 ↓ 2.0 1,107 1

Hash (cost=47.17..47.17 rows=554 width=4) (actual time=1.034..1.034 rows=1,107 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 228kB
70. 0.640 0.652 ↓ 2.0 1,107 1

Seq Scan on negociaciones ent_3 (cost=1.24..47.17 rows=554 width=4) (actual time=0.048..0.652 rows=1,107 loops=1)

  • Filter: ((NOT nnjl_remove) AND (NOT (hashed SubPlan 4)))
  • Rows Removed by Filter: 88
71.          

SubPlan (for Seq Scan)

72. 0.012 0.012 ↑ 1.0 7 1

Seq Scan on users users_2 (cost=0.00..1.22 rows=7 width=4) (actual time=0.007..0.012 rows=7 loops=1)

  • Filter: sysadmin
  • Rows Removed by Filter: 15
73. 0.671 145.002 ↓ 2.0 917 1

Materialize (cost=469,474.84..469,487.11 rows=453 width=8) (actual time=142.069..145.002 rows=917 loops=1)

74. 1.555 144.331 ↓ 2.0 917 1

Merge Join (cost=469,474.84..469,485.97 rows=453 width=8) (actual time=142.064..144.331 rows=917 loops=1)

  • Merge Cond: (ent_4.id = pp_1.pedido_id)
75. 0.528 0.939 ↓ 2.0 948 1

Sort (cost=56.84..58.03 rows=475 width=4) (actual time=0.641..0.939 rows=948 loops=1)

  • Sort Key: ent_4.id
  • Sort Method: quicksort Memory: 69kB
76. 0.404 0.411 ↓ 2.0 948 1

Seq Scan on pedidos ent_4 (cost=1.24..35.72 rows=475 width=4) (actual time=0.037..0.411 rows=948 loops=1)

  • Filter: ((NOT nnjl_remove) AND (NOT (hashed SubPlan 5)))
  • Rows Removed by Filter: 51
77.          

SubPlan (for Seq Scan)

78. 0.007 0.007 ↑ 1.0 7 1

Seq Scan on users users_3 (cost=0.00..1.22 rows=7 width=4) (actual time=0.003..0.007 rows=7 loops=1)

  • Filter: sysadmin
  • Rows Removed by Filter: 15
79. 0.665 141.837 ↓ 1.0 919 1

Sort (cost=469,418.00..469,420.24 rows=898 width=4) (actual time=141.420..141.837 rows=919 loops=1)

  • Sort Key: pp_1.pedido_id
  • Sort Method: quicksort Memory: 68kB
80. 1.064 141.172 ↓ 1.0 919 1

HashAggregate (cost=469,364.97..469,373.95 rows=898 width=4) (actual time=141.072..141.172 rows=919 loops=1)

  • Group Key: pp_1.pedido_id
81. 0.979 140.108 ↑ 6.2 4,847 1

Hash Join (cost=204.82..469,289.87 rows=30,038 width=4) (actual time=138.451..140.108 rows=4,847 loops=1)

  • Hash Cond: ("*SELECT* 1_2".producto_id = pp_1.producto_id)
82. 0.079 136.809 ↑ 1.2 1,073 1

Append (cost=14.50..468,452.24 rows=1,303 width=4) (actual time=136.091..136.809 rows=1,073 loops=1)

83. 0.001 0.011 ↓ 0.0 0 1

Subquery Scan on *SELECT* 1_2 (cost=14.50..29.30 rows=240 width=4) (actual time=0.011..0.011 rows=0 loops=1)

84. 0.001 0.010 ↓ 0.0 0 1

Result (cost=14.50..26.90 rows=240 width=309) (actual time=0.010..0.010 rows=0 loops=1)

  • One-Time Filter: ($86 IS NOT NULL)
85.          

Initplan (for Result)

86. 0.009 0.009 ↓ 0.0 0 1

Seq Scan on materialized_views mv_14 (cost=0.00..14.50 rows=1 width=4) (actual time=0.009..0.009 rows=0 loops=1)

  • Filter: (active AND ((matviewname)::text = 'vism_bi_productos'::text))
  • Rows Removed by Filter: 33
87. 0.000 0.000 ↓ 0.0 0

Seq Scan on vism_bi_productos visbi_1 (cost=0.00..12.40 rows=240 width=309) (never executed)

88. 0.112 136.719 ↓ 1.0 1,073 1

Subquery Scan on *SELECT* 2_2 (cost=468,385.74..468,422.94 rows=1,063 width=4) (actual time=136.079..136.719 rows=1,073 loops=1)

89. 0.169 136.607 ↓ 1.0 1,073 1

Result (cost=468,385.74..468,412.31 rows=1,063 width=309) (actual time=136.078..136.607 rows=1,073 loops=1)

  • One-Time Filter: ($87 IS NOT NULL)
90.          

Initplan (for Result)

91. 0.013 0.013 ↑ 1.0 1 1

Seq Scan on materialized_views mv_15 (cost=0.00..14.50 rows=1 width=4) (actual time=0.009..0.013 rows=1 loops=1)

  • Filter: ((NOT active) AND ((matviewname)::text = 'vism_bi_productos'::text))
  • Rows Removed by Filter: 32
92. 2.923 136.425 ↓ 1.0 1,073 1

HashAggregate (cost=468,371.24..468,387.18 rows=1,063 width=293) (actual time=136.061..136.425 rows=1,073 loops=1)

  • Group Key: (clock_timestamp())::timestamp without time zone, ent_7.empresa_id, ent_7.id, ent_7.cod_ext, ent_7.descripcion, ent_7.precio, ent_7.precio_distribuidor, CASE WHEN (ent_7.precio_distribuidor IS NOT NULL) THEN ent_7.precio_distribuidor ELSE ent_7.precio END, ent_7.modulos, c_1.id, c_1.nombre, m_1.id, m_1.nombre, f_1.id, f_1.nombre, ent_7.personalizacion, ((json_object_agg(npf_1.nombre, CASE WHEN ((NULLIF(lower(NULLIF(replace((((ent_8.personalizacion)::json -> (npf_1.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) IS NOT NULL) AND (((npf_1.tipo)::text = 'select'::text) OR ((npf_1.tipo)::text = 'select_mandatory'::text) OR ((npf_1.tipo)::text = 'select_readonly'::text)) AND (NULLIF(lower(NULLIF(replace((((ent_8.personalizacion)::json -> (npf_1.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) ~ '^[0-9]'::text)) THEN (SubPlan 45) WHEN ((NULLIF(lower(NULLIF(replace((((ent_8.personalizacion)::json -> (npf_1.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) IS NOT NULL) AND ((npf_1.tipo)::text = 'selectmultiple'::text) AND (NULLIF(lower(NULLIF(replace((((ent_8.personalizacion)::json -> (npf_1.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) ~ '^[0-9]'::text)) THEN (array_to_string((SubPlan 46), ','::text))::character varying WHEN ((NULLIF(lower(NULLIF(replace((((ent_8.personalizacion)::json -> (npf_1.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) IS NOT NULL) AND ((npf_1.tipo)::text ~~* 'selectreference%'::text) AND ((npf_1.nombre)::text = 'distribuidor'::text) AND (NULLIF(lower(NULLIF(replace((((ent_8.personalizacion)::json -> (npf_1.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) ~ '^[0-9]'::text)) THEN (SubPlan 47) WHEN (NULLIF(lower(NULLIF(replace((((ent_8.personalizacion)::json -> (npf_1.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) IS NOT NULL) THEN (NULLIF(lower(NULLIF(replace((((ent_8.personalizacion)::json -> (npf_1.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text))::character varying ELSE NULL::character varying END))::text), ent_7.nnjl_remove
93. 1.291 133.502 ↓ 1.0 1,073 1

Hash Left Join (cost=353.11..468,323.40 rows=1,063 width=293) (actual time=7.866..133.502 rows=1,073 loops=1)

  • Hash Cond: (pc_3.categoria_id = c_1.id)
94. 0.498 132.205 ↓ 1.0 1,073 1

Hash Left Join (cost=351.93..468,312.49 rows=1,063 width=261) (actual time=7.832..132.205 rows=1,073 loops=1)

  • Hash Cond: (ent_7.familia_id = f_1.id)
95. 1.108 131.693 ↓ 1.0 1,073 1

Nested Loop Left Join (cost=350.57..468,296.52 rows=1,063 width=229) (actual time=7.797..131.693 rows=1,073 loops=1)

96. 0.669 128.439 ↓ 1.0 1,073 1

Hash Left Join (cost=350.42..468,097.15 rows=1,063 width=221) (actual time=7.787..128.439 rows=1,073 loops=1)

  • Hash Cond: (ent_7.id = pc_3.producto_id)
97. 1.269 126.868 ↑ 1.0 1,063 1

Merge Left Join (cost=289.25..467,887.58 rows=1,063 width=217) (actual time=6.872..126.868 rows=1,063 loops=1)

  • Merge Cond: (ent_7.id = ent_8.id)
98. 0.871 0.871 ↑ 1.0 1,063 1

Index Scan using productos_pkey on productos ent_7 (cost=0.28..152.01 rows=1,063 width=185) (actual time=0.009..0.871 rows=1,063 loops=1)

99. 0.431 124.728 ↓ 1.0 1,058 1

Materialize (cost=288.97..467,719.70 rows=1,057 width=36) (actual time=6.859..124.728 rows=1,058 loops=1)

100. 103.723 124.297 ↓ 1.0 1,058 1

GroupAggregate (cost=288.97..467,706.49 rows=1,057 width=120) (actual time=6.854..124.297 rows=1,058 loops=1)

  • Group Key: ent_8.id
101. 4.269 7.758 ↓ 2.9 6,408 1

Sort (cost=288.97..294.51 rows=2,217 width=120) (actual time=6.640..7.758 rows=6,408 loops=1)

  • Sort Key: ent_8.id
  • Sort Method: quicksort Memory: 1,640kB
102. 1.301 3.489 ↓ 2.9 6,408 1

Hash Join (cost=98.66..165.77 rows=2,217 width=120) (actual time=1.668..3.489 rows=6,408 loops=1)

  • Hash Cond: (ent_8.empresa_id = npf_1.empresa_id)
103. 0.394 2.007 ↓ 1.0 1,068 1

Hash Right Join (cost=94.53..128.89 rows=1,057 width=92) (actual time=1.464..2.007 rows=1,068 loops=1)

  • Hash Cond: (pc_4.producto_id = ent_8.id)
104. 0.473 0.701 ↓ 1.0 1,030 1

HashAggregate (cost=28.02..38.23 rows=1,020 width=12) (actual time=0.533..0.701 rows=1,030 loops=1)

  • Group Key: pc_4.empresa_id, pc_4.producto_id, pc_4.categoria_id
105. 0.228 0.228 ↑ 1.0 1,030 1

Seq Scan on productos_categoria pc_4 (cost=0.00..20.30 rows=1,030 width=12) (actual time=0.011..0.228 rows=1,030 loops=1)

  • Filter: (NOT nnjl_remove)
106. 0.401 0.912 ↓ 1.0 1,058 1

Hash (cost=53.29..53.29 rows=1,057 width=92) (actual time=0.912..0.912 rows=1,058 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 131kB
107. 0.511 0.511 ↓ 1.0 1,058 1

Seq Scan on productos ent_8 (cost=0.00..53.29 rows=1,057 width=92) (actual time=0.010..0.511 rows=1,058 loops=1)

  • Filter: ((personalizacion IS NOT NULL) AND ((personalizacion)::text <> ''::text))
  • Rows Removed by Filter: 5
108. 0.003 0.181 ↑ 1.0 6 1

Hash (cost=4.06..4.06 rows=6 width=32) (actual time=0.181..0.181 rows=6 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
109. 0.178 0.178 ↑ 1.0 6 1

Seq Scan on nnmas_personal_fields npf_1 (cost=0.00..4.06 rows=6 width=32) (actual time=0.039..0.178 rows=6 loops=1)

  • Filter: ((NOT nnjl_remove) AND (descripcion IS NOT NULL) AND ((descripcion)::text <> ''::text) AND ((tipo)::text !~~* 'nnmas_images%'::text) AND ((tipo)::text !~~* 'textarea%'::text) AND ((tabla)::text = 'productos'::text))
  • Rows Removed by Filter: 97
110.          

SubPlan (for GroupAggregate)

111. 12.816 12.816 ↑ 1.0 1 4,272

Index Scan using nnmas_selects_pkey on nnmas_selects nnmas_selects_12 (cost=0.31..8.33 rows=1 width=17) (actual time=0.003..0.003 rows=1 loops=4,272)

  • Index Cond: (id = (NULLIF(lower(NULLIF(replace((((ent_8.personalizacion)::json -> (npf_1.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text))::integer)
  • Filter: (empresa_id = ent_8.empresa_id)
112. 0.000 0.000 ↓ 0.0 0

Seq Scan on nnmas_selects nnmas_selects_13 (cost=0.00..193.92 rows=126 width=17) (never executed)

  • Filter: ((empresa_id = ent_8.empresa_id) AND ((id)::text = ANY (string_to_array(NULLIF(lower(NULLIF(replace((((ent_8.personalizacion)::json -> (npf_1.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text), ','::text))))
113. 0.000 0.000 ↓ 0.0 0

Seq Scan on distribuidores d_6 (cost=0.00..8.32 rows=1 width=22) (never executed)

  • Filter: ((empresa_id = ent_8.empresa_id) AND (id = (NULLIF(lower(NULLIF(replace((((ent_8.personalizacion)::json -> (npf_1.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text))::integer))
114. 0.196 0.902 ↓ 1.0 1,030 1

Hash (cost=48.43..48.43 rows=1,020 width=8) (actual time=0.902..0.902 rows=1,030 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 41kB
115. 0.119 0.706 ↓ 1.0 1,030 1

Subquery Scan on pc_3 (cost=28.02..48.43 rows=1,020 width=8) (actual time=0.462..0.706 rows=1,030 loops=1)

116. 0.391 0.587 ↓ 1.0 1,030 1

HashAggregate (cost=28.02..38.23 rows=1,020 width=12) (actual time=0.461..0.587 rows=1,030 loops=1)

  • Group Key: pc_5.empresa_id, pc_5.producto_id, pc_5.categoria_id
117. 0.196 0.196 ↑ 1.0 1,030 1

Seq Scan on productos_categoria pc_5 (cost=0.00..20.30 rows=1,030 width=12) (actual time=0.004..0.196 rows=1,030 loops=1)

  • Filter: (NOT nnjl_remove)
118. 2.146 2.146 ↑ 1.0 1 1,073

Index Scan using marcas_pkey on marcas m_1 (cost=0.14..0.18 rows=1 width=12) (actual time=0.002..0.002 rows=1 loops=1,073)

  • Index Cond: (id = ent_7.marca_id)
119. 0.007 0.014 ↑ 1.0 16 1

Hash (cost=1.16..1.16 rows=16 width=36) (actual time=0.014..0.014 rows=16 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
120. 0.007 0.007 ↑ 1.0 16 1

Seq Scan on familias f_1 (cost=0.00..1.16 rows=16 width=36) (actual time=0.004..0.007 rows=16 loops=1)

121. 0.002 0.006 ↑ 1.0 8 1

Hash (cost=1.08..1.08 rows=8 width=36) (actual time=0.006..0.006 rows=8 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
122. 0.004 0.004 ↑ 1.0 8 1

Seq Scan on categorias c_1 (cost=0.00..1.08 rows=8 width=36) (actual time=0.003..0.004 rows=8 loops=1)

123. 1.032 2.320 ↑ 1.0 4,818 1

Hash (cost=130.10..130.10 rows=4,818 width=8) (actual time=2.320..2.320 rows=4,818 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 189kB
124. 1.288 1.288 ↑ 1.0 4,818 1

Seq Scan on productos_pedido pp_1 (cost=0.00..130.10 rows=4,818 width=8) (actual time=0.009..1.288 rows=4,818 loops=1)

  • Filter: (NOT nnjl_remove)
  • Rows Removed by Filter: 292
125. 1.171 395.960 ↓ 276.0 1,380 1

Materialize (cost=942,507.73..942,507.81 rows=5 width=4) (actual time=393.706..395.960 rows=1,380 loops=1)

126. 1.813 394.789 ↓ 276.0 1,380 1

Sort (cost=942,507.73..942,507.75 rows=5 width=56) (actual time=393.699..394.789 rows=1,380 loops=1)

  • Sort Key: sub.pedido_id, sub.ae_nombre, sub.total_imp_sum
  • Sort Method: quicksort Memory: 156kB
127. 0.315 392.976 ↓ 276.0 1,380 1

Subquery Scan on sub (cost=942,507.19..942,507.68 rows=5 width=56) (actual time=391.471..392.976 rows=1,380 loops=1)

  • Filter: (sub.rn <= 2)
  • Rows Removed by Filter: 409
128. 1.114 392.661 ↓ 119.3 1,789 1

WindowAgg (cost=942,507.19..942,507.49 rows=15 width=56) (actual time=391.454..392.661 rows=1,789 loops=1)

129. 0.988 391.547 ↓ 119.3 1,789 1

Sort (cost=942,507.19..942,507.23 rows=15 width=56) (actual time=391.445..391.547 rows=1,789 loops=1)

  • Sort Key: pp_2.pedido_id, (max((sum(pp_2.total))))
  • Sort Method: quicksort Memory: 198kB
130. 1.174 390.559 ↓ 119.3 1,789 1

HashAggregate (cost=942,506.75..942,506.90 rows=15 width=56) (actual time=390.281..390.559 rows=1,789 loops=1)

  • Group Key: pp_2.pedido_id, oae.id, oae.nombre, sum(pp_2.total), sum(pp_2.cajas)
131. 2.222 389.385 ↓ 119.3 1,789 1

HashAggregate (cost=942,506.22..942,506.37 rows=15 width=52) (actual time=389.038..389.385 rows=1,789 loops=1)

  • Group Key: pp_2.pedido_id, oae.id, oae.nombre
132. 1.351 387.163 ↓ 264.4 3,966 1

Hash Join (cost=473,682.19..942,506.03 rows=15 width=52) (actual time=297.739..387.163 rows=3,966 loops=1)

  • Hash Cond: ("*SELECT* 1_3".producto_id = pp_2.producto_id)
  • Join Filter: ((sub_1.pedido_producto_categoria_id IS NULL) OR ("*SELECT* 1_3".producto_categoria_id = sub_1.pedido_producto_categoria_id))
  • Rows Removed by Join Filter: 13
133. 55.718 224.388 ↓ 14.2 483 1

Nested Loop (cost=15.86..468,802.87 rows=34 width=48) (actual time=136.094..224.388 rows=483 loops=1)

  • Join Filter: (oaee.entidad_id = "*SELECT* 1_3".producto_id)
  • Rows Removed by Join Filter: 511,338
134. 0.088 140.772 ↑ 1.2 1,073 1

Append (cost=14.50..468,452.24 rows=1,303 width=8) (actual time=135.610..140.772 rows=1,073 loops=1)

135. 0.000 0.011 ↓ 0.0 0 1

Subquery Scan on *SELECT* 1_3 (cost=14.50..29.30 rows=240 width=8) (actual time=0.011..0.011 rows=0 loops=1)

136. 0.003 0.011 ↓ 0.0 0 1

Result (cost=14.50..26.90 rows=240 width=309) (actual time=0.011..0.011 rows=0 loops=1)

  • One-Time Filter: ($17 IS NOT NULL)
137.          

Initplan (for Result)

138. 0.008 0.008 ↓ 0.0 0 1

Seq Scan on materialized_views mv_2 (cost=0.00..14.50 rows=1 width=4) (actual time=0.008..0.008 rows=0 loops=1)

  • Filter: (active AND ((matviewname)::text = 'vism_bi_productos'::text))
  • Rows Removed by Filter: 33
139. 0.000 0.000 ↓ 0.0 0

Seq Scan on vism_bi_productos visbi_2 (cost=0.00..12.40 rows=240 width=309) (never executed)

140. 0.162 140.673 ↓ 1.0 1,073 1

Subquery Scan on *SELECT* 2_3 (cost=468,385.74..468,422.94 rows=1,063 width=8) (actual time=135.598..140.673 rows=1,073 loops=1)

141. 0.160 140.511 ↓ 1.0 1,073 1

Result (cost=468,385.74..468,412.31 rows=1,063 width=309) (actual time=135.598..140.511 rows=1,073 loops=1)

  • One-Time Filter: ($18 IS NOT NULL)
142.          

Initplan (for Result)

143. 0.014 0.014 ↑ 1.0 1 1

Seq Scan on materialized_views mv_3 (cost=0.00..14.50 rows=1 width=4) (actual time=0.009..0.014 rows=1 loops=1)

  • Filter: ((NOT active) AND ((matviewname)::text = 'vism_bi_productos'::text))
  • Rows Removed by Filter: 32
144. 7.317 140.337 ↓ 1.0 1,073 1

HashAggregate (cost=468,371.24..468,387.18 rows=1,063 width=293) (actual time=135.580..140.337 rows=1,073 loops=1)

  • Group Key: (clock_timestamp())::timestamp without time zone, ent_9.empresa_id, ent_9.id, ent_9.cod_ext, ent_9.descripcion, ent_9.precio, ent_9.precio_distribuidor, CASE WHEN (ent_9.precio_distribuidor IS NOT NULL) THEN ent_9.precio_distribuidor ELSE ent_9.precio END, ent_9.modulos, c_2.id, c_2.nombre, m_2.id, m_2.nombre, f_2.id, f_2.nombre, ent_9.personalizacion, ((json_object_agg(npf_2.nombre, CASE WHEN ((NULLIF(lower(NULLIF(replace((((ent_10.personalizacion)::json -> (npf_2.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) IS NOT NULL) AND (((npf_2.tipo)::text = 'select'::text) OR ((npf_2.tipo)::text = 'select_mandatory'::text) OR ((npf_2.tipo)::text = 'select_readonly'::text)) AND (NULLIF(lower(NULLIF(replace((((ent_10.personalizacion)::json -> (npf_2.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) ~ '^[0-9]'::text)) THEN (SubPlan 13) WHEN ((NULLIF(lower(NULLIF(replace((((ent_10.personalizacion)::json -> (npf_2.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) IS NOT NULL) AND ((npf_2.tipo)::text = 'selectmultiple'::text) AND (NULLIF(lower(NULLIF(replace((((ent_10.personalizacion)::json -> (npf_2.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) ~ '^[0-9]'::text)) THEN (array_to_string((SubPlan 14), ','::text))::character varying WHEN ((NULLIF(lower(NULLIF(replace((((ent_10.personalizacion)::json -> (npf_2.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) IS NOT NULL) AND ((npf_2.tipo)::text ~~* 'selectreference%'::text) AND ((npf_2.nombre)::text = 'distribuidor'::text) AND (NULLIF(lower(NULLIF(replace((((ent_10.personalizacion)::json -> (npf_2.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) ~ '^[0-9]'::text)) THEN (SubPlan 15) WHEN (NULLIF(lower(NULLIF(replace((((ent_10.personalizacion)::json -> (npf_2.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) IS NOT NULL) THEN (NULLIF(lower(NULLIF(replace((((ent_10.personalizacion)::json -> (npf_2.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text))::character varying ELSE NULL::character varying END))::text), ent_9.nnjl_remove
145. 1.299 133.020 ↓ 1.0 1,073 1

Hash Left Join (cost=353.11..468,323.40 rows=1,063 width=293) (actual time=7.892..133.020 rows=1,073 loops=1)

  • Hash Cond: (pc_6.categoria_id = c_2.id)
146. 0.519 131.712 ↓ 1.0 1,073 1

Hash Left Join (cost=351.93..468,312.49 rows=1,063 width=261) (actual time=7.857..131.712 rows=1,073 loops=1)

  • Hash Cond: (ent_9.familia_id = f_2.id)
147. 1.090 131.176 ↓ 1.0 1,073 1

Nested Loop Left Join (cost=350.57..468,296.52 rows=1,063 width=229) (actual time=7.818..131.176 rows=1,073 loops=1)

148. 0.620 127.940 ↓ 1.0 1,073 1

Hash Left Join (cost=350.42..468,097.15 rows=1,063 width=221) (actual time=7.808..127.940 rows=1,073 loops=1)

  • Hash Cond: (ent_9.id = pc_6.producto_id)
149. 1.279 126.393 ↑ 1.0 1,063 1

Merge Left Join (cost=289.25..467,887.58 rows=1,063 width=217) (actual time=6.869..126.393 rows=1,063 loops=1)

  • Merge Cond: (ent_9.id = ent_10.id)
150. 0.880 0.880 ↑ 1.0 1,063 1

Index Scan using productos_pkey on productos ent_9 (cost=0.28..152.01 rows=1,063 width=185) (actual time=0.009..0.880 rows=1,063 loops=1)

151. 0.486 124.234 ↓ 1.0 1,058 1

Materialize (cost=288.97..467,719.70 rows=1,057 width=36) (actual time=6.857..124.234 rows=1,058 loops=1)

152. 103.158 123.748 ↓ 1.0 1,058 1

GroupAggregate (cost=288.97..467,706.49 rows=1,057 width=120) (actual time=6.852..123.748 rows=1,058 loops=1)

  • Group Key: ent_10.id
153. 4.309 7.774 ↓ 2.9 6,408 1

Sort (cost=288.97..294.51 rows=2,217 width=120) (actual time=6.648..7.774 rows=6,408 loops=1)

  • Sort Key: ent_10.id
  • Sort Method: quicksort Memory: 1,640kB
154. 1.348 3.465 ↓ 2.9 6,408 1

Hash Join (cost=98.66..165.77 rows=2,217 width=120) (actual time=1.576..3.465 rows=6,408 loops=1)

  • Hash Cond: (ent_10.empresa_id = npf_2.empresa_id)
155. 0.397 1.936 ↓ 1.0 1,068 1

Hash Right Join (cost=94.53..128.89 rows=1,057 width=92) (actual time=1.375..1.936 rows=1,068 loops=1)

  • Hash Cond: (pc_7.producto_id = ent_10.id)
156. 0.496 0.708 ↓ 1.0 1,030 1

HashAggregate (cost=28.02..38.23 rows=1,020 width=12) (actual time=0.524..0.708 rows=1,030 loops=1)

  • Group Key: pc_7.empresa_id, pc_7.producto_id, pc_7.categoria_id
157. 0.212 0.212 ↑ 1.0 1,030 1

Seq Scan on productos_categoria pc_7 (cost=0.00..20.30 rows=1,030 width=12) (actual time=0.005..0.212 rows=1,030 loops=1)

  • Filter: (NOT nnjl_remove)
158. 0.351 0.831 ↓ 1.0 1,058 1

Hash (cost=53.29..53.29 rows=1,057 width=92) (actual time=0.831..0.831 rows=1,058 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 131kB
159. 0.480 0.480 ↓ 1.0 1,058 1

Seq Scan on productos ent_10 (cost=0.00..53.29 rows=1,057 width=92) (actual time=0.012..0.480 rows=1,058 loops=1)

  • Filter: ((personalizacion IS NOT NULL) AND ((personalizacion)::text <> ''::text))
  • Rows Removed by Filter: 5
160. 0.004 0.181 ↑ 1.0 6 1

Hash (cost=4.06..4.06 rows=6 width=32) (actual time=0.181..0.181 rows=6 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
161. 0.177 0.177 ↑ 1.0 6 1

Seq Scan on nnmas_personal_fields npf_2 (cost=0.00..4.06 rows=6 width=32) (actual time=0.031..0.177 rows=6 loops=1)

  • Filter: ((NOT nnjl_remove) AND (descripcion IS NOT NULL) AND ((descripcion)::text <> ''::text) AND ((tipo)::text !~~* 'nnmas_images%'::text) AND ((tipo)::text !~~* 'textarea%'::text) AND ((tabla)::text = 'productos'::text))
  • Rows Removed by Filter: 97
162.          

SubPlan (for GroupAggregate)

163. 12.816 12.816 ↑ 1.0 1 4,272

Index Scan using nnmas_selects_pkey on nnmas_selects nnmas_selects_2 (cost=0.31..8.33 rows=1 width=17) (actual time=0.003..0.003 rows=1 loops=4,272)

  • Index Cond: (id = (NULLIF(lower(NULLIF(replace((((ent_10.personalizacion)::json -> (npf_2.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text))::integer)
  • Filter: (empresa_id = ent_10.empresa_id)
164. 0.000 0.000 ↓ 0.0 0

Seq Scan on nnmas_selects nnmas_selects_3 (cost=0.00..193.92 rows=126 width=17) (never executed)

  • Filter: ((empresa_id = ent_10.empresa_id) AND ((id)::text = ANY (string_to_array(NULLIF(lower(NULLIF(replace((((ent_10.personalizacion)::json -> (npf_2.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text), ','::text))))
165. 0.000 0.000 ↓ 0.0 0

Seq Scan on distribuidores d_1 (cost=0.00..8.32 rows=1 width=22) (never executed)

  • Filter: ((empresa_id = ent_10.empresa_id) AND (id = (NULLIF(lower(NULLIF(replace((((ent_10.personalizacion)::json -> (npf_2.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text))::integer))
166. 0.220 0.927 ↓ 1.0 1,030 1

Hash (cost=48.43..48.43 rows=1,020 width=8) (actual time=0.927..0.927 rows=1,030 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 41kB
167. 0.112 0.707 ↓ 1.0 1,030 1

Subquery Scan on pc_6 (cost=28.02..48.43 rows=1,020 width=8) (actual time=0.471..0.707 rows=1,030 loops=1)

168. 0.389 0.595 ↓ 1.0 1,030 1

HashAggregate (cost=28.02..38.23 rows=1,020 width=12) (actual time=0.471..0.595 rows=1,030 loops=1)

  • Group Key: pc_8.empresa_id, pc_8.producto_id, pc_8.categoria_id
169. 0.206 0.206 ↑ 1.0 1,030 1

Seq Scan on productos_categoria pc_8 (cost=0.00..20.30 rows=1,030 width=12) (actual time=0.005..0.206 rows=1,030 loops=1)

  • Filter: (NOT nnjl_remove)
170. 2.146 2.146 ↑ 1.0 1 1,073

Index Scan using marcas_pkey on marcas m_2 (cost=0.14..0.18 rows=1 width=12) (actual time=0.002..0.002 rows=1 loops=1,073)

  • Index Cond: (id = ent_9.marca_id)
171. 0.009 0.017 ↑ 1.0 16 1

Hash (cost=1.16..1.16 rows=16 width=36) (actual time=0.017..0.017 rows=16 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
172. 0.008 0.008 ↑ 1.0 16 1

Seq Scan on familias f_2 (cost=0.00..1.16 rows=16 width=36) (actual time=0.005..0.008 rows=16 loops=1)

173. 0.004 0.009 ↑ 1.0 8 1

Hash (cost=1.08..1.08 rows=8 width=36) (actual time=0.009..0.009 rows=8 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
174. 0.005 0.005 ↑ 1.0 8 1

Seq Scan on categorias c_2 (cost=0.00..1.08 rows=8 width=36) (actual time=0.004..0.005 rows=8 loops=1)

175. 27.591 27.898 ↓ 28.1 477 1,073

Materialize (cost=1.36..18.41 rows=17 width=40) (actual time=0.000..0.026 rows=477 loops=1,073)

176. 0.145 0.307 ↓ 28.1 477 1

Hash Join (cost=1.36..18.32 rows=17 width=40) (actual time=0.065..0.307 rows=477 loops=1)

  • Hash Cond: (oaee.objetivo_agrupacion_entidad_id = oae.id)
177. 0.138 0.138 ↑ 1.0 477 1

Seq Scan on objetivo_agrupacion_entidades_entidad oaee (cost=0.00..15.00 rows=477 width=8) (actual time=0.018..0.138 rows=477 loops=1)

  • Filter: (NOT nnjl_remove)
  • Rows Removed by Filter: 223
178. 0.007 0.024 ↓ 13.0 13 1

Hash (cost=1.35..1.35 rows=1 width=36) (actual time=0.024..0.024 rows=13 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
179. 0.017 0.017 ↓ 13.0 13 1

Seq Scan on objetivo_agrupacion_entidades oae (cost=0.00..1.35 rows=1 width=36) (actual time=0.012..0.017 rows=13 loops=1)

  • Filter: ((NOT nnjl_remove) AND ((tabla)::text = 'productos'::text))
  • Rows Removed by Filter: 15
180. 1.245 161.424 ↑ 2.0 4,818 1

Hash (cost=473,548.31..473,548.31 rows=9,441 width=24) (actual time=161.424..161.424 rows=4,818 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 264kB
181. 1.948 160.179 ↑ 2.0 4,818 1

Hash Join (cost=472,390.05..473,548.31 rows=9,441 width=24) (actual time=152.868..160.179 rows=4,818 loops=1)

  • Hash Cond: (sub_1.id = pp_2.id)
182. 0.817 155.832 ↑ 2.1 4,818 1

Subquery Scan on sub_1 (cost=472,199.73..473,175.96 rows=10,013 width=8) (actual time=150.452..155.832 rows=4,818 loops=1)

  • Filter: (sub_1.rn <= 1)
  • Rows Removed by Filter: 29
183. 4.251 155.015 ↑ 6.2 4,847 1

WindowAgg (cost=472,199.73..472,800.49 rows=30,038 width=16) (actual time=150.448..155.015 rows=4,847 loops=1)

184. 2.259 150.764 ↑ 6.2 4,847 1

Sort (cost=472,199.73..472,274.82 rows=30,038 width=16) (actual time=150.441..150.764 rows=4,847 loops=1)

  • Sort Key: pp_3.id, (min("*SELECT* 1_4".producto_categoria_id))
  • Sort Method: quicksort Memory: 565kB
185. 2.690 148.505 ↑ 6.2 4,847 1

HashAggregate (cost=469,665.35..469,965.73 rows=30,038 width=16) (actual time=147.711..148.505 rows=4,847 loops=1)

  • Group Key: pp_3.id, pp_3.pedido_id, pp_3.producto_id, "*SELECT* 1_4".producto_categoria_id
186. 1.009 145.815 ↑ 6.2 4,847 1

Hash Join (cost=204.82..469,289.87 rows=30,038 width=16) (actual time=143.976..145.815 rows=4,847 loops=1)

  • Hash Cond: ("*SELECT* 1_4".producto_id = pp_3.producto_id)
187. 0.078 142.579 ↑ 1.2 1,073 1

Append (cost=14.50..468,452.24 rows=1,303 width=8) (actual time=141.715..142.579 rows=1,073 loops=1)

188. 0.001 0.011 ↓ 0.0 0 1

Subquery Scan on *SELECT* 1_4 (cost=14.50..29.30 rows=240 width=8) (actual time=0.011..0.011 rows=0 loops=1)

189. 0.002 0.010 ↓ 0.0 0 1

Result (cost=14.50..26.90 rows=240 width=309) (actual time=0.010..0.010 rows=0 loops=1)

  • One-Time Filter: ($5 IS NOT NULL)
190.          

Initplan (for Result)

191. 0.008 0.008 ↓ 0.0 0 1

Seq Scan on materialized_views mv (cost=0.00..14.50 rows=1 width=4) (actual time=0.008..0.008 rows=0 loops=1)

  • Filter: (active AND ((matviewname)::text = 'vism_bi_productos'::text))
  • Rows Removed by Filter: 33
192. 0.000 0.000 ↓ 0.0 0

Seq Scan on vism_bi_productos visbi_3 (cost=0.00..12.40 rows=240 width=309) (never executed)

193. 0.112 142.490 ↓ 1.0 1,073 1

Subquery Scan on *SELECT* 2_4 (cost=468,385.74..468,422.94 rows=1,063 width=8) (actual time=141.704..142.490 rows=1,073 loops=1)

194. 0.160 142.378 ↓ 1.0 1,073 1

Result (cost=468,385.74..468,412.31 rows=1,063 width=309) (actual time=141.702..142.378 rows=1,073 loops=1)

  • One-Time Filter: ($6 IS NOT NULL)
195.          

Initplan (for Result)

196. 0.014 0.014 ↑ 1.0 1 1

Seq Scan on materialized_views mv_1 (cost=0.00..14.50 rows=1 width=4) (actual time=0.009..0.014 rows=1 loops=1)

  • Filter: ((NOT active) AND ((matviewname)::text = 'vism_bi_productos'::text))
  • Rows Removed by Filter: 32
197. 3.104 142.204 ↓ 1.0 1,073 1

HashAggregate (cost=468,371.24..468,387.18 rows=1,063 width=293) (actual time=141.686..142.204 rows=1,073 loops=1)

  • Group Key: (clock_timestamp())::timestamp without time zone, ent_11.empresa_id, ent_11.id, ent_11.cod_ext, ent_11.descripcion, ent_11.precio, ent_11.precio_distribuidor, CASE WHEN (ent_11.precio_distribuidor IS NOT NULL) THEN ent_11.precio_distribuidor ELSE ent_11.precio END, ent_11.modulos, c_3.id, c_3.nombre, m_3.id, m_3.nombre, f_3.id, f_3.nombre, ent_11.personalizacion, ((json_object_agg(npf_3.nombre, CASE WHEN ((NULLIF(lower(NULLIF(replace((((ent_12.personalizacion)::json -> (npf_3.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) IS NOT NULL) AND (((npf_3.tipo)::text = 'select'::text) OR ((npf_3.tipo)::text = 'select_mandatory'::text) OR ((npf_3.tipo)::text = 'select_readonly'::text)) AND (NULLIF(lower(NULLIF(replace((((ent_12.personalizacion)::json -> (npf_3.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) ~ '^[0-9]'::text)) THEN (SubPlan 8) WHEN ((NULLIF(lower(NULLIF(replace((((ent_12.personalizacion)::json -> (npf_3.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) IS NOT NULL) AND ((npf_3.tipo)::text = 'selectmultiple'::text) AND (NULLIF(lower(NULLIF(replace((((ent_12.personalizacion)::json -> (npf_3.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) ~ '^[0-9]'::text)) THEN (array_to_string((SubPlan 9), ','::text))::character varying WHEN ((NULLIF(lower(NULLIF(replace((((ent_12.personalizacion)::json -> (npf_3.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) IS NOT NULL) AND ((npf_3.tipo)::text ~~* 'selectreference%'::text) AND ((npf_3.nombre)::text = 'distribuidor'::text) AND (NULLIF(lower(NULLIF(replace((((ent_12.personalizacion)::json -> (npf_3.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) ~ '^[0-9]'::text)) THEN (SubPlan 10) WHEN (NULLIF(lower(NULLIF(replace((((ent_12.personalizacion)::json -> (npf_3.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) IS NOT NULL) THEN (NULLIF(lower(NULLIF(replace((((ent_12.personalizacion)::json -> (npf_3.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text))::character varying ELSE NULL::character varying END))::text), ent_11.nnjl_remove
198. 1.339 139.100 ↓ 1.0 1,073 1

Hash Left Join (cost=353.11..468,323.40 rows=1,063 width=293) (actual time=7.757..139.100 rows=1,073 loops=1)

  • Hash Cond: (pc_9.categoria_id = c_3.id)
199. 0.529 137.754 ↓ 1.0 1,073 1

Hash Left Join (cost=351.93..468,312.49 rows=1,063 width=261) (actual time=7.722..137.754 rows=1,073 loops=1)

  • Hash Cond: (ent_11.familia_id = f_3.id)
200. 1.022 137.215 ↓ 1.0 1,073 1

Nested Loop Left Join (cost=350.57..468,296.52 rows=1,063 width=229) (actual time=7.687..137.215 rows=1,073 loops=1)

201. 4.748 134.047 ↓ 1.0 1,073 1

Hash Left Join (cost=350.42..468,097.15 rows=1,063 width=221) (actual time=7.679..134.047 rows=1,073 loops=1)

  • Hash Cond: (ent_11.id = pc_9.producto_id)
202. 1.355 128.404 ↑ 1.0 1,063 1

Merge Left Join (cost=289.25..467,887.58 rows=1,063 width=217) (actual time=6.773..128.404 rows=1,063 loops=1)

  • Merge Cond: (ent_11.id = ent_12.id)
203. 0.898 0.898 ↑ 1.0 1,063 1

Index Scan using productos_pkey on productos ent_11 (cost=0.28..152.01 rows=1,063 width=185) (actual time=0.014..0.898 rows=1,063 loops=1)

204. 0.501 126.151 ↓ 1.0 1,058 1

Materialize (cost=288.97..467,719.70 rows=1,057 width=36) (actual time=6.756..126.151 rows=1,058 loops=1)

205. 100.686 125.650 ↓ 1.0 1,058 1

GroupAggregate (cost=288.97..467,706.49 rows=1,057 width=120) (actual time=6.745..125.650 rows=1,058 loops=1)

  • Group Key: ent_12.id
206. 4.507 7.876 ↓ 2.9 6,408 1

Sort (cost=288.97..294.51 rows=2,217 width=120) (actual time=6.540..7.876 rows=6,408 loops=1)

  • Sort Key: ent_12.id
  • Sort Method: quicksort Memory: 1,640kB
207. 1.328 3.369 ↓ 2.9 6,408 1

Hash Join (cost=98.66..165.77 rows=2,217 width=120) (actual time=1.538..3.369 rows=6,408 loops=1)

  • Hash Cond: (ent_12.empresa_id = npf_3.empresa_id)
208. 0.401 1.865 ↓ 1.0 1,068 1

Hash Right Join (cost=94.53..128.89 rows=1,057 width=92) (actual time=1.336..1.865 rows=1,068 loops=1)

  • Hash Cond: (pc_10.producto_id = ent_12.id)
209. 0.453 0.660 ↓ 1.0 1,030 1

HashAggregate (cost=28.02..38.23 rows=1,020 width=12) (actual time=0.509..0.660 rows=1,030 loops=1)

  • Group Key: pc_10.empresa_id, pc_10.producto_id, pc_10.categoria_id
210. 0.207 0.207 ↑ 1.0 1,030 1

Seq Scan on productos_categoria pc_10 (cost=0.00..20.30 rows=1,030 width=12) (actual time=0.010..0.207 rows=1,030 loops=1)

  • Filter: (NOT nnjl_remove)
211. 0.343 0.804 ↓ 1.0 1,058 1

Hash (cost=53.29..53.29 rows=1,057 width=92) (actual time=0.804..0.804 rows=1,058 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 131kB
212. 0.461 0.461 ↓ 1.0 1,058 1

Seq Scan on productos ent_12 (cost=0.00..53.29 rows=1,057 width=92) (actual time=0.010..0.461 rows=1,058 loops=1)

  • Filter: ((personalizacion IS NOT NULL) AND ((personalizacion)::text <> ''::text))
  • Rows Removed by Filter: 5
213. 0.004 0.176 ↑ 1.0 6 1

Hash (cost=4.06..4.06 rows=6 width=32) (actual time=0.176..0.176 rows=6 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
214. 0.172 0.172 ↑ 1.0 6 1

Seq Scan on nnmas_personal_fields npf_3 (cost=0.00..4.06 rows=6 width=32) (actual time=0.032..0.172 rows=6 loops=1)

  • Filter: ((NOT nnjl_remove) AND (descripcion IS NOT NULL) AND ((descripcion)::text <> ''::text) AND ((tipo)::text !~~* 'nnmas_images%'::text) AND ((tipo)::text !~~* 'textarea%'::text) AND ((tabla)::text = 'productos'::text))
  • Rows Removed by Filter: 97
215.          

SubPlan (for GroupAggregate)

216. 17.088 17.088 ↑ 1.0 1 4,272

Index Scan using nnmas_selects_pkey on nnmas_selects (cost=0.31..8.33 rows=1 width=17) (actual time=0.003..0.004 rows=1 loops=4,272)

  • Index Cond: (id = (NULLIF(lower(NULLIF(replace((((ent_12.personalizacion)::json -> (npf_3.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text))::integer)
  • Filter: (empresa_id = ent_12.empresa_id)
217. 0.000 0.000 ↓ 0.0 0

Seq Scan on nnmas_selects nnmas_selects_1 (cost=0.00..193.92 rows=126 width=17) (never executed)

  • Filter: ((empresa_id = ent_12.empresa_id) AND ((id)::text = ANY (string_to_array(NULLIF(lower(NULLIF(replace((((ent_12.personalizacion)::json -> (npf_3.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text), ','::text))))
218. 0.000 0.000 ↓ 0.0 0

Seq Scan on distribuidores d (cost=0.00..8.32 rows=1 width=22) (never executed)

  • Filter: ((empresa_id = ent_12.empresa_id) AND (id = (NULLIF(lower(NULLIF(replace((((ent_12.personalizacion)::json -> (npf_3.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text))::integer))
219. 0.203 0.895 ↓ 1.0 1,030 1

Hash (cost=48.43..48.43 rows=1,020 width=8) (actual time=0.895..0.895 rows=1,030 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 41kB
220. 0.115 0.692 ↓ 1.0 1,030 1

Subquery Scan on pc_9 (cost=28.02..48.43 rows=1,020 width=8) (actual time=0.458..0.692 rows=1,030 loops=1)

221. 0.383 0.577 ↓ 1.0 1,030 1

HashAggregate (cost=28.02..38.23 rows=1,020 width=12) (actual time=0.457..0.577 rows=1,030 loops=1)

  • Group Key: pc_11.empresa_id, pc_11.producto_id, pc_11.categoria_id
222. 0.194 0.194 ↑ 1.0 1,030 1

Seq Scan on productos_categoria pc_11 (cost=0.00..20.30 rows=1,030 width=12) (actual time=0.005..0.194 rows=1,030 loops=1)

  • Filter: (NOT nnjl_remove)
223. 2.146 2.146 ↑ 1.0 1 1,073

Index Scan using marcas_pkey on marcas m_3 (cost=0.14..0.18 rows=1 width=12) (actual time=0.002..0.002 rows=1 loops=1,073)

  • Index Cond: (id = ent_11.marca_id)
224. 0.002 0.010 ↑ 1.0 16 1

Hash (cost=1.16..1.16 rows=16 width=36) (actual time=0.010..0.010 rows=16 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
225. 0.008 0.008 ↑ 1.0 16 1

Seq Scan on familias f_3 (cost=0.00..1.16 rows=16 width=36) (actual time=0.004..0.008 rows=16 loops=1)

226. 0.003 0.007 ↑ 1.0 8 1

Hash (cost=1.08..1.08 rows=8 width=36) (actual time=0.007..0.007 rows=8 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
227. 0.004 0.004 ↑ 1.0 8 1

Seq Scan on categorias c_3 (cost=0.00..1.08 rows=8 width=36) (actual time=0.004..0.004 rows=8 loops=1)

228. 0.929 2.227 ↑ 1.0 4,818 1

Hash (cost=130.10..130.10 rows=4,818 width=12) (actual time=2.227..2.227 rows=4,818 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 208kB
229. 1.298 1.298 ↑ 1.0 4,818 1

Seq Scan on productos_pedido pp_3 (cost=0.00..130.10 rows=4,818 width=12) (actual time=0.010..1.298 rows=4,818 loops=1)

  • Filter: (NOT nnjl_remove)
  • Rows Removed by Filter: 292
230. 1.063 2.399 ↑ 1.0 4,818 1

Hash (cost=130.10..130.10 rows=4,818 width=24) (actual time=2.399..2.399 rows=4,818 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 283kB
231. 1.336 1.336 ↑ 1.0 4,818 1

Seq Scan on productos_pedido pp_2 (cost=0.00..130.10 rows=4,818 width=24) (actual time=0.008..1.336 rows=4,818 loops=1)

  • Filter: (NOT nnjl_remove)
  • Rows Removed by Filter: 292
232. 128.216 171,574.832 ↑ 2.5 886 1,364

Append (cost=14.50..2,046,787.96 rows=2,185 width=59) (actual time=0.427..125.788 rows=886 loops=1,364)

233. 1.364 1.364 ↓ 0.0 0 1,364

Subquery Scan on *SELECT* 1 (cost=14.50..25.14 rows=1 width=44) (actual time=0.001..0.001 rows=0 loops=1,364)

234. 0.000 0.000 ↓ 0.0 0 1,364

Result (cost=14.50..25.12 rows=1 width=1,585) (actual time=0.000..0.000 rows=0 loops=1,364)

  • One-Time Filter: ($29 IS NOT NULL)
235.          

Initplan (for Result)

236. 0.018 0.018 ↓ 0.0 0 1

Seq Scan on materialized_views mv_4 (cost=0.00..14.50 rows=1 width=4) (actual time=0.018..0.018 rows=0 loops=1)

  • Filter: (active AND ((matviewname)::text = 'vism_bi_negociaciones_cabecera'::text))
  • Rows Removed by Filter: 33
237. 0.000 0.000 ↓ 0.0 0

Seq Scan on vism_bi_negociaciones_cabecera (cost=0.00..10.62 rows=1 width=1,585) (never executed)

  • Filter: (negociacion_estado_id = $0)
238. 189.596 171,445.252 ↑ 2.5 886 1,364

Subquery Scan on *SELECT* 2 (cost=469,736.08..2,046,762.82 rows=2,184 width=59) (actual time=0.426..125.693 rows=886 loops=1,364)

239. 399.641 171,255.656 ↑ 2.5 886 1,364

Result (cost=469,736.08..2,046,740.98 rows=2,184 width=1,258) (actual time=0.426..125.554 rows=886 loops=1,364)

  • One-Time Filter: ($30 IS NOT NULL)
240.          

Initplan (for Result)

241. 0.011 0.011 ↑ 1.0 1 1

Seq Scan on materialized_views mv_5 (cost=0.00..14.50 rows=1 width=4) (actual time=0.011..0.011 rows=1 loops=1)

  • Filter: ((NOT active) AND ((matviewname)::text = 'vism_bi_negociaciones_cabecera'::text))
  • Rows Removed by Filter: 32
242. 1,134.913 170,856.004 ↑ 2.5 886 1,364

Hash Left Join (cost=469,721.58..2,046,704.64 rows=2,184 width=1,250) (actual time=0.425..125.261 rows=886 loops=1,364)

  • Hash Cond: (vism_bi_negociaciones.negociacion_id = ent_13.negociacion_id)
243. 750.889 169,719.792 ↑ 2.5 886 1,364

Hash Left Join (cost=469,640.66..2,046,583.73 rows=2,184 width=1,202) (actual time=0.424..124.428 rows=886 loops=1,364)

  • Hash Cond: (vism_bi_negociaciones.negociacion_id = ent_15.negociacion_id)
244. 151.404 168,810.004 ↑ 2.5 886 1,364

Append (cost=14.50..1,576,944.28 rows=2,184 width=1,190) (actual time=0.306..123.761 rows=886 loops=1,364)

245. 0.000 0.000 ↓ 0.0 0 1,364

Result (cost=14.50..25.12 rows=1 width=1,517) (actual time=0.000..0.000 rows=0 loops=1,364)

  • One-Time Filter: ($34 IS NOT NULL)
246.          

Initplan (for Result)

247. 0.006 0.006 ↓ 0.0 0 1

Seq Scan on materialized_views mv_6 (cost=0.00..14.50 rows=1 width=4) (actual time=0.006..0.006 rows=0 loops=1)

  • Filter: (active AND ((matviewname)::text = 'vism_bi_negociaciones'::text))
  • Rows Removed by Filter: 33
248. 0.000 0.000 ↓ 0.0 0

Seq Scan on vism_bi_negociaciones (cost=0.00..10.62 rows=1 width=1,517) (never executed)

  • Filter: (negociacion_estado_id = $0)
249. 405.098 168,658.600 ↑ 2.5 886 1,364

Result (cost=103,057.17..1,576,897.31 rows=2,183 width=1,190) (actual time=0.306..123.650 rows=886 loops=1,364)

  • One-Time Filter: ($35 IS NOT NULL)
250.          

Initplan (for Result)

251. 0.010 0.010 ↑ 1.0 1 1

Seq Scan on materialized_views mv_7 (cost=0.00..14.50 rows=1 width=4) (actual time=0.009..0.010 rows=1 loops=1)

  • Filter: ((NOT active) AND ((matviewname)::text = 'vism_bi_negociaciones'::text))
  • Rows Removed by Filter: 32
252. 15,894.913 168,253.492 ↑ 2.5 886 1,364

Hash Right Join (cost=103,042.67..1,576,860.98 rows=2,183 width=670) (actual time=0.305..123.353 rows=886 loops=1,364)

  • Hash Cond: ("*SELECT* 1_6".establecimiento_id = ent_18.establecimiento_id)
253. 567.424 152,335.612 ↑ 1.0 3,555 1,364

Append (cost=14.50..1,473,453.14 rows=3,675 width=372) (actual time=0.034..111.683 rows=3,555 loops=1,364)

254. 0.000 0.000 ↓ 0.0 0 1,364

Subquery Scan on *SELECT* 1_6 (cost=14.50..26.90 rows=120 width=584) (actual time=0.000..0.000 rows=0 loops=1,364)

255. 0.000 0.000 ↓ 0.0 0 1,364

Result (cost=14.50..25.70 rows=120 width=601) (actual time=0.000..0.000 rows=0 loops=1,364)

  • One-Time Filter: ($37 IS NOT NULL)
256.          

Initplan (for Result)

257. 0.013 0.013 ↓ 0.0 0 1

Seq Scan on materialized_views mv_8 (cost=0.00..14.50 rows=1 width=4) (actual time=0.013..0.013 rows=0 loops=1)

  • Filter: (active AND ((matviewname)::text = 'vism_bi_establecimientos'::text))
  • Rows Removed by Filter: 33
258. 0.000 0.000 ↓ 0.0 0

Seq Scan on vism_bi_establecimientos visbi_4 (cost=0.00..11.20 rows=120 width=601) (never executed)

259. 1,118.480 151,768.188 ↑ 1.0 3,555 1,364

Subquery Scan on *SELECT* 2_6 (cost=731.73..1,473,426.24 rows=3,555 width=365) (actual time=0.034..111.267 rows=3,555 loops=1,364)

260. 1,121.192 150,649.708 ↑ 1.0 3,555 1,364

Result (cost=731.73..1,473,390.69 rows=3,555 width=382) (actual time=0.033..110.447 rows=3,555 loops=1,364)

  • One-Time Filter: ($38 IS NOT NULL)
261.          

Initplan (for Result)

262. 0.016 0.016 ↑ 1.0 1 1

Seq Scan on materialized_views mv_9 (cost=0.00..14.50 rows=1 width=4) (actual time=0.011..0.016 rows=1 loops=1)

  • Filter: ((NOT active) AND ((matviewname)::text = 'vism_bi_establecimientos'::text))
  • Rows Removed by Filter: 32
263. 5,847.468 149,528.500 ↑ 1.0 3,555 1,364

Merge Left Join (cost=717.23..1,473,340.64 rows=3,555 width=378) (actual time=0.033..109.625 rows=3,555 loops=1,364)

  • Merge Cond: (ent_19.id = ent_20.id)
264. 79,668.512 143,217.272 ↑ 1.0 3,555 1,364

Nested Loop Left Join (cost=0.85..8,066.39 rows=3,555 width=346) (actual time=0.024..104.998 rows=3,555 loops=1,364)

  • Join Filter: ((pr.id)::text = "substring"((ent_19.cp)::text, 1, 2))
  • Rows Removed by Join Filter: 181,986
265. 3,103.100 49,001.700 ↑ 1.0 3,555 1,364

Nested Loop Left Join (cost=0.85..3,905.39 rows=3,555 width=282) (actual time=0.015..35.925 rows=3,555 loops=1,364)

266. 4,973.144 45,898.600 ↑ 1.0 3,555 1,364

Nested Loop Left Join (cost=0.71..3,306.82 rows=3,555 width=271) (actual time=0.014..33.650 rows=3,555 loops=1,364)

267. 5,063.168 36,076.436 ↑ 1.0 3,555 1,364

Nested Loop Left Join (cost=0.57..2,376.17 rows=3,555 width=244) (actual time=0.013..26.449 rows=3,555 loops=1,364)

268. 6,503.552 26,164.248 ↑ 1.0 3,555 1,364

Nested Loop Left Join (cost=0.42..1,738.93 rows=3,555 width=211) (actual time=0.011..19.182 rows=3,555 loops=1,364)

  • Join Filter: (pd.id = ent_19.periodicidad_id)
  • Rows Removed by Join Filter: 35,550
269. 6,684.964 14,811.676 ↑ 1.0 3,555 1,364

Nested Loop Left Join (cost=0.42..1,151.22 rows=3,555 width=183) (actual time=0.010..10.859 rows=3,555 loops=1,364)

270. 3,277.692 3,277.692 ↑ 1.0 3,555 1,364

Index Scan using establecimientos_pkey on establecimientos ent_19 (cost=0.28..534.87 rows=3,555 width=166) (actual time=0.007..2.403 rows=3,555 loops=1,364)

271. 4,849.020 4,849.020 ↑ 1.0 1 4,849,020

Index Scan using tipo_establecimiento_pkey on tipo_establecimiento te (cost=0.14..0.16 rows=1 width=21) (actual time=0.001..0.001 rows=1 loops=4,849,020)

  • Index Cond: (id = ent_19.tipo_establecimiento_id)
272. 4,849.015 4,849.020 ↑ 1.0 11 4,849,020

Materialize (cost=0.00..1.17 rows=11 width=36) (actual time=0.000..0.001 rows=11 loops=4,849,020)

273. 0.005 0.005 ↑ 1.0 11 1

Seq Scan on periodicidad pd (cost=0.00..1.11 rows=11 width=36) (actual time=0.003..0.005 rows=11 loops=1)

274. 4,849.020 4,849.020 ↑ 1.0 1 4,849,020

Index Scan using clientes_pkey on clientes clte (cost=0.14..0.17 rows=1 width=37) (actual time=0.001..0.001 rows=1 loops=4,849,020)

  • Index Cond: (id = ent_19.cliente_id)
275. 4,849.020 4,849.020 ↑ 1.0 1 4,849,020

Index Scan using grupos_pkey on grupos g (cost=0.14..0.25 rows=1 width=31) (actual time=0.001..0.001 rows=1 loops=4,849,020)

  • Index Cond: (id = clte.grupo_id)
276. 0.000 0.000 ↓ 0.0 0 4,849,020

Index Scan using users_pkey on users ue (cost=0.14..0.16 rows=1 width=19) (actual time=0.000..0.000 rows=0 loops=4,849,020)

  • Index Cond: (id = ent_19.user_creacion)
277. 14,547.045 14,547.060 ↑ 1.0 52 4,849,020

Materialize (cost=0.00..1.78 rows=52 width=68) (actual time=0.000..0.003 rows=52 loops=4,849,020)

278. 0.015 0.015 ↑ 1.0 52 1

Seq Scan on provincias pr (cost=0.00..1.52 rows=52 width=68) (actual time=0.006..0.015 rows=52 loops=1)

279. 382.616 463.760 ↓ 1.0 3,313 1,364

Materialize (cost=716.38..1,465,206.19 rows=3,312 width=36) (actual time=0.008..0.340 rows=3,313 loops=1,364)

280. 69.192 81.144 ↓ 1.0 3,313 1

GroupAggregate (cost=716.38..1,465,164.79 rows=3,312 width=72) (actual time=10.736..81.144 rows=3,313 loops=1)

  • Group Key: ent_20.id
281. 8.188 11.952 ↑ 1.0 6,626 1

Sort (cost=716.38..733.74 rows=6,946 width=72) (actual time=10.668..11.952 rows=6,626 loops=1)

  • Sort Key: ent_20.id
  • Sort Method: quicksort Memory: 1,129kB
282. 1.635 3.764 ↑ 1.0 6,626 1

Hash Join (cost=4.14..273.15 rows=6,946 width=72) (actual time=0.201..3.764 rows=6,626 loops=1)

  • Hash Cond: (ent_20.empresa_id = npf_4.empresa_id)
283. 1.961 1.961 ↓ 1.0 3,313 1

Seq Scan on establecimientos ent_20 (cost=0.00..166.44 rows=3,312 width=44) (actual time=0.012..1.961 rows=3,313 loops=1)

  • Filter: ((personalizacion IS NOT NULL) AND ((personalizacion)::text <> ''::text))
  • Rows Removed by Filter: 242
284. 0.002 0.168 ↑ 3.0 2 1

Hash (cost=4.06..4.06 rows=6 width=32) (actual time=0.168..0.168 rows=2 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
285. 0.166 0.166 ↑ 3.0 2 1

Seq Scan on nnmas_personal_fields npf_4 (cost=0.00..4.06 rows=6 width=32) (actual time=0.036..0.166 rows=2 loops=1)

  • Filter: ((NOT nnjl_remove) AND (descripcion IS NOT NULL) AND ((descripcion)::text <> ''::text) AND ((tipo)::text !~~* 'nnmas_images%'::text) AND ((tipo)::text !~~* 'textarea%'::text) AND ((tabla)::text = 'establecimientos'::text))
  • Rows Removed by Filter: 101
286.          

SubPlan (for GroupAggregate)

287. 0.000 0.000 ↓ 0.0 0

Index Scan using nnmas_selects_pkey on nnmas_selects nnmas_selects_4 (cost=0.31..8.33 rows=1 width=17) (never executed)

  • Index Cond: (id = (NULLIF(lower(NULLIF(replace((((ent_20.personalizacion)::json -> (npf_4.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text))::integer)
  • Filter: (empresa_id = ent_20.empresa_id)
288. 0.000 0.000 ↓ 0.0 0

Seq Scan on nnmas_selects nnmas_selects_5 (cost=0.00..193.92 rows=126 width=17) (never executed)

  • Filter: ((empresa_id = ent_20.empresa_id) AND ((id)::text = ANY (string_to_array(NULLIF(lower(NULLIF(replace((((ent_20.personalizacion)::json -> (npf_4.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text), ','::text))))
289. 0.000 0.000 ↓ 0.0 0

Seq Scan on distribuidores d_2 (cost=0.00..8.32 rows=1 width=22) (never executed)

  • Filter: ((empresa_id = ent_20.empresa_id) AND (id = (NULLIF(lower(NULLIF(replace((((ent_20.personalizacion)::json -> (npf_4.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text))::integer))
290. 0.851 22.967 ↓ 5.6 886 1

Hash (cost=103,026.19..103,026.19 rows=158 width=301) (actual time=22.967..22.967 rows=886 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 247kB
291. 0.311 22.116 ↓ 5.6 886 1

Hash Left Join (cost=103,002.63..103,026.19 rows=158 width=301) (actual time=20.093..22.116 rows=886 loops=1)

  • Hash Cond: (ent_18.estado_id = ne.id)
292. 0.324 21.795 ↓ 5.6 886 1

Hash Left Join (cost=103,001.55..103,022.93 rows=158 width=269) (actual time=20.064..21.795 rows=886 loops=1)

  • Hash Cond: (ent_18.accion_id = na.id)
293. 0.310 21.449 ↓ 5.6 886 1

Hash Left Join (cost=102,999.76..103,019.24 rows=158 width=237) (actual time=20.019..21.449 rows=886 loops=1)

  • Hash Cond: (ent_18.empresa_id = emp.id)
294. 0.363 21.132 ↓ 5.6 886 1

Hash Left Join (cost=102,998.65..103,015.96 rows=158 width=205) (actual time=19.992..21.132 rows=886 loops=1)

  • Hash Cond: (ent_18.gestor = u.id)
295. 0.469 20.716 ↓ 5.6 886 1

Hash Right Join (cost=102,995.56..103,010.70 rows=158 width=142) (actual time=19.912..20.716 rows=886 loops=1)

  • Hash Cond: (ent_21.id = ent_18.id)
296. 17.307 19.000 ↓ 2.1 962 1

HashAggregate (cost=102,943.43..102,951.56 rows=465 width=83) (actual time=18.646..19.000 rows=962 loops=1)

  • Group Key: ent_21.id
297. 0.501 1.693 ↓ 2.0 962 1

Hash Join (cost=5.33..62.05 rows=488 width=83) (actual time=0.255..1.693 rows=962 loops=1)

  • Hash Cond: (ent_21.empresa_id = npf_5.empresa_id)
298. 0.993 0.999 ↓ 2.1 962 1

Seq Scan on negociaciones ent_21 (cost=1.24..50.16 rows=465 width=55) (actual time=0.041..0.999 rows=962 loops=1)

  • Filter: ((NOT nnjl_remove) AND (personalizacion IS NOT NULL) AND (NOT (hashed SubPlan 32)) AND ((personalizacion)::text <> ''::text))
  • Rows Removed by Filter: 233
299.          

SubPlan (for Seq Scan)

300. 0.006 0.006 ↑ 1.0 7 1

Seq Scan on users users_8 (cost=0.00..1.22 rows=7 width=4) (actual time=0.003..0.006 rows=7 loops=1)

  • Filter: sysadmin
  • Rows Removed by Filter: 15
301. 0.002 0.193 ↑ 3.0 1 1

Hash (cost=4.06..4.06 rows=3 width=32) (actual time=0.193..0.193 rows=1 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
302. 0.191 0.191 ↑ 3.0 1 1

Seq Scan on nnmas_personal_fields npf_5 (cost=0.00..4.06 rows=3 width=32) (actual time=0.069..0.191 rows=1 loops=1)

  • Filter: ((NOT nnjl_remove) AND (descripcion IS NOT NULL) AND ((descripcion)::text <> ''::text) AND ((tipo)::text !~~* 'nnmas_images%'::text) AND ((tipo)::text !~~* 'textarea%'::text) AND ((tabla)::text = 'negociaciones'::text))
  • Rows Removed by Filter: 102
303.          

SubPlan (for HashAggregate)

304. 0.000 0.000 ↓ 0.0 0

Index Scan using nnmas_selects_pkey on nnmas_selects nnmas_selects_6 (cost=0.31..8.33 rows=1 width=17) (never executed)

  • Index Cond: (id = (NULLIF(lower(NULLIF(replace((((ent_21.personalizacion)::json -> (npf_5.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text))::integer)
  • Filter: (empresa_id = ent_21.empresa_id)
305. 0.000 0.000 ↓ 0.0 0

Seq Scan on nnmas_selects nnmas_selects_7 (cost=0.00..193.92 rows=126 width=17) (never executed)

  • Filter: ((empresa_id = ent_21.empresa_id) AND ((id)::text = ANY (string_to_array(NULLIF(lower(NULLIF(replace((((ent_21.personalizacion)::json -> (npf_5.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text), ','::text))))
306. 0.000 0.000 ↓ 0.0 0

Seq Scan on distribuidores d_3 (cost=0.00..8.32 rows=1 width=22) (never executed)

  • Filter: ((empresa_id = ent_21.empresa_id) AND (id = (NULLIF(lower(NULLIF(replace((((ent_21.personalizacion)::json -> (npf_5.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text))::integer))
307. 0.467 1.247 ↓ 5.6 886 1

Hash (cost=50.16..50.16 rows=158 width=110) (actual time=1.247..1.247 rows=886 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 131kB
308. 0.762 0.780 ↓ 5.6 886 1

Seq Scan on negociaciones ent_18 (cost=1.24..50.16 rows=158 width=110) (actual time=0.078..0.780 rows=886 loops=1)

  • Filter: ((NOT nnjl_remove) AND (NOT (hashed SubPlan 23)) AND (estado_id = $0))
  • Rows Removed by Filter: 309
309.          

SubPlan (for Seq Scan)

310. 0.018 0.018 ↑ 1.0 7 1

Seq Scan on users users_7 (cost=0.00..1.22 rows=7 width=4) (actual time=0.014..0.018 rows=7 loops=1)

  • Filter: sysadmin
  • Rows Removed by Filter: 15
311. 0.010 0.053 ↑ 1.0 22 1

Hash (cost=2.81..2.81 rows=22 width=67) (actual time=0.053..0.053 rows=22 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 2kB
312. 0.021 0.043 ↑ 1.0 22 1

Hash Left Join (cost=1.50..2.81 rows=22 width=67) (actual time=0.036..0.043 rows=22 loops=1)

  • Hash Cond: (u.padre_id = up.id)
313. 0.004 0.004 ↑ 1.0 22 1

Seq Scan on users u (cost=0.00..1.22 rows=22 width=56) (actual time=0.003..0.004 rows=22 loops=1)

314. 0.003 0.018 ↑ 1.0 22 1

Hash (cost=1.22..1.22 rows=22 width=19) (actual time=0.018..0.018 rows=22 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 2kB
315. 0.015 0.015 ↑ 1.0 22 1

Seq Scan on users up (cost=0.00..1.22 rows=22 width=19) (actual time=0.008..0.015 rows=22 loops=1)

316. 0.003 0.007 ↑ 1.0 5 1

Hash (cost=1.05..1.05 rows=5 width=36) (actual time=0.007..0.007 rows=5 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
317. 0.004 0.004 ↑ 1.0 5 1

Seq Scan on empresas emp (cost=0.00..1.05 rows=5 width=36) (actual time=0.004..0.004 rows=5 loops=1)

318. 0.008 0.022 ↑ 1.0 35 1

Hash (cost=1.35..1.35 rows=35 width=36) (actual time=0.022..0.022 rows=35 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 2kB
319. 0.014 0.014 ↑ 1.0 35 1

Seq Scan on negociaciones_accion na (cost=0.00..1.35 rows=35 width=36) (actual time=0.008..0.014 rows=35 loops=1)

320. 0.002 0.010 ↑ 1.0 1 1

Hash (cost=1.07..1.07 rows=1 width=36) (actual time=0.010..0.010 rows=1 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
321. 0.008 0.008 ↑ 1.0 1 1

Seq Scan on negociaciones_estado ne (cost=0.00..1.07 rows=1 width=36) (actual time=0.008..0.008 rows=1 loops=1)

  • Filter: (id = $0)
  • Rows Removed by Filter: 5
322. 0.189 158.899 ↓ 3.8 908 1

Hash (cost=469,623.17..469,623.17 rows=239 width=16) (actual time=158.899..158.899 rows=908 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 47kB
323. 0.352 158.710 ↓ 3.8 908 1

Merge Semi Join (cost=469,616.16..469,623.17 rows=239 width=16) (actual time=158.250..158.710 rows=908 loops=1)

  • Merge Cond: (ent_15.negociacion_id = ent_16.id)
324. 0.293 157.375 ↓ 2.1 911 1

Sort (cost=469,543.73..469,544.84 rows=441 width=16) (actual time=157.326..157.375 rows=911 loops=1)

  • Sort Key: ent_15.negociacion_id
  • Sort Method: quicksort Memory: 96kB
325. 0.270 157.082 ↓ 2.1 911 1

Hash Semi Join (cost=469,491.64..469,524.36 rows=441 width=16) (actual time=156.642..157.082 rows=911 loops=1)

  • Hash Cond: (ent_15.pedido_id = ent_17.id)
326. 0.195 0.195 ↑ 1.0 995 1

Seq Scan on negociaciones_pedido ent_15 (cost=0.00..25.21 rows=995 width=16) (actual time=0.008..0.195 rows=995 loops=1)

  • Filter: (NOT nnjl_remove)
  • Rows Removed by Filter: 26
327. 0.185 156.617 ↓ 2.0 917 1

Hash (cost=469,485.97..469,485.97 rows=453 width=8) (actual time=156.617..156.617 rows=917 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 36kB
328. 0.340 156.432 ↓ 2.0 917 1

Merge Join (cost=469,474.84..469,485.97 rows=453 width=8) (actual time=155.975..156.432 rows=917 loops=1)

  • Merge Cond: (ent_17.id = pp_4.pedido_id)
329. 0.299 0.728 ↓ 2.0 948 1

Sort (cost=56.84..58.03 rows=475 width=4) (actual time=0.658..0.728 rows=948 loops=1)

  • Sort Key: ent_17.id
  • Sort Method: quicksort Memory: 69kB
330. 0.417 0.429 ↓ 2.0 948 1

Seq Scan on pedidos ent_17 (cost=1.24..35.72 rows=475 width=4) (actual time=0.048..0.429 rows=948 loops=1)

  • Filter: ((NOT nnjl_remove) AND (NOT (hashed SubPlan 20)))
  • Rows Removed by Filter: 51
331.          

SubPlan (for Seq Scan)

332. 0.012 0.012 ↑ 1.0 7 1

Seq Scan on users users_6 (cost=0.00..1.22 rows=7 width=4) (actual time=0.007..0.012 rows=7 loops=1)

  • Filter: sysadmin
  • Rows Removed by Filter: 15
333. 0.300 155.364 ↓ 1.0 919 1

Sort (cost=469,418.00..469,420.24 rows=898 width=4) (actual time=155.313..155.364 rows=919 loops=1)

  • Sort Key: pp_4.pedido_id
  • Sort Method: quicksort Memory: 68kB
334. 1.054 155.064 ↓ 1.0 919 1

HashAggregate (cost=469,364.97..469,373.95 rows=898 width=4) (actual time=154.971..155.064 rows=919 loops=1)

  • Group Key: pp_4.pedido_id
335. 0.973 154.010 ↑ 6.2 4,847 1

Hash Join (cost=204.82..469,289.87 rows=30,038 width=4) (actual time=152.269..154.010 rows=4,847 loops=1)

  • Hash Cond: ("*SELECT* 1_5".producto_id = pp_4.producto_id)
336. 0.079 150.755 ↑ 1.2 1,073 1

Append (cost=14.50..468,452.24 rows=1,303 width=4) (actual time=149.942..150.755 rows=1,073 loops=1)

337. 0.002 0.011 ↓ 0.0 0 1

Subquery Scan on *SELECT* 1_5 (cost=14.50..29.30 rows=240 width=4) (actual time=0.011..0.011 rows=0 loops=1)

338. 0.001 0.009 ↓ 0.0 0 1

Result (cost=14.50..26.90 rows=240 width=309) (actual time=0.009..0.009 rows=0 loops=1)

  • One-Time Filter: ($62 IS NOT NULL)
339.          

Initplan (for Result)

340. 0.008 0.008 ↓ 0.0 0 1

Seq Scan on materialized_views mv_10 (cost=0.00..14.50 rows=1 width=4) (actual time=0.008..0.008 rows=0 loops=1)

  • Filter: (active AND ((matviewname)::text = 'vism_bi_productos'::text))
  • Rows Removed by Filter: 33
341. 0.000 0.000 ↓ 0.0 0

Seq Scan on vism_bi_productos visbi_5 (cost=0.00..12.40 rows=240 width=309) (never executed)

342. 0.108 150.665 ↓ 1.0 1,073 1

Subquery Scan on *SELECT* 2_5 (cost=468,385.74..468,422.94 rows=1,063 width=4) (actual time=149.930..150.665 rows=1,073 loops=1)

343. 0.156 150.557 ↓ 1.0 1,073 1

Result (cost=468,385.74..468,412.31 rows=1,063 width=309) (actual time=149.930..150.557 rows=1,073 loops=1)

  • One-Time Filter: ($63 IS NOT NULL)
344.          

Initplan (for Result)

345. 0.014 0.014 ↑ 1.0 1 1

Seq Scan on materialized_views mv_11 (cost=0.00..14.50 rows=1 width=4) (actual time=0.010..0.014 rows=1 loops=1)

  • Filter: ((NOT active) AND ((matviewname)::text = 'vism_bi_productos'::text))
  • Rows Removed by Filter: 32
346. 3.067 150.387 ↓ 1.0 1,073 1

HashAggregate (cost=468,371.24..468,387.18 rows=1,063 width=293) (actual time=149.911..150.387 rows=1,073 loops=1)

  • Group Key: (clock_timestamp())::timestamp without time zone, ent_22.empresa_id, ent_22.id, ent_22.cod_ext, ent_22.descripcion, ent_22.precio, ent_22.precio_distribuidor, CASE WHEN (ent_22.precio_distribuidor IS NOT NULL) THEN ent_22.precio_distribuidor ELSE ent_22.precio END, ent_22.modulos, c_4.id, c_4.nombre, m_4.id, m_4.nombre, f_4.id, f_4.nombre, ent_22.personalizacion, ((json_object_agg(npf_6.nombre, CASE WHEN ((NULLIF(lower(NULLIF(replace((((ent_23.personalizacion)::json -> (npf_6.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) IS NOT NULL) AND (((npf_6.tipo)::text = 'select'::text) OR ((npf_6.tipo)::text = 'select_mandatory'::text) OR ((npf_6.tipo)::text = 'select_readonly'::text)) AND (NULLIF(lower(NULLIF(replace((((ent_23.personalizacion)::json -> (npf_6.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) ~ '^[0-9]'::text)) THEN (SubPlan 35) WHEN ((NULLIF(lower(NULLIF(replace((((ent_23.personalizacion)::json -> (npf_6.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) IS NOT NULL) AND ((npf_6.tipo)::text = 'selectmultiple'::text) AND (NULLIF(lower(NULLIF(replace((((ent_23.personalizacion)::json -> (npf_6.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) ~ '^[0-9]'::text)) THEN (array_to_string((SubPlan 36), ','::text))::character varying WHEN ((NULLIF(lower(NULLIF(replace((((ent_23.personalizacion)::json -> (npf_6.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) IS NOT NULL) AND ((npf_6.tipo)::text ~~* 'selectreference%'::text) AND ((npf_6.nombre)::text = 'distribuidor'::text) AND (NULLIF(lower(NULLIF(replace((((ent_23.personalizacion)::json -> (npf_6.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) ~ '^[0-9]'::text)) THEN (SubPlan 37) WHEN (NULLIF(lower(NULLIF(replace((((ent_23.personalizacion)::json -> (npf_6.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) IS NOT NULL) THEN (NULLIF(lower(NULLIF(replace((((ent_23.personalizacion)::json -> (npf_6.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text))::character varying ELSE NULL::character varying END))::text), ent_22.nnjl_remove
347. 1.359 147.320 ↓ 1.0 1,073 1

Hash Left Join (cost=353.11..468,323.40 rows=1,063 width=293) (actual time=7.974..147.320 rows=1,073 loops=1)

  • Hash Cond: (pc_12.categoria_id = c_4.id)
348. 0.508 145.952 ↓ 1.0 1,073 1

Hash Left Join (cost=351.93..468,312.49 rows=1,063 width=261) (actual time=7.938..145.952 rows=1,073 loops=1)

  • Hash Cond: (ent_22.familia_id = f_4.id)
349. 1.141 145.430 ↓ 1.0 1,073 1

Nested Loop Left Join (cost=350.57..468,296.52 rows=1,063 width=229) (actual time=7.904..145.430 rows=1,073 loops=1)

350. 0.653 142.143 ↓ 1.0 1,073 1

Hash Left Join (cost=350.42..468,097.15 rows=1,063 width=221) (actual time=7.892..142.143 rows=1,073 loops=1)

  • Hash Cond: (ent_22.id = pc_12.producto_id)
351. 1.335 140.565 ↑ 1.0 1,063 1

Merge Left Join (cost=289.25..467,887.58 rows=1,063 width=217) (actual time=6.956..140.565 rows=1,063 loops=1)

  • Merge Cond: (ent_22.id = ent_23.id)
352. 0.918 0.918 ↑ 1.0 1,063 1

Index Scan using productos_pkey on productos ent_22 (cost=0.28..152.01 rows=1,063 width=185) (actual time=0.010..0.918 rows=1,063 loops=1)

353. 0.506 138.312 ↓ 1.0 1,058 1

Materialize (cost=288.97..467,719.70 rows=1,057 width=36) (actual time=6.940..138.312 rows=1,058 loops=1)

354. 116.980 137.806 ↓ 1.0 1,058 1

GroupAggregate (cost=288.97..467,706.49 rows=1,057 width=120) (actual time=6.935..137.806 rows=1,058 loops=1)

  • Group Key: ent_23.id
355. 4.460 8.010 ↓ 2.9 6,408 1

Sort (cost=288.97..294.51 rows=2,217 width=120) (actual time=6.709..8.010 rows=6,408 loops=1)

  • Sort Key: ent_23.id
  • Sort Method: quicksort Memory: 1,640kB
356. 1.345 3.550 ↓ 2.9 6,408 1

Hash Join (cost=98.66..165.77 rows=2,217 width=120) (actual time=1.669..3.550 rows=6,408 loops=1)

  • Hash Cond: (ent_23.empresa_id = npf_6.empresa_id)
357. 0.419 2.034 ↓ 1.0 1,068 1

Hash Right Join (cost=94.53..128.89 rows=1,057 width=92) (actual time=1.479..2.034 rows=1,068 loops=1)

  • Hash Cond: (pc_13.producto_id = ent_23.id)
358. 0.461 0.682 ↓ 1.0 1,030 1

HashAggregate (cost=28.02..38.23 rows=1,020 width=12) (actual time=0.524..0.682 rows=1,030 loops=1)

  • Group Key: pc_13.empresa_id, pc_13.producto_id, pc_13.categoria_id
359. 0.221 0.221 ↑ 1.0 1,030 1

Seq Scan on productos_categoria pc_13 (cost=0.00..20.30 rows=1,030 width=12) (actual time=0.006..0.221 rows=1,030 loops=1)

  • Filter: (NOT nnjl_remove)
360. 0.365 0.933 ↓ 1.0 1,058 1

Hash (cost=53.29..53.29 rows=1,057 width=92) (actual time=0.933..0.933 rows=1,058 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 131kB
361. 0.568 0.568 ↓ 1.0 1,058 1

Seq Scan on productos ent_23 (cost=0.00..53.29 rows=1,057 width=92) (actual time=0.013..0.568 rows=1,058 loops=1)

  • Filter: ((personalizacion IS NOT NULL) AND ((personalizacion)::text <> ''::text))
  • Rows Removed by Filter: 5
362. 0.005 0.171 ↑ 1.0 6 1

Hash (cost=4.06..4.06 rows=6 width=32) (actual time=0.171..0.171 rows=6 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
363. 0.166 0.166 ↑ 1.0 6 1

Seq Scan on nnmas_personal_fields npf_6 (cost=0.00..4.06 rows=6 width=32) (actual time=0.029..0.166 rows=6 loops=1)

  • Filter: ((NOT nnjl_remove) AND (descripcion IS NOT NULL) AND ((descripcion)::text <> ''::text) AND ((tipo)::text !~~* 'nnmas_images%'::text) AND ((tipo)::text !~~* 'textarea%'::text) AND ((tabla)::text = 'productos'::text))
  • Rows Removed by Filter: 97
364.          

SubPlan (for GroupAggregate)

365. 12.816 12.816 ↑ 1.0 1 4,272

Index Scan using nnmas_selects_pkey on nnmas_selects nnmas_selects_8 (cost=0.31..8.33 rows=1 width=17) (actual time=0.003..0.003 rows=1 loops=4,272)

  • Index Cond: (id = (NULLIF(lower(NULLIF(replace((((ent_23.personalizacion)::json -> (npf_6.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text))::integer)
  • Filter: (empresa_id = ent_23.empresa_id)
366. 0.000 0.000 ↓ 0.0 0

Seq Scan on nnmas_selects nnmas_selects_9 (cost=0.00..193.92 rows=126 width=17) (never executed)

  • Filter: ((empresa_id = ent_23.empresa_id) AND ((id)::text = ANY (string_to_array(NULLIF(lower(NULLIF(replace((((ent_23.personalizacion)::json -> (npf_6.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text), ','::text))))
367. 0.000 0.000 ↓ 0.0 0

Seq Scan on distribuidores d_4 (cost=0.00..8.32 rows=1 width=22) (never executed)

  • Filter: ((empresa_id = ent_23.empresa_id) AND (id = (NULLIF(lower(NULLIF(replace((((ent_23.personalizacion)::json -> (npf_6.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text))::integer))
368. 0.211 0.925 ↓ 1.0 1,030 1

Hash (cost=48.43..48.43 rows=1,020 width=8) (actual time=0.925..0.925 rows=1,030 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 41kB
369. 0.110 0.714 ↓ 1.0 1,030 1

Subquery Scan on pc_12 (cost=28.02..48.43 rows=1,020 width=8) (actual time=0.467..0.714 rows=1,030 loops=1)

370. 0.404 0.604 ↓ 1.0 1,030 1

HashAggregate (cost=28.02..38.23 rows=1,020 width=12) (actual time=0.466..0.604 rows=1,030 loops=1)

  • Group Key: pc_14.empresa_id, pc_14.producto_id, pc_14.categoria_id
371. 0.200 0.200 ↑ 1.0 1,030 1

Seq Scan on productos_categoria pc_14 (cost=0.00..20.30 rows=1,030 width=12) (actual time=0.005..0.200 rows=1,030 loops=1)

  • Filter: (NOT nnjl_remove)
372. 2.146 2.146 ↑ 1.0 1 1,073

Index Scan using marcas_pkey on marcas m_4 (cost=0.14..0.18 rows=1 width=12) (actual time=0.002..0.002 rows=1 loops=1,073)

  • Index Cond: (id = ent_22.marca_id)
373. 0.007 0.014 ↑ 1.0 16 1

Hash (cost=1.16..1.16 rows=16 width=36) (actual time=0.014..0.014 rows=16 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
374. 0.007 0.007 ↑ 1.0 16 1

Seq Scan on familias f_4 (cost=0.00..1.16 rows=16 width=36) (actual time=0.004..0.007 rows=16 loops=1)

375. 0.006 0.009 ↑ 1.0 8 1

Hash (cost=1.08..1.08 rows=8 width=36) (actual time=0.009..0.009 rows=8 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
376. 0.003 0.003 ↑ 1.0 8 1

Seq Scan on categorias c_4 (cost=0.00..1.08 rows=8 width=36) (actual time=0.003..0.003 rows=8 loops=1)

377. 0.962 2.282 ↑ 1.0 4,818 1

Hash (cost=130.10..130.10 rows=4,818 width=8) (actual time=2.282..2.282 rows=4,818 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 189kB
378. 1.320 1.320 ↑ 1.0 4,818 1

Seq Scan on productos_pedido pp_4 (cost=0.00..130.10 rows=4,818 width=8) (actual time=0.010..1.320 rows=4,818 loops=1)

  • Filter: (NOT nnjl_remove)
  • Rows Removed by Filter: 292
379. 0.382 0.983 ↓ 2.0 1,107 1

Sort (cost=72.42..73.81 rows=554 width=4) (actual time=0.920..0.983 rows=1,107 loops=1)

  • Sort Key: ent_16.id
  • Sort Method: quicksort Memory: 100kB
380. 0.588 0.601 ↓ 2.0 1,107 1

Seq Scan on negociaciones ent_16 (cost=1.24..47.17 rows=554 width=4) (actual time=0.050..0.601 rows=1,107 loops=1)

  • Filter: ((NOT nnjl_remove) AND (NOT (hashed SubPlan 19)))
  • Rows Removed by Filter: 88
381.          

SubPlan (for Seq Scan)

382. 0.013 0.013 ↑ 1.0 7 1

Seq Scan on users users_5 (cost=0.00..1.22 rows=7 width=4) (actual time=0.008..0.013 rows=7 loops=1)

  • Filter: sysadmin
  • Rows Removed by Filter: 15
383. 0.202 1.299 ↑ 1.0 532 1

Hash (cost=74.22..74.22 rows=537 width=52) (actual time=1.299..1.299 rows=532 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 42kB
384. 0.261 1.097 ↑ 1.0 532 1

Hash Join (cost=23.67..74.22 rows=537 width=52) (actual time=0.449..1.097 rows=532 loops=1)

  • Hash Cond: (ent_14.id = ent_13.negociacion_id)
385. 0.457 0.465 ↓ 2.0 1,107 1

Seq Scan on negociaciones ent_14 (cost=1.24..47.17 rows=554 width=4) (actual time=0.056..0.465 rows=1,107 loops=1)

  • Filter: ((NOT nnjl_remove) AND (NOT (hashed SubPlan 18)))
  • Rows Removed by Filter: 88
386.          

SubPlan (for Seq Scan)

387. 0.008 0.008 ↑ 1.0 7 1

Seq Scan on users users_4 (cost=0.00..1.22 rows=7 width=4) (actual time=0.003..0.008 rows=7 loops=1)

  • Filter: sysadmin
  • Rows Removed by Filter: 15
388. 0.170 0.371 ↑ 1.0 545 1

Hash (cost=15.62..15.62 rows=545 width=52) (actual time=0.371..0.371 rows=545 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 43kB
389. 0.201 0.201 ↑ 1.0 545 1

Seq Scan on negociaciones_contraprestacion ent_13 (cost=0.00..15.62 rows=545 width=52) (actual time=0.009..0.201 rows=545 loops=1)

  • Filter: (NOT nnjl_remove)
  • Rows Removed by Filter: 17
390. 14.066 14.080 ↑ 1.0 1 1,280

Index Scan using visitas_pkey on visitas ent (cost=1.52..1.88 rows=1 width=4) (actual time=0.007..0.011 rows=1 loops=1,280)

  • Index Cond: (id = "*SELECT* 1".negociacion_visita_id)
  • Filter: ((NOT nnjl_remove) AND finalizada AND (NOT (hashed SubPlan 2)))
  • Rows Removed by Filter: 0
391.          

SubPlan (for Index Scan)

392. 0.014 0.014 ↑ 1.0 7 1

Seq Scan on users (cost=0.00..1.22 rows=7 width=4) (actual time=0.008..0.014 rows=7 loops=1)

  • Filter: sysadmin
  • Rows Removed by Filter: 15
393. 33.993 33.993 ↑ 1.0 1 1,259

Seq Scan on nnmas_personal_fields npf_fa (cost=0.00..3.54 rows=1 width=8) (actual time=0.010..0.027 rows=1 loops=1,259)

  • Filter: ((NOT nnjl_remove) AND ((tabla)::text = 'negociaciones'::text) AND ((nombre)::text = 'fecha_accion'::text))
  • Rows Removed by Filter: 102
394. 2.518 2.518 ↑ 1.0 4 1,259

Seq Scan on objetivo_periodo t (cost=0.00..1.04 rows=4 width=8) (actual time=0.001..0.002 rows=4 loops=1,259)

Planning time : 84.277 ms
Execution time : 172,653.764 ms