explain.depesz.com

PostgreSQL's explain analyze made readable

Result: QTY4

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 136.988 171,425.926 ↓ 1,259.0 1,259 1

Nested Loop Left Join (cost=2,824,101.57..4,870,949.81 rows=1 width=1,402) (actual time=1,442.888..171,425.926 rows=1,259 loops=1)

  • Join Filter: ((t.mes_inicio <= (date_part('month'::text, (CASE WHEN (NULLIF(lower(NULLIF(replace((((vism_bi_negociaciones_cabecera.negociacion_personalizacion)::json -> (npf_fa.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) IS NOT NULL) THEN to_date(NULLIF(lower(NULLIF(replace((((vism_bi_negociaciones_cabecera.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((((vism_bi_negociaciones_cabecera.negociacion_personalizacion)::json -> (npf_fa.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) IS NOT NULL) THEN to_date(NULLIF(lower(NULLIF(replace((((vism_bi_negociaciones_cabecera.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
2.          

Initplan (for Nested Loop Left Join)

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. 5.453 171,286.410 ↓ 1,259.0 1,259 1

Nested Loop Left Join (cost=2,824,100.50..4,870,938.44 rows=1 width=1,366) (actual time=1,442.655..171,286.410 rows=1,259 loops=1)

  • Join Filter: (npf_fa.empresa_id = vism_bi_negociaciones_cabecera.negociacion_empresa_id)
5. 4.288 171,246.964 ↓ 1,259.0 1,259 1

Merge Join (cost=2,824,100.50..4,870,934.88 rows=1 width=1,362) (actual time=1,442.623..171,246.964 rows=1,259 loops=1)

  • Merge Cond: (ent_1.id = ent_4.id)
6. 1.750 154.063 ↓ 2.0 917 1

Merge Join (cost=469,481.84..469,492.97 rows=453 width=40) (actual time=151.273..154.063 rows=917 loops=1)

  • Merge Cond: (ent_1.id = pp.pedido_id)
7. 0.773 9.643 ↓ 2.0 948 1

Sort (cost=63.84..65.03 rows=475 width=36) (actual time=9.271..9.643 rows=948 loops=1)

  • Sort Key: ent_1.id
  • Sort Method: quicksort Memory: 69kB
8. 6.551 8.870 ↓ 2.0 948 1

Hash Left Join (cost=4.79..42.72 rows=475 width=36) (actual time=0.282..8.870 rows=948 loops=1)

  • Hash Cond: (ent_1.empresa_id = npf_tp.empresa_id)
9. 0.626 0.639 ↓ 2.0 948 1

Seq Scan on pedidos ent_1 (cost=1.24..35.72 rows=475 width=47) (actual time=0.049..0.639 rows=948 loops=1)

  • Filter: ((NOT nnjl_remove) AND (NOT (hashed SubPlan 4)))
  • Rows Removed by Filter: 51
10.          

SubPlan (for Seq Scan)

11. 0.013 0.013 ↑ 1.0 7 1

Seq Scan on users users_1 (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
12. 0.001 0.042 ↑ 1.0 1 1

Hash (cost=3.54..3.54 rows=1 width=8) (actual time=0.042..0.042 rows=1 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
13. 0.041 0.041 ↑ 1.0 1 1

Seq Scan on nnmas_personal_fields npf_tp (cost=0.00..3.54 rows=1 width=8) (actual time=0.019..0.041 rows=1 loops=1)

  • Filter: ((NOT nnjl_remove) AND ((tabla)::text = 'pedidos'::text) AND ((nombre)::text = 'tipo_pedido'::text))
  • Rows Removed by Filter: 102
14.          

SubPlan (for Hash Left Join)

15. 1.638 1.638 ↑ 1.0 1 546

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

  • Index Cond: (id = (NULLIF(lower(NULLIF(replace((((ent_1.personalizacion)::json -> (npf_tp.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text))::integer)
  • Filter: (empresa_id = ent_1.empresa_id)
16. 0.924 142.670 ↓ 1.0 919 1

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

  • Sort Key: pp.pedido_id
  • Sort Method: quicksort Memory: 68kB
17. 1.084 141.746 ↓ 1.0 919 1

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

  • Group Key: pp.pedido_id
18. 0.893 140.662 ↑ 6.2 4,847 1

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

  • Hash Cond: ("*SELECT* 1".producto_id = pp.producto_id)
19. 0.073 137.442 ↑ 1.2 1,073 1

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

20. 0.001 0.011 ↓ 0.0 0 1

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

21. 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: ($101 IS NOT NULL)
22.          

Initplan (for Result)

23. 0.009 0.009 ↓ 0.0 0 1

Seq Scan on materialized_views mv_16 (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
24. 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)

25. 0.129 137.358 ↓ 1.0 1,073 1

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

26. 0.152 137.229 ↓ 1.0 1,073 1

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

  • One-Time Filter: ($102 IS NOT NULL)
27.          

Initplan (for Result)

28. 0.014 0.014 ↑ 1.0 1 1

Seq Scan on materialized_views mv_17 (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
29. 2.917 137.063 ↓ 1.0 1,073 1

HashAggregate (cost=468,371.24..468,387.18 rows=1,063 width=293) (actual time=136.699..137.063 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 51) 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 52), ','::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 53) 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
30. 1.327 134.146 ↓ 1.0 1,073 1

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

  • Hash Cond: (pc.categoria_id = c.id)
31. 0.505 132.812 ↓ 1.0 1,073 1

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

  • Hash Cond: (ent_5.familia_id = f.id)
32. 1.099 132.296 ↓ 1.0 1,073 1

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

33. 0.667 129.051 ↓ 1.0 1,073 1

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

  • Hash Cond: (ent_5.id = pc.producto_id)
34. 1.250 127.480 ↑ 1.0 1,063 1

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

  • Merge Cond: (ent_5.id = ent_6.id)
35. 0.864 0.864 ↑ 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.015..0.864 rows=1,063 loops=1)

36. 0.493 125.366 ↓ 1.0 1,058 1

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

37. 103.993 124.873 ↓ 1.0 1,058 1

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

  • Group Key: ent_6.id
38. 4.488 8.064 ↓ 2.9 6,408 1

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

  • Sort Key: ent_6.id
  • Sort Method: quicksort Memory: 1,640kB
39. 1.281 3.576 ↓ 2.9 6,408 1

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

  • Hash Cond: (ent_6.empresa_id = npf.empresa_id)
40. 0.411 2.122 ↓ 1.0 1,068 1

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

  • Hash Cond: (pc_1.producto_id = ent_6.id)
41. 0.497 0.738 ↓ 1.0 1,030 1

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

  • Group Key: pc_1.empresa_id, pc_1.producto_id, pc_1.categoria_id
42. 0.241 0.241 ↑ 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.241 rows=1,030 loops=1)

  • Filter: (NOT nnjl_remove)
43. 0.388 0.973 ↓ 1.0 1,058 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 131kB
44. 0.585 0.585 ↓ 1.0 1,058 1

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

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

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
46. 0.170 0.170 ↑ 1.0 6 1

Seq Scan on nnmas_personal_fields npf (cost=0.00..4.06 rows=6 width=32) (actual time=0.028..0.170 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
47.          

SubPlan (for GroupAggregate)

48. 12.816 12.816 ↑ 1.0 1 4,272

Index Scan using nnmas_selects_pkey on nnmas_selects nnmas_selects_15 (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)
49. 0.000 0.000 ↓ 0.0 0

Seq Scan on nnmas_selects nnmas_selects_16 (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))))
50. 0.000 0.000 ↓ 0.0 0

Seq Scan on distribuidores d_7 (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))
51. 0.202 0.904 ↓ 1.0 1,030 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 41kB
52. 0.104 0.702 ↓ 1.0 1,030 1

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

53. 0.395 0.598 ↓ 1.0 1,030 1

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

  • Group Key: pc_2.empresa_id, pc_2.producto_id, pc_2.categoria_id
54. 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.006..0.203 rows=1,030 loops=1)

  • Filter: (NOT nnjl_remove)
55. 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)
56. 0.006 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
57. 0.005 0.005 ↑ 1.0 16 1

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

58. 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
59. 0.004 0.004 ↑ 1.0 8 1

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

60. 1.008 2.327 ↑ 1.0 4,818 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 189kB
61. 1.319 1.319 ↑ 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.319 rows=4,818 loops=1)

  • Filter: (NOT nnjl_remove)
  • Rows Removed by Filter: 292
62. 5.924 171,088.613 ↓ 1,259.0 1,259 1

Materialize (cost=2,354,618.65..4,401,440.76 rows=1 width=1,346) (actual time=1,291.332..171,088.613 rows=1,259 loops=1)

63. 3.773 171,082.689 ↓ 1,259.0 1,259 1

Nested Loop (cost=2,354,618.65..4,401,440.76 rows=1 width=1,346) (actual time=1,291.319..171,082.689 rows=1,259 loops=1)

64. 243.369 171,068.676 ↓ 640.0 1,280 1

Nested Loop (cost=2,354,617.13..4,401,436.98 rows=2 width=1,346) (actual time=1,291.260..171,068.676 rows=1,280 loops=1)

  • Join Filter: (ent_2.negociacion_id = vism_bi_negociaciones_cabecera.negociacion_id)
  • Rows Removed by Join Filter: 1,207,224
65. 2.623 967.751 ↓ 1,364.0 1,364 1

Merge Join (cost=2,354,602.63..2,354,621.71 rows=1 width=96) (actual time=952.216..967.751 rows=1,364 loops=1)

  • Merge Cond: (sub.pedido_id = ent_4.id)
66. 1.253 389.309 ↓ 276.0 1,380 1

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

  • Sort Key: sub.pedido_id, sub.ae_nombre, sub.total_imp_sum
  • Sort Method: quicksort Memory: 156kB
67. 0.298 388.056 ↓ 276.0 1,380 1

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

  • Filter: (sub.rn <= 2)
  • Rows Removed by Filter: 409
68. 1.121 387.758 ↓ 119.3 1,789 1

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

69. 0.935 386.637 ↓ 119.3 1,789 1

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

  • Sort Key: pp_2.pedido_id, (max((sum(pp_2.total))))
  • Sort Method: quicksort Memory: 198kB
70. 1.201 385.702 ↓ 119.3 1,789 1

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

  • Group Key: pp_2.pedido_id, oae.id, oae.nombre, sum(pp_2.total), sum(pp_2.cajas)
71. 2.120 384.501 ↓ 119.3 1,789 1

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

  • Group Key: pp_2.pedido_id, oae.id, oae.nombre
72. 1.407 382.381 ↓ 264.4 3,966 1

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

  • Hash Cond: ("*SELECT* 1_2".producto_id = pp_2.producto_id)
  • Join Filter: ((sub_1.pedido_producto_categoria_id IS NULL) OR ("*SELECT* 1_2".producto_categoria_id = sub_1.pedido_producto_categoria_id))
  • Rows Removed by Join Filter: 13
73. 56.453 226.712 ↓ 14.2 483 1

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

  • Join Filter: (oaee.entidad_id = "*SELECT* 1_2".producto_id)
  • Rows Removed by Join Filter: 511,338
74. 0.100 139.142 ↑ 1.2 1,073 1

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

75. 0.001 0.011 ↓ 0.0 0 1

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

76. 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: ($44 IS NOT NULL)
77.          

Initplan (for Result)

78. 0.008 0.008 ↓ 0.0 0 1

Seq Scan on materialized_views mv_6 (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
79. 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)

80. 0.133 139.031 ↓ 1.0 1,073 1

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

81. 0.190 138.898 ↓ 1.0 1,073 1

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

  • One-Time Filter: ($45 IS NOT NULL)
82.          

Initplan (for Result)

83. 0.014 0.014 ↑ 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.014 rows=1 loops=1)

  • Filter: ((NOT active) AND ((matviewname)::text = 'vism_bi_productos'::text))
  • Rows Removed by Filter: 32
84. 3.300 138.694 ↓ 1.0 1,073 1

HashAggregate (cost=468,371.24..468,387.18 rows=1,063 width=293) (actual time=137.977..138.694 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 24) 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 25), ','::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 26) 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
85. 1.350 135.394 ↓ 1.0 1,073 1

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

  • Hash Cond: (pc_3.categoria_id = c_1.id)
86. 0.537 134.037 ↓ 1.0 1,073 1

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

  • Hash Cond: (ent_7.familia_id = f_1.id)
87. 1.125 133.490 ↓ 1.0 1,073 1

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

88. 0.740 130.219 ↓ 1.0 1,073 1

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

  • Hash Cond: (ent_7.id = pc_3.producto_id)
89. 1.314 128.561 ↑ 1.0 1,063 1

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

  • Merge Cond: (ent_7.id = ent_8.id)
90. 0.946 0.946 ↑ 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.008..0.946 rows=1,063 loops=1)

91. 0.495 126.301 ↓ 1.0 1,058 1

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

92. 104.748 125.806 ↓ 1.0 1,058 1

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

  • Group Key: ent_8.id
93. 4.832 8.242 ↓ 2.9 6,408 1

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

  • Sort Key: ent_8.id
  • Sort Method: quicksort Memory: 1,640kB
94. 1.322 3.410 ↓ 2.9 6,408 1

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

  • Hash Cond: (ent_8.empresa_id = npf_1.empresa_id)
95. 0.415 1.911 ↓ 1.0 1,068 1

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

  • Hash Cond: (pc_4.producto_id = ent_8.id)
96. 0.456 0.678 ↓ 1.0 1,030 1

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

  • Group Key: pc_4.empresa_id, pc_4.producto_id, pc_4.categoria_id
97. 0.222 0.222 ↑ 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.006..0.222 rows=1,030 loops=1)

  • Filter: (NOT nnjl_remove)
98. 0.347 0.818 ↓ 1.0 1,058 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 131kB
99. 0.471 0.471 ↓ 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.471 rows=1,058 loops=1)

  • Filter: ((personalizacion IS NOT NULL) AND ((personalizacion)::text <> ''::text))
  • Rows Removed by Filter: 5
100. 0.006 0.177 ↑ 1.0 6 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
101. 0.171 0.171 ↑ 1.0 6 1

Seq Scan on nnmas_personal_fields npf_1 (cost=0.00..4.06 rows=6 width=32) (actual time=0.031..0.171 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
102.          

SubPlan (for GroupAggregate)

103. 12.816 12.816 ↑ 1.0 1 4,272

Index Scan using nnmas_selects_pkey on nnmas_selects nnmas_selects_7 (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)
104. 0.000 0.000 ↓ 0.0 0

Seq Scan on nnmas_selects nnmas_selects_8 (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))))
105. 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_8.empresa_id) AND (id = (NULLIF(lower(NULLIF(replace((((ent_8.personalizacion)::json -> (npf_1.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text))::integer))
106. 0.214 0.918 ↓ 1.0 1,030 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 41kB
107. 0.114 0.704 ↓ 1.0 1,030 1

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

108. 0.386 0.590 ↓ 1.0 1,030 1

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

  • Group Key: pc_5.empresa_id, pc_5.producto_id, pc_5.categoria_id
109. 0.204 0.204 ↑ 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.005..0.204 rows=1,030 loops=1)

  • Filter: (NOT nnjl_remove)
110. 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)
111. 0.004 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
112. 0.006 0.006 ↑ 1.0 16 1

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

113. 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
114. 0.005 0.005 ↑ 1.0 8 1

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

115. 30.802 31.117 ↓ 28.1 477 1,073

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

116. 0.160 0.315 ↓ 28.1 477 1

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

  • Hash Cond: (oaee.objetivo_agrupacion_entidad_id = oae.id)
117. 0.132 0.132 ↑ 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.132 rows=477 loops=1)

  • Filter: (NOT nnjl_remove)
  • Rows Removed by Filter: 223
118. 0.004 0.023 ↓ 13.0 13 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
119. 0.019 0.019 ↓ 13.0 13 1

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

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

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 264kB
121. 1.964 153.002 ↑ 2.0 4,818 1

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

  • Hash Cond: (sub_1.id = pp_2.id)
122. 0.714 148.505 ↑ 2.1 4,818 1

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

  • Filter: (sub_1.rn <= 1)
  • Rows Removed by Filter: 29
123. 3.592 147.791 ↑ 6.2 4,847 1

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

124. 2.306 144.199 ↑ 6.2 4,847 1

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

  • Sort Key: pp_3.id, (min("*SELECT* 1_3".producto_categoria_id))
  • Sort Method: quicksort Memory: 565kB
125. 2.793 141.893 ↑ 6.2 4,847 1

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

  • Group Key: pp_3.id, pp_3.pedido_id, pp_3.producto_id, "*SELECT* 1_3".producto_categoria_id
126. 1.028 139.100 ↑ 6.2 4,847 1

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

  • Hash Cond: ("*SELECT* 1_3".producto_id = pp_3.producto_id)
127. 0.067 135.754 ↑ 1.2 1,073 1

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

128. 0.001 0.012 ↓ 0.0 0 1

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

129. 0.002 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: ($32 IS NOT NULL)
130.          

Initplan (for Result)

131. 0.009 0.009 ↓ 0.0 0 1

Seq Scan on materialized_views mv_4 (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
132. 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)

133. 0.117 135.675 ↓ 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.057..135.675 rows=1,073 loops=1)

134. 0.155 135.558 ↓ 1.0 1,073 1

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

  • One-Time Filter: ($33 IS NOT NULL)
135.          

Initplan (for Result)

136. 0.013 0.013 ↑ 1.0 1 1

Seq Scan on materialized_views mv_5 (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
137. 2.913 135.390 ↓ 1.0 1,073 1

HashAggregate (cost=468,371.24..468,387.18 rows=1,063 width=293) (actual time=135.039..135.390 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 19) 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 20), ','::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 21) 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
138. 1.323 132.477 ↓ 1.0 1,073 1

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

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

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

  • Hash Cond: (ent_9.familia_id = f_2.id)
140. 1.074 130.612 ↓ 1.0 1,073 1

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

141. 0.664 127.392 ↓ 1.0 1,073 1

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

  • Hash Cond: (ent_9.id = pc_6.producto_id)
142. 1.349 125.809 ↑ 1.0 1,063 1

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

  • Merge Cond: (ent_9.id = ent_10.id)
143. 0.805 0.805 ↑ 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.805 rows=1,063 loops=1)

144. 0.529 123.655 ↓ 1.0 1,058 1

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

145. 102.489 123.126 ↓ 1.0 1,058 1

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

  • Group Key: ent_10.id
146. 4.380 7.821 ↓ 2.9 6,408 1

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

  • Sort Key: ent_10.id
  • Sort Method: quicksort Memory: 1,640kB
147. 1.332 3.441 ↓ 2.9 6,408 1

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

  • Hash Cond: (ent_10.empresa_id = npf_2.empresa_id)
148. 0.401 1.930 ↓ 1.0 1,068 1

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

  • Hash Cond: (pc_7.producto_id = ent_10.id)
149. 0.486 0.710 ↓ 1.0 1,030 1

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

  • Group Key: pc_7.empresa_id, pc_7.producto_id, pc_7.categoria_id
150. 0.224 0.224 ↑ 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.006..0.224 rows=1,030 loops=1)

  • Filter: (NOT nnjl_remove)
151. 0.385 0.819 ↓ 1.0 1,058 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 131kB
152. 0.434 0.434 ↓ 1.0 1,058 1

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

  • Filter: ((personalizacion IS NOT NULL) AND ((personalizacion)::text <> ''::text))
  • Rows Removed by Filter: 5
153. 0.006 0.179 ↑ 1.0 6 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
154. 0.173 0.173 ↑ 1.0 6 1

Seq Scan on nnmas_personal_fields npf_2 (cost=0.00..4.06 rows=6 width=32) (actual time=0.033..0.173 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
155.          

SubPlan (for GroupAggregate)

156. 12.816 12.816 ↑ 1.0 1 4,272

Index Scan using nnmas_selects_pkey on nnmas_selects nnmas_selects_5 (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)
157. 0.000 0.000 ↓ 0.0 0

Seq Scan on nnmas_selects nnmas_selects_6 (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))))
158. 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_10.empresa_id) AND (id = (NULLIF(lower(NULLIF(replace((((ent_10.personalizacion)::json -> (npf_2.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text))::integer))
159. 0.204 0.919 ↓ 1.0 1,030 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 41kB
160. 0.113 0.715 ↓ 1.0 1,030 1

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

161. 0.405 0.602 ↓ 1.0 1,030 1

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

  • Group Key: pc_8.empresa_id, pc_8.producto_id, pc_8.categoria_id
162. 0.197 0.197 ↑ 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.012..0.197 rows=1,030 loops=1)

  • Filter: (NOT nnjl_remove)
163. 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)
164. 0.008 0.013 ↑ 1.0 16 1

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

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

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

166. 0.006 0.010 ↑ 1.0 8 1

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

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

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

168. 1.092 2.318 ↑ 1.0 4,818 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 208kB
169. 1.226 1.226 ↑ 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.007..1.226 rows=4,818 loops=1)

  • Filter: (NOT nnjl_remove)
  • Rows Removed by Filter: 292
170. 1.112 2.533 ↑ 1.0 4,818 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 283kB
171. 1.421 1.421 ↑ 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.009..1.421 rows=4,818 loops=1)

  • Filter: (NOT nnjl_remove)
  • Rows Removed by Filter: 292
172. 0.873 575.819 ↓ 1,364.0 1,364 1

Materialize (cost=1,412,094.90..1,412,113.89 rows=1 width=40) (actual time=563.480..575.819 rows=1,364 loops=1)

173. 1.368 574.946 ↓ 863.0 863 1

Merge Join (cost=1,412,094.90..1,412,113.89 rows=1 width=40) (actual time=563.478..574.946 rows=863 loops=1)

  • Merge Cond: (ent_4.id = sub_2.pedido_id)
174. 2.075 165.581 ↓ 3.8 908 1

Merge Semi Join (cost=469,587.16..469,605.33 rows=239 width=28) (actual time=160.326..165.581 rows=908 loops=1)

  • Merge Cond: (ent_2.pedido_id = ent_4.id)
175. 0.675 2.228 ↓ 1.7 939 1

Sort (cost=112.16..113.51 rows=540 width=20) (actual time=1.834..2.228 rows=939 loops=1)

  • Sort Key: ent_2.pedido_id
  • Sort Method: quicksort Memory: 99kB
176. 0.326 1.553 ↓ 1.8 972 1

Hash Join (cost=54.10..87.65 rows=540 width=20) (actual time=1.040..1.553 rows=972 loops=1)

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

Seq Scan on negociaciones_pedido ent_2 (cost=0.00..25.21 rows=995 width=16) (actual time=0.016..0.224 rows=995 loops=1)

  • Filter: (NOT nnjl_remove)
  • Rows Removed by Filter: 26
178. 0.359 1.003 ↓ 2.0 1,107 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 228kB
179. 0.627 0.644 ↓ 2.0 1,107 1

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

  • Filter: ((NOT nnjl_remove) AND (NOT (hashed SubPlan 5)))
  • Rows Removed by Filter: 88
180.          

SubPlan (for Seq Scan)

181. 0.017 0.017 ↑ 1.0 7 1

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

  • Filter: sysadmin
  • Rows Removed by Filter: 15
182. 0.520 161.278 ↓ 2.0 917 1

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

183. 1.406 160.758 ↓ 2.0 917 1

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

  • Merge Cond: (ent_4.id = pp_1.pedido_id)
184. 0.616 1.105 ↓ 2.0 948 1

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

  • Sort Key: ent_4.id
  • Sort Method: quicksort Memory: 69kB
185. 0.482 0.489 ↓ 2.0 948 1

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

  • Filter: ((NOT nnjl_remove) AND (NOT (hashed SubPlan 6)))
  • Rows Removed by Filter: 51
186.          

SubPlan (for Seq Scan)

187. 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
188. 0.755 158.247 ↓ 1.0 919 1

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

  • Sort Key: pp_1.pedido_id
  • Sort Method: quicksort Memory: 68kB
189. 1.074 157.492 ↓ 1.0 919 1

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

  • Group Key: pp_1.pedido_id
190. 0.949 156.418 ↑ 6.2 4,847 1

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

  • Hash Cond: ("*SELECT* 1_1".producto_id = pp_1.producto_id)
191. 0.093 153.200 ↑ 1.2 1,073 1

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

192. 0.001 0.017 ↓ 0.0 0 1

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

193. 0.007 0.016 ↓ 0.0 0 1

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

  • One-Time Filter: ($113 IS NOT NULL)
194.          

Initplan (for Result)

195. 0.009 0.009 ↓ 0.0 0 1

Seq Scan on materialized_views mv_18 (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
196. 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)

197. 0.119 153.090 ↓ 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=152.391..153.090 rows=1,073 loops=1)

198. 0.145 152.971 ↓ 1.0 1,073 1

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

  • One-Time Filter: ($114 IS NOT NULL)
199.          

Initplan (for Result)

200. 0.017 0.017 ↑ 1.0 1 1

Seq Scan on materialized_views mv_19 (cost=0.00..14.50 rows=1 width=4) (actual time=0.012..0.017 rows=1 loops=1)

  • Filter: ((NOT active) AND ((matviewname)::text = 'vism_bi_productos'::text))
  • Rows Removed by Filter: 32
201. 2.999 152.809 ↓ 1.0 1,073 1

HashAggregate (cost=468,371.24..468,387.18 rows=1,063 width=293) (actual time=152.363..152.809 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 56) 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 57), ','::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 58) 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
202. 1.333 149.810 ↓ 1.0 1,073 1

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

  • Hash Cond: (pc_9.categoria_id = c_3.id)
203. 0.513 148.470 ↓ 1.0 1,073 1

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

  • Hash Cond: (ent_11.familia_id = f_3.id)
204. 5.156 147.947 ↓ 1.0 1,073 1

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

205. 0.700 140.645 ↓ 1.0 1,073 1

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

  • Hash Cond: (ent_11.id = pc_9.producto_id)
206. 1.309 139.029 ↑ 1.0 1,063 1

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

  • Merge Cond: (ent_11.id = ent_12.id)
207. 0.924 0.924 ↑ 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.026..0.924 rows=1,063 loops=1)

208. 0.475 136.796 ↓ 1.0 1,058 1

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

209. 115.420 136.321 ↓ 1.0 1,058 1

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

  • Group Key: ent_12.id
210. 4.507 8.085 ↓ 2.9 6,408 1

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

  • Sort Key: ent_12.id
  • Sort Method: quicksort Memory: 1,640kB
211. 1.353 3.578 ↓ 2.9 6,408 1

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

  • Hash Cond: (ent_12.empresa_id = npf_3.empresa_id)
212. 0.387 2.041 ↓ 1.0 1,068 1

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

  • Hash Cond: (pc_10.producto_id = ent_12.id)
213. 0.463 0.689 ↓ 1.0 1,030 1

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

  • Group Key: pc_10.empresa_id, pc_10.producto_id, pc_10.categoria_id
214. 0.226 0.226 ↑ 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.007..0.226 rows=1,030 loops=1)

  • Filter: (NOT nnjl_remove)
215. 0.372 0.965 ↓ 1.0 1,058 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 131kB
216. 0.593 0.593 ↓ 1.0 1,058 1

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

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

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
218. 0.180 0.180 ↑ 1.0 6 1

Seq Scan on nnmas_personal_fields npf_3 (cost=0.00..4.06 rows=6 width=32) (actual time=0.041..0.180 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
219.          

SubPlan (for GroupAggregate)

220. 12.816 12.816 ↑ 1.0 1 4,272

Index Scan using nnmas_selects_pkey on nnmas_selects nnmas_selects_17 (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_12.personalizacion)::json -> (npf_3.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text))::integer)
  • Filter: (empresa_id = ent_12.empresa_id)
221. 0.000 0.000 ↓ 0.0 0

Seq Scan on nnmas_selects nnmas_selects_18 (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))))
222. 0.000 0.000 ↓ 0.0 0

Seq Scan on distribuidores d_8 (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))
223. 0.208 0.916 ↓ 1.0 1,030 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 41kB
224. 0.122 0.708 ↓ 1.0 1,030 1

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

225. 0.386 0.586 ↓ 1.0 1,030 1

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

  • Group Key: pc_11.empresa_id, pc_11.producto_id, pc_11.categoria_id
226. 0.200 0.200 ↑ 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.006..0.200 rows=1,030 loops=1)

  • Filter: (NOT nnjl_remove)
227. 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)
228. 0.005 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
229. 0.005 0.005 ↑ 1.0 16 1

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

230. 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
231. 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)

232. 0.990 2.269 ↑ 1.0 4,818 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 189kB
233. 1.279 1.279 ↑ 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.010..1.279 rows=4,818 loops=1)

  • Filter: (NOT nnjl_remove)
  • Rows Removed by Filter: 292
234. 0.951 407.997 ↓ 174.8 874 1

Materialize (cost=942,507.73..942,507.93 rows=5 width=12) (actual time=403.142..407.997 rows=874 loops=1)

235. 3.174 407.046 ↓ 174.8 874 1

GroupAggregate (cost=942,507.73..942,507.87 rows=5 width=4) (actual time=403.135..407.046 rows=874 loops=1)

  • Group Key: sub_2.pedido_id
236. 1.369 403.872 ↓ 276.0 1,380 1

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

  • Sort Key: sub_2.pedido_id, sub_2.ae_nombre, sub_2.total_imp_sum
  • Sort Method: quicksort Memory: 156kB
237. 0.288 402.503 ↓ 276.0 1,380 1

Subquery Scan on sub_2 (cost=942,507.19..942,507.68 rows=5 width=56) (actual time=401.023..402.503 rows=1,380 loops=1)

  • Filter: (sub_2.rn <= 2)
  • Rows Removed by Filter: 409
238. 1.094 402.215 ↓ 119.3 1,789 1

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

239. 0.939 401.121 ↓ 119.3 1,789 1

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

  • Sort Key: pp_4.pedido_id, (max((sum(pp_4.total))))
  • Sort Method: quicksort Memory: 198kB
240. 1.155 400.182 ↓ 119.3 1,789 1

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

  • Group Key: pp_4.pedido_id, oae_1.id, oae_1.nombre, sum(pp_4.total), sum(pp_4.cajas)
241. 2.093 399.027 ↓ 119.3 1,789 1

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

  • Group Key: pp_4.pedido_id, oae_1.id, oae_1.nombre
242. 1.381 396.934 ↓ 264.4 3,966 1

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

  • Hash Cond: ("*SELECT* 1_4".producto_id = pp_4.producto_id)
  • Join Filter: ((sub_3.pedido_producto_categoria_id IS NULL) OR ("*SELECT* 1_4".producto_categoria_id = sub_3.pedido_producto_categoria_id))
  • Rows Removed by Join Filter: 13
243. 55.410 239.807 ↓ 14.2 483 1

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

  • Join Filter: (oaee_1.entidad_id = "*SELECT* 1_4".producto_id)
  • Rows Removed by Join Filter: 511,338
244. 0.093 155.426 ↑ 1.2 1,073 1

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

245. 0.001 0.013 ↓ 0.0 0 1

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

246. 0.002 0.012 ↓ 0.0 0 1

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

  • One-Time Filter: ($20 IS NOT NULL)
247.          

Initplan (for Result)

248. 0.010 0.010 ↓ 0.0 0 1

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

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

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

250. 0.132 155.320 ↓ 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=154.305..155.320 rows=1,073 loops=1)

251. 0.201 155.188 ↓ 1.0 1,073 1

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

  • One-Time Filter: ($21 IS NOT NULL)
252.          

Initplan (for Result)

253. 0.015 0.015 ↑ 1.0 1 1

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

  • Filter: ((NOT active) AND ((matviewname)::text = 'vism_bi_productos'::text))
  • Rows Removed by Filter: 32
254. 3.287 154.972 ↓ 1.0 1,073 1

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

  • Group Key: (clock_timestamp())::timestamp without time zone, ent_13.empresa_id, ent_13.id, ent_13.cod_ext, ent_13.descripcion, ent_13.precio, ent_13.precio_distribuidor, CASE WHEN (ent_13.precio_distribuidor IS NOT NULL) THEN ent_13.precio_distribuidor ELSE ent_13.precio END, ent_13.modulos, c_4.id, c_4.nombre, m_4.id, m_4.nombre, f_4.id, f_4.nombre, ent_13.personalizacion, ((json_object_agg(npf_4.nombre, CASE WHEN ((NULLIF(lower(NULLIF(replace((((ent_14.personalizacion)::json -> (npf_4.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) IS NOT NULL) AND (((npf_4.tipo)::text = 'select'::text) OR ((npf_4.tipo)::text = 'select_mandatory'::text) OR ((npf_4.tipo)::text = 'select_readonly'::text)) AND (NULLIF(lower(NULLIF(replace((((ent_14.personalizacion)::json -> (npf_4.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) ~ '^[0-9]'::text)) THEN (SubPlan 14) WHEN ((NULLIF(lower(NULLIF(replace((((ent_14.personalizacion)::json -> (npf_4.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) IS NOT NULL) AND ((npf_4.tipo)::text = 'selectmultiple'::text) AND (NULLIF(lower(NULLIF(replace((((ent_14.personalizacion)::json -> (npf_4.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) ~ '^[0-9]'::text)) THEN (array_to_string((SubPlan 15), ','::text))::character varying WHEN ((NULLIF(lower(NULLIF(replace((((ent_14.personalizacion)::json -> (npf_4.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) IS NOT NULL) AND ((npf_4.tipo)::text ~~* 'selectreference%'::text) AND ((npf_4.nombre)::text = 'distribuidor'::text) AND (NULLIF(lower(NULLIF(replace((((ent_14.personalizacion)::json -> (npf_4.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) ~ '^[0-9]'::text)) THEN (SubPlan 16) WHEN (NULLIF(lower(NULLIF(replace((((ent_14.personalizacion)::json -> (npf_4.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) IS NOT NULL) THEN (NULLIF(lower(NULLIF(replace((((ent_14.personalizacion)::json -> (npf_4.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text))::character varying ELSE NULL::character varying END))::text), ent_13.nnjl_remove
255. 1.360 151.685 ↓ 1.0 1,073 1

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

  • Hash Cond: (pc_12.categoria_id = c_4.id)
256. 0.494 150.318 ↓ 1.0 1,073 1

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

  • Hash Cond: (ent_13.familia_id = f_4.id)
257. 1.139 149.811 ↓ 1.0 1,073 1

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

258. 0.683 146.526 ↓ 1.0 1,073 1

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

  • Hash Cond: (ent_13.id = pc_12.producto_id)
259. 1.326 144.947 ↑ 1.0 1,063 1

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

  • Merge Cond: (ent_13.id = ent_14.id)
260. 0.875 0.875 ↑ 1.0 1,063 1

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

261. 0.521 142.746 ↓ 1.0 1,058 1

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

262. 117.308 142.225 ↓ 1.0 1,058 1

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

  • Group Key: ent_14.id
263. 8.661 12.101 ↓ 2.9 6,408 1

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

  • Sort Key: ent_14.id
  • Sort Method: quicksort Memory: 1,640kB
264. 1.308 3.440 ↓ 2.9 6,408 1

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

  • Hash Cond: (ent_14.empresa_id = npf_4.empresa_id)
265. 0.421 1.955 ↓ 1.0 1,068 1

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

  • Hash Cond: (pc_13.producto_id = ent_14.id)
266. 0.464 0.673 ↓ 1.0 1,030 1

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

  • Group Key: pc_13.empresa_id, pc_13.producto_id, pc_13.categoria_id
267. 0.209 0.209 ↑ 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.209 rows=1,030 loops=1)

  • Filter: (NOT nnjl_remove)
268. 0.370 0.861 ↓ 1.0 1,058 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 131kB
269. 0.491 0.491 ↓ 1.0 1,058 1

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

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

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
271. 0.174 0.174 ↑ 1.0 6 1

Seq Scan on nnmas_personal_fields npf_4 (cost=0.00..4.06 rows=6 width=32) (actual time=0.033..0.174 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
272.          

SubPlan (for GroupAggregate)

273. 12.816 12.816 ↑ 1.0 1 4,272

Index Scan using nnmas_selects_pkey on nnmas_selects nnmas_selects_3 (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_14.personalizacion)::json -> (npf_4.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text))::integer)
  • Filter: (empresa_id = ent_14.empresa_id)
274. 0.000 0.000 ↓ 0.0 0

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

  • Filter: ((empresa_id = ent_14.empresa_id) AND ((id)::text = ANY (string_to_array(NULLIF(lower(NULLIF(replace((((ent_14.personalizacion)::json -> (npf_4.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text), ','::text))))
275. 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_14.empresa_id) AND (id = (NULLIF(lower(NULLIF(replace((((ent_14.personalizacion)::json -> (npf_4.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text))::integer))
276. 0.198 0.896 ↓ 1.0 1,030 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 41kB
277. 0.116 0.698 ↓ 1.0 1,030 1

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

278. 0.394 0.582 ↓ 1.0 1,030 1

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

  • Group Key: pc_14.empresa_id, pc_14.producto_id, pc_14.categoria_id
279. 0.188 0.188 ↑ 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.188 rows=1,030 loops=1)

  • Filter: (NOT nnjl_remove)
280. 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_13.marca_id)
281. 0.007 0.013 ↑ 1.0 16 1

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

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

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

283. 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
284. 0.005 0.005 ↑ 1.0 8 1

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

285. 28.623 28.971 ↓ 28.1 477 1,073

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

286. 0.169 0.348 ↓ 28.1 477 1

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

  • Hash Cond: (oaee_1.objetivo_agrupacion_entidad_id = oae_1.id)
287. 0.143 0.143 ↑ 1.0 477 1

Seq Scan on objetivo_agrupacion_entidades_entidad oaee_1 (cost=0.00..15.00 rows=477 width=8) (actual time=0.009..0.143 rows=477 loops=1)

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

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
289. 0.029 0.029 ↓ 13.0 13 1

Seq Scan on objetivo_agrupacion_entidades oae_1 (cost=0.00..1.35 rows=1 width=36) (actual time=0.023..0.029 rows=13 loops=1)

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

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 264kB
291. 1.966 154.472 ↑ 2.0 4,818 1

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

  • Hash Cond: (sub_3.id = pp_4.id)
292. 0.793 150.083 ↑ 2.1 4,818 1

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

  • Filter: (sub_3.rn <= 1)
  • Rows Removed by Filter: 29
293. 3.921 149.290 ↑ 6.2 4,847 1

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

294. 2.336 145.369 ↑ 6.2 4,847 1

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

  • Sort Key: pp_5.id, (min("*SELECT* 1_5".producto_categoria_id))
  • Sort Method: quicksort Memory: 565kB
295. 2.752 143.033 ↑ 6.2 4,847 1

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

  • Group Key: pp_5.id, pp_5.pedido_id, pp_5.producto_id, "*SELECT* 1_5".producto_categoria_id
296. 0.992 140.281 ↑ 6.2 4,847 1

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

  • Hash Cond: ("*SELECT* 1_5".producto_id = pp_5.producto_id)
297. 0.073 137.031 ↑ 1.2 1,073 1

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

298. 0.000 0.012 ↓ 0.0 0 1

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

299. 0.003 0.012 ↓ 0.0 0 1

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

  • One-Time Filter: ($8 IS NOT NULL)
300.          

Initplan (for Result)

301. 0.009 0.009 ↓ 0.0 0 1

Seq Scan on materialized_views mv (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
302. 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)

303. 0.107 136.946 ↓ 1.0 1,073 1

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

304. 0.164 136.839 ↓ 1.0 1,073 1

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

  • One-Time Filter: ($9 IS NOT NULL)
305.          

Initplan (for Result)

306. 0.013 0.013 ↑ 1.0 1 1

Seq Scan on materialized_views mv_1 (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
307. 2.921 136.662 ↓ 1.0 1,073 1

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

  • Group Key: (clock_timestamp())::timestamp without time zone, ent_15.empresa_id, ent_15.id, ent_15.cod_ext, ent_15.descripcion, ent_15.precio, ent_15.precio_distribuidor, CASE WHEN (ent_15.precio_distribuidor IS NOT NULL) THEN ent_15.precio_distribuidor ELSE ent_15.precio END, ent_15.modulos, c_5.id, c_5.nombre, m_5.id, m_5.nombre, f_5.id, f_5.nombre, ent_15.personalizacion, ((json_object_agg(npf_5.nombre, CASE WHEN ((NULLIF(lower(NULLIF(replace((((ent_16.personalizacion)::json -> (npf_5.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) IS NOT NULL) AND (((npf_5.tipo)::text = 'select'::text) OR ((npf_5.tipo)::text = 'select_mandatory'::text) OR ((npf_5.tipo)::text = 'select_readonly'::text)) AND (NULLIF(lower(NULLIF(replace((((ent_16.personalizacion)::json -> (npf_5.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) ~ '^[0-9]'::text)) THEN (SubPlan 9) WHEN ((NULLIF(lower(NULLIF(replace((((ent_16.personalizacion)::json -> (npf_5.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) IS NOT NULL) AND ((npf_5.tipo)::text = 'selectmultiple'::text) AND (NULLIF(lower(NULLIF(replace((((ent_16.personalizacion)::json -> (npf_5.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) ~ '^[0-9]'::text)) THEN (array_to_string((SubPlan 10), ','::text))::character varying WHEN ((NULLIF(lower(NULLIF(replace((((ent_16.personalizacion)::json -> (npf_5.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) IS NOT NULL) AND ((npf_5.tipo)::text ~~* 'selectreference%'::text) AND ((npf_5.nombre)::text = 'distribuidor'::text) AND (NULLIF(lower(NULLIF(replace((((ent_16.personalizacion)::json -> (npf_5.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) ~ '^[0-9]'::text)) THEN (SubPlan 11) WHEN (NULLIF(lower(NULLIF(replace((((ent_16.personalizacion)::json -> (npf_5.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) IS NOT NULL) THEN (NULLIF(lower(NULLIF(replace((((ent_16.personalizacion)::json -> (npf_5.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text))::character varying ELSE NULL::character varying END))::text), ent_15.nnjl_remove
308. 1.322 133.741 ↓ 1.0 1,073 1

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

  • Hash Cond: (pc_15.categoria_id = c_5.id)
309. 0.459 132.412 ↓ 1.0 1,073 1

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

  • Hash Cond: (ent_15.familia_id = f_5.id)
310. 1.127 131.942 ↓ 1.0 1,073 1

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

311. 0.656 128.669 ↓ 1.0 1,073 1

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

  • Hash Cond: (ent_15.id = pc_15.producto_id)
312. 1.286 127.102 ↑ 1.0 1,063 1

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

  • Merge Cond: (ent_15.id = ent_16.id)
313. 0.802 0.802 ↑ 1.0 1,063 1

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

314. 0.489 125.014 ↓ 1.0 1,058 1

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

315. 103.669 124.525 ↓ 1.0 1,058 1

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

  • Group Key: ent_16.id
316. 4.590 8.040 ↓ 2.9 6,408 1

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

  • Sort Key: ent_16.id
  • Sort Method: quicksort Memory: 1,640kB
317. 1.285 3.450 ↓ 2.9 6,408 1

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

  • Hash Cond: (ent_16.empresa_id = npf_5.empresa_id)
318. 0.424 1.979 ↓ 1.0 1,068 1

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

  • Hash Cond: (pc_16.producto_id = ent_16.id)
319. 0.467 0.684 ↓ 1.0 1,030 1

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

  • Group Key: pc_16.empresa_id, pc_16.producto_id, pc_16.categoria_id
320. 0.217 0.217 ↑ 1.0 1,030 1

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

  • Filter: (NOT nnjl_remove)
321. 0.358 0.871 ↓ 1.0 1,058 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 131kB
322. 0.513 0.513 ↓ 1.0 1,058 1

Seq Scan on productos ent_16 (cost=0.00..53.29 rows=1,057 width=92) (actual time=0.016..0.513 rows=1,058 loops=1)

  • Filter: ((personalizacion IS NOT NULL) AND ((personalizacion)::text <> ''::text))
  • Rows Removed by Filter: 5
323. 0.008 0.186 ↑ 1.0 6 1

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

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

Seq Scan on nnmas_personal_fields npf_5 (cost=0.00..4.06 rows=6 width=32) (actual time=0.031..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
325.          

SubPlan (for GroupAggregate)

326. 12.816 12.816 ↑ 1.0 1 4,272

Index Scan using nnmas_selects_pkey on nnmas_selects nnmas_selects_1 (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_16.personalizacion)::json -> (npf_5.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text))::integer)
  • Filter: (empresa_id = ent_16.empresa_id)
327. 0.000 0.000 ↓ 0.0 0

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

  • Filter: ((empresa_id = ent_16.empresa_id) AND ((id)::text = ANY (string_to_array(NULLIF(lower(NULLIF(replace((((ent_16.personalizacion)::json -> (npf_5.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text), ','::text))))
328. 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_16.empresa_id) AND (id = (NULLIF(lower(NULLIF(replace((((ent_16.personalizacion)::json -> (npf_5.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text))::integer))
329. 0.209 0.911 ↓ 1.0 1,030 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 41kB
330. 0.113 0.702 ↓ 1.0 1,030 1

Subquery Scan on pc_15 (cost=28.02..48.43 rows=1,020 width=8) (actual time=0.473..0.702 rows=1,030 loops=1)

331. 0.377 0.589 ↓ 1.0 1,030 1

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

  • Group Key: pc_17.empresa_id, pc_17.producto_id, pc_17.categoria_id
332. 0.212 0.212 ↑ 1.0 1,030 1

Seq Scan on productos_categoria pc_17 (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)
333. 2.146 2.146 ↑ 1.0 1 1,073

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

  • Index Cond: (id = ent_15.marca_id)
334. 0.005 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
335. 0.006 0.006 ↑ 1.0 16 1

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

336. 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
337. 0.005 0.005 ↑ 1.0 8 1

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

338. 0.999 2.258 ↑ 1.0 4,818 1

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

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

Seq Scan on productos_pedido pp_5 (cost=0.00..130.10 rows=4,818 width=12) (actual time=0.008..1.259 rows=4,818 loops=1)

  • Filter: (NOT nnjl_remove)
  • Rows Removed by Filter: 292
340. 1.131 2.423 ↑ 1.0 4,818 1

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

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

Seq Scan on productos_pedido pp_4 (cost=0.00..130.10 rows=4,818 width=24) (actual time=0.015..1.292 rows=4,818 loops=1)

  • Filter: (NOT nnjl_remove)
  • Rows Removed by Filter: 292
342. 122.760 169,857.556 ↑ 2.5 886 1,364

Append (cost=14.50..2,046,787.96 rows=2,185 width=1,258) (actual time=0.416..124.529 rows=886 loops=1,364)

343. 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: ($56 IS NOT NULL)
344.          

Initplan (for Result)

345. 0.016 0.016 ↓ 0.0 0 1

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

  • Filter: (active AND ((matviewname)::text = 'vism_bi_negociaciones_cabecera'::text))
  • Rows Removed by Filter: 33
346. 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 = $3)
347. 384.638 169,734.796 ↑ 2.5 886 1,364

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

  • One-Time Filter: ($57 IS NOT NULL)
348.          

Initplan (for Result)

349. 0.010 0.010 ↑ 1.0 1 1

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

  • Filter: ((NOT active) AND ((matviewname)::text = 'vism_bi_negociaciones_cabecera'::text))
  • Rows Removed by Filter: 32
350. 1,111.720 169,350.148 ↑ 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.415..124.157 rows=886 loops=1,364)

  • Hash Cond: (vism_bi_negociaciones.negociacion_id = ent_17.negociacion_id)
351. 749.050 168,237.124 ↑ 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.413..123.341 rows=886 loops=1,364)

  • Hash Cond: (vism_bi_negociaciones.negociacion_id = ent_19.negociacion_id)
352. 144.584 167,342.340 ↑ 2.5 886 1,364

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

353. 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: ($61 IS NOT NULL)
354.          

Initplan (for Result)

355. 0.005 0.005 ↓ 0.0 0 1

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

  • Filter: (active AND ((matviewname)::text = 'vism_bi_negociaciones'::text))
  • Rows Removed by Filter: 33
356. 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 = $3)
357. 418.739 167,197.756 ↑ 2.5 886 1,364

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

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

Initplan (for Result)

359. 0.009 0.009 ↑ 1.0 1 1

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

  • Filter: ((NOT active) AND ((matviewname)::text = 'vism_bi_negociaciones'::text))
  • Rows Removed by Filter: 32
360. 15,862.103 166,779.008 ↑ 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..122.272 rows=886 loops=1,364)

  • Hash Cond: ("*SELECT* 1_7".establecimiento_id = ent_22.establecimiento_id)
361. 563.332 150,893.864 ↑ 1.0 3,555 1,364

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

362. 0.000 0.000 ↓ 0.0 0 1,364

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

363. 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: ($64 IS NOT NULL)
364.          

Initplan (for Result)

365. 0.007 0.007 ↓ 0.0 0 1

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

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

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

367. 1,068.012 150,330.532 ↑ 1.0 3,555 1,364

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

368. 1,144.380 149,262.520 ↑ 1.0 3,555 1,364

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

  • One-Time Filter: ($65 IS NOT NULL)
369.          

Initplan (for Result)

370. 0.016 0.016 ↑ 1.0 1 1

Seq Scan on materialized_views mv_13 (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
371. 5,776.540 148,118.124 ↑ 1.0 3,555 1,364

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

  • Merge Cond: (ent_23.id = ent_24.id)
372. 78,671.428 141,891.464 ↑ 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.026 rows=3,555 loops=1,364)

  • Join Filter: ((pr.id)::text = "substring"((ent_23.cp)::text, 1, 2))
  • Rows Removed by Join Filter: 181,986
373. 3,123.560 48,672.976 ↑ 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.684 rows=3,555 loops=1,364)

374. 5,112.272 45,549.416 ↑ 1.0 3,555 1,364

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

375. 4,838.108 35,588.124 ↑ 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.091 rows=3,555 loops=1,364)

376. 6,454.448 25,900.996 ↑ 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..18.989 rows=3,555 loops=1,364)

  • Join Filter: (pd.id = ent_23.periodicidad_id)
  • Rows Removed by Join Filter: 35,550
377. 6,511.736 14,597.528 ↑ 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.702 rows=3,555 loops=1,364)

378. 3,236.772 3,236.772 ↑ 1.0 3,555 1,364

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

379. 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_23.tipo_establecimiento_id)
380. 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)

381. 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.004..0.005 rows=11 loops=1)

382. 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_23.cliente_id)
383. 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)
384. 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_23.user_creacion)
385. 14,547.044 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)

386. 0.016 0.016 ↑ 1.0 52 1

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

387. 373.392 450.120 ↓ 1.0 3,313 1,364

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

388. 68.748 76.728 ↓ 1.0 3,313 1

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

  • Group Key: ent_24.id
389. 4.170 7.980 ↑ 1.0 6,626 1

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

  • Sort Key: ent_24.id
  • Sort Method: quicksort Memory: 1,129kB
390. 1.650 3.810 ↑ 1.0 6,626 1

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

  • Hash Cond: (ent_24.empresa_id = npf_6.empresa_id)
391. 1.990 1.990 ↓ 1.0 3,313 1

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

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

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
393. 0.168 0.168 ↑ 3.0 2 1

Seq Scan on nnmas_personal_fields npf_6 (cost=0.00..4.06 rows=6 width=32) (actual time=0.036..0.168 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
394.          

SubPlan (for GroupAggregate)

395. 0.000 0.000 ↓ 0.0 0

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

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

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

  • Filter: ((empresa_id = ent_24.empresa_id) AND ((id)::text = ANY (string_to_array(NULLIF(lower(NULLIF(replace((((ent_24.personalizacion)::json -> (npf_6.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text), ','::text))))
397. 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_24.empresa_id) AND (id = (NULLIF(lower(NULLIF(replace((((ent_24.personalizacion)::json -> (npf_6.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text))::integer))
398. 0.860 23.041 ↓ 5.6 886 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 247kB
399. 0.349 22.181 ↓ 5.6 886 1

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

  • Hash Cond: (ent_22.estado_id = ne.id)
400. 0.317 21.822 ↓ 5.6 886 1

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

  • Hash Cond: (ent_22.accion_id = na.id)
401. 0.292 21.484 ↓ 5.6 886 1

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

  • Hash Cond: (ent_22.empresa_id = emp.id)
402. 0.352 21.185 ↓ 5.6 886 1

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

  • Hash Cond: (ent_22.gestor = u.id)
403. 0.469 20.781 ↓ 5.6 886 1

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

  • Hash Cond: (ent_25.id = ent_22.id)
404. 17.456 19.091 ↓ 2.1 962 1

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

  • Group Key: ent_25.id
405. 0.476 1.635 ↓ 2.0 962 1

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

  • Hash Cond: (ent_25.empresa_id = npf_7.empresa_id)
406. 0.964 0.971 ↓ 2.1 962 1

Seq Scan on negociaciones ent_25 (cost=1.24..50.16 rows=465 width=55) (actual time=0.037..0.971 rows=962 loops=1)

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

SubPlan (for Seq Scan)

408. 0.007 0.007 ↑ 1.0 7 1

Seq Scan on users users_8 (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
409. 0.005 0.188 ↑ 3.0 1 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
410. 0.183 0.183 ↑ 3.0 1 1

Seq Scan on nnmas_personal_fields npf_7 (cost=0.00..4.06 rows=3 width=32) (actual time=0.059..0.183 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
411.          

SubPlan (for HashAggregate)

412. 0.000 0.000 ↓ 0.0 0

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

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

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

  • Filter: ((empresa_id = ent_25.empresa_id) AND ((id)::text = ANY (string_to_array(NULLIF(lower(NULLIF(replace((((ent_25.personalizacion)::json -> (npf_7.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text), ','::text))))
414. 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_25.empresa_id) AND (id = (NULLIF(lower(NULLIF(replace((((ent_25.personalizacion)::json -> (npf_7.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text))::integer))
415. 0.436 1.221 ↓ 5.6 886 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 131kB
416. 0.774 0.785 ↓ 5.6 886 1

Seq Scan on negociaciones ent_22 (cost=1.24..50.16 rows=158 width=110) (actual time=0.062..0.785 rows=886 loops=1)

  • Filter: ((NOT nnjl_remove) AND (NOT (hashed SubPlan 34)) AND (estado_id = $3))
  • Rows Removed by Filter: 309
417.          

SubPlan (for Seq Scan)

418. 0.011 0.011 ↑ 1.0 7 1

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

  • Filter: sysadmin
  • Rows Removed by Filter: 15
419. 0.010 0.052 ↑ 1.0 22 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 2kB
420. 0.027 0.042 ↑ 1.0 22 1

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

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

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

422. 0.007 0.013 ↑ 1.0 22 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 2kB
423. 0.006 0.006 ↑ 1.0 22 1

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

424. 0.001 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
425. 0.006 0.006 ↑ 1.0 5 1

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

426. 0.014 0.021 ↑ 1.0 35 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 2kB
427. 0.007 0.007 ↑ 1.0 35 1

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

428. 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
429. 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.007..0.008 rows=1 loops=1)

  • Filter: (id = $3)
  • Rows Removed by Filter: 5
430. 0.215 145.734 ↓ 3.8 908 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 47kB
431. 0.302 145.519 ↓ 3.8 908 1

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

  • Merge Cond: (ent_19.negociacion_id = ent_20.id)
432. 0.290 144.184 ↓ 2.1 911 1

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

  • Sort Key: ent_19.negociacion_id
  • Sort Method: quicksort Memory: 96kB
433. 0.260 143.894 ↓ 2.1 911 1

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

  • Hash Cond: (ent_19.pedido_id = ent_21.id)
434. 0.222 0.222 ↑ 1.0 995 1

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

  • Filter: (NOT nnjl_remove)
  • Rows Removed by Filter: 26
435. 0.207 143.412 ↓ 2.0 917 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 36kB
436. 0.291 143.205 ↓ 2.0 917 1

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

  • Merge Cond: (ent_21.id = pp_6.pedido_id)
437. 0.285 0.719 ↓ 2.0 948 1

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

  • Sort Key: ent_21.id
  • Sort Method: quicksort Memory: 69kB
438. 0.425 0.434 ↓ 2.0 948 1

Seq Scan on pedidos ent_21 (cost=1.24..35.72 rows=475 width=4) (actual time=0.043..0.434 rows=948 loops=1)

  • Filter: ((NOT nnjl_remove) AND (NOT (hashed SubPlan 31)))
  • Rows Removed by Filter: 51
439.          

SubPlan (for Seq Scan)

440. 0.009 0.009 ↑ 1.0 7 1

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

  • Filter: sysadmin
  • Rows Removed by Filter: 15
441. 0.289 142.195 ↓ 1.0 919 1

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

  • Sort Key: pp_6.pedido_id
  • Sort Method: quicksort Memory: 68kB
442. 1.070 141.906 ↓ 1.0 919 1

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

  • Group Key: pp_6.pedido_id
443. 0.977 140.836 ↑ 6.2 4,847 1

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

  • Hash Cond: ("*SELECT* 1_6".producto_id = pp_6.producto_id)
444. 0.091 137.622 ↑ 1.2 1,073 1

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

445. 0.001 0.009 ↓ 0.0 0 1

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

446. 0.002 0.008 ↓ 0.0 0 1

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

  • One-Time Filter: ($89 IS NOT NULL)
447.          

Initplan (for Result)

448. 0.006 0.006 ↓ 0.0 0 1

Seq Scan on materialized_views mv_14 (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_productos'::text))
  • Rows Removed by Filter: 33
449. 0.000 0.000 ↓ 0.0 0

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

450. 0.091 137.522 ↓ 1.0 1,073 1

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

451. 0.157 137.431 ↓ 1.0 1,073 1

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

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

Initplan (for Result)

453. 0.014 0.014 ↑ 1.0 1 1

Seq Scan on materialized_views mv_15 (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
454. 2.951 137.260 ↓ 1.0 1,073 1

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

  • Group Key: (clock_timestamp())::timestamp without time zone, ent_26.empresa_id, ent_26.id, ent_26.cod_ext, ent_26.descripcion, ent_26.precio, ent_26.precio_distribuidor, CASE WHEN (ent_26.precio_distribuidor IS NOT NULL) THEN ent_26.precio_distribuidor ELSE ent_26.precio END, ent_26.modulos, c_6.id, c_6.nombre, m_6.id, m_6.nombre, f_6.id, f_6.nombre, ent_26.personalizacion, ((json_object_agg(npf_8.nombre, CASE WHEN ((NULLIF(lower(NULLIF(replace((((ent_27.personalizacion)::json -> (npf_8.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) IS NOT NULL) AND (((npf_8.tipo)::text = 'select'::text) OR ((npf_8.tipo)::text = 'select_mandatory'::text) OR ((npf_8.tipo)::text = 'select_readonly'::text)) AND (NULLIF(lower(NULLIF(replace((((ent_27.personalizacion)::json -> (npf_8.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) ~ '^[0-9]'::text)) THEN (SubPlan 46) WHEN ((NULLIF(lower(NULLIF(replace((((ent_27.personalizacion)::json -> (npf_8.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) IS NOT NULL) AND ((npf_8.tipo)::text = 'selectmultiple'::text) AND (NULLIF(lower(NULLIF(replace((((ent_27.personalizacion)::json -> (npf_8.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) ~ '^[0-9]'::text)) THEN (array_to_string((SubPlan 47), ','::text))::character varying WHEN ((NULLIF(lower(NULLIF(replace((((ent_27.personalizacion)::json -> (npf_8.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) IS NOT NULL) AND ((npf_8.tipo)::text ~~* 'selectreference%'::text) AND ((npf_8.nombre)::text = 'distribuidor'::text) AND (NULLIF(lower(NULLIF(replace((((ent_27.personalizacion)::json -> (npf_8.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) ~ '^[0-9]'::text)) THEN (SubPlan 48) WHEN (NULLIF(lower(NULLIF(replace((((ent_27.personalizacion)::json -> (npf_8.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text) IS NOT NULL) THEN (NULLIF(lower(NULLIF(replace((((ent_27.personalizacion)::json -> (npf_8.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text))::character varying ELSE NULL::character varying END))::text), ent_26.nnjl_remove
455. 1.315 134.309 ↓ 1.0 1,073 1

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

  • Hash Cond: (pc_18.categoria_id = c_6.id)
456. 0.466 132.987 ↓ 1.0 1,073 1

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

  • Hash Cond: (ent_26.familia_id = f_6.id)
457. 1.058 132.507 ↓ 1.0 1,073 1

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

458. 0.695 129.303 ↓ 1.0 1,073 1

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

  • Hash Cond: (ent_26.id = pc_18.producto_id)
459. 1.315 127.706 ↑ 1.0 1,063 1

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

  • Merge Cond: (ent_26.id = ent_27.id)
460. 0.815 0.815 ↑ 1.0 1,063 1

Index Scan using productos_pkey on productos ent_26 (cost=0.28..152.01 rows=1,063 width=185) (actual time=0.011..0.815 rows=1,063 loops=1)

461. 0.490 125.576 ↓ 1.0 1,058 1

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

462. 104.359 125.086 ↓ 1.0 1,058 1

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

  • Group Key: ent_27.id
463. 4.368 7.911 ↓ 2.9 6,408 1

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

  • Sort Key: ent_27.id
  • Sort Method: quicksort Memory: 1,640kB
464. 1.301 3.543 ↓ 2.9 6,408 1

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

  • Hash Cond: (ent_27.empresa_id = npf_8.empresa_id)
465. 0.398 2.055 ↓ 1.0 1,068 1

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

  • Hash Cond: (pc_19.producto_id = ent_27.id)
466. 0.472 0.694 ↓ 1.0 1,030 1

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

  • Group Key: pc_19.empresa_id, pc_19.producto_id, pc_19.categoria_id
467. 0.222 0.222 ↑ 1.0 1,030 1

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

  • Filter: (NOT nnjl_remove)
468. 0.364 0.963 ↓ 1.0 1,058 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 131kB
469. 0.599 0.599 ↓ 1.0 1,058 1

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

  • Filter: ((personalizacion IS NOT NULL) AND ((personalizacion)::text <> ''::text))
  • Rows Removed by Filter: 5
470. 0.002 0.187 ↑ 1.0 6 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
471. 0.185 0.185 ↑ 1.0 6 1

Seq Scan on nnmas_personal_fields npf_8 (cost=0.00..4.06 rows=6 width=32) (actual time=0.028..0.185 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
472.          

SubPlan (for GroupAggregate)

473. 12.816 12.816 ↑ 1.0 1 4,272

Index Scan using nnmas_selects_pkey on nnmas_selects nnmas_selects_13 (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_27.personalizacion)::json -> (npf_8.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text))::integer)
  • Filter: (empresa_id = ent_27.empresa_id)
474. 0.000 0.000 ↓ 0.0 0

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

  • Filter: ((empresa_id = ent_27.empresa_id) AND ((id)::text = ANY (string_to_array(NULLIF(lower(NULLIF(replace((((ent_27.personalizacion)::json -> (npf_8.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text), ','::text))))
475. 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_27.empresa_id) AND (id = (NULLIF(lower(NULLIF(replace((((ent_27.personalizacion)::json -> (npf_8.id)::text))::text, '"'::text, ''::text), ''::text)), 'null'::text))::integer))
476. 0.208 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
477. 0.119 0.694 ↓ 1.0 1,030 1

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

478. 0.368 0.575 ↓ 1.0 1,030 1

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

  • Group Key: pc_20.empresa_id, pc_20.producto_id, pc_20.categoria_id
479. 0.207 0.207 ↑ 1.0 1,030 1

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

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

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

  • Index Cond: (id = ent_26.marca_id)
481. 0.008 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
482. 0.006 0.006 ↑ 1.0 16 1

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

483. 0.001 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
484. 0.006 0.006 ↑ 1.0 8 1

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

485. 0.985 2.237 ↑ 1.0 4,818 1

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

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

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

  • Filter: (NOT nnjl_remove)
  • Rows Removed by Filter: 292
487. 0.410 1.033 ↓ 2.0 1,107 1

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

  • Sort Key: ent_20.id
  • Sort Method: quicksort Memory: 100kB
488. 0.612 0.623 ↓ 2.0 1,107 1

Seq Scan on negociaciones ent_20 (cost=1.24..47.17 rows=554 width=4) (actual time=0.054..0.623 rows=1,107 loops=1)

  • Filter: ((NOT nnjl_remove) AND (NOT (hashed SubPlan 30)))
  • Rows Removed by Filter: 88
489.          

SubPlan (for Seq Scan)

490. 0.011 0.011 ↑ 1.0 7 1

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

  • Filter: sysadmin
  • Rows Removed by Filter: 15
491. 0.187 1.304 ↑ 1.0 532 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 42kB
492. 0.267 1.117 ↑ 1.0 532 1

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

  • Hash Cond: (ent_18.id = ent_17.negociacion_id)
493. 0.451 0.459 ↓ 2.0 1,107 1

Seq Scan on negociaciones ent_18 (cost=1.24..47.17 rows=554 width=4) (actual time=0.034..0.459 rows=1,107 loops=1)

  • Filter: ((NOT nnjl_remove) AND (NOT (hashed SubPlan 29)))
  • Rows Removed by Filter: 88
494.          

SubPlan (for Seq Scan)

495. 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.002..0.008 rows=7 loops=1)

  • Filter: sysadmin
  • Rows Removed by Filter: 15
496. 0.175 0.391 ↑ 1.0 545 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 43kB
497. 0.216 0.216 ↑ 1.0 545 1

Seq Scan on negociaciones_contraprestacion ent_17 (cost=0.00..15.62 rows=545 width=52) (actual time=0.010..0.216 rows=545 loops=1)

  • Filter: (NOT nnjl_remove)
  • Rows Removed by Filter: 17
498. 10.229 10.240 ↑ 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.008..0.008 rows=1 loops=1,280)

  • Index Cond: (id = vism_bi_negociaciones_cabecera.negociacion_visita_id)
  • Filter: ((NOT nnjl_remove) AND finalizada AND (NOT (hashed SubPlan 3)))
  • Rows Removed by Filter: 0
499.          

SubPlan (for Index Scan)

500. 0.011 0.011 ↑ 1.0 7 1

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

  • Filter: sysadmin
  • Rows Removed by Filter: 15
501. 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
502. 2.518 2.518 ↑ 1.0 4 1,259

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

Planning time : 118.187 ms
Execution time : 171,438.386 ms