explain.depesz.com

PostgreSQL's explain analyze made readable

Result: AxHY

Settings
# exclusive inclusive rows x rows loops node
1. 210.436 193,863.789 ↓ 13.0 13 1

GroupAggregate (cost=2,190,740.02..2,190,952.86 rows=1 width=71) (actual time=185,572.730..193,863.789 rows=13 loops=1)

  • Group Key: factura.fac_nrutoperador
2. 510.825 193,653.353 ↓ 637,959.0 637,959 1

Nested Loop (cost=2,190,740.02..2,190,952.84 rows=1 width=71) (actual time=184,918.954..193,653.353 rows=637,959 loops=1)

3. 193.261 190,590.692 ↓ 637,959.0 637,959 1

Nested Loop (cost=2,190,739.60..2,190,952.30 rows=1 width=97) (actual time=184,918.923..190,590.692 rows=637,959 loops=1)

4. 912.072 187,207.636 ↓ 25,518.4 637,959 1

GroupAggregate (cost=2,190,739.18..2,190,740.93 rows=25 width=247) (actual time=184,918.884..187,207.636 rows=637,959 loops=1)

  • Group Key: factura.fac_nrutoperador, jerarquia_linea.jli_sdeslinea, jerarquia_categoria.jca_sdescategoria, jerarquia_productobase.jpb_sdesproductobase, articulo.art_scodformato, articulo.art_scodvariedad, articulo.art_sdescripcion, rela (...)
5. 7,119.384 186,295.564 ↓ 25,518.5 637,963 1

Sort (cost=2,190,739.18..2,190,739.24 rows=25 width=247) (actual time=184,918.866..186,295.564 rows=637,963 loops=1)

  • Sort Key: factura.fac_nrutoperador, jerarquia_linea.jli_sdeslinea, jerarquia_categoria.jca_sdescategoria, jerarquia_productobase.jpb_sdesproductobase, articulo.art_scodformato, articulo.art_scodvariedad, articulo.art_sdescripcion, (...)
  • Sort Method: external merge Disk: 105024kB
6. 45.109 179,176.180 ↓ 25,518.5 637,963 1

Append (cost=540,924.96..2,190,738.60 rows=25 width=247) (actual time=4,166.553..179,176.180 rows=637,963 loops=1)

7. 453.267 5,231.792 ↓ 12,139.1 230,643 1

Finalize GroupAggregate (cost=540,924.96..540,929.38 rows=19 width=247) (actual time=4,166.553..5,231.792 rows=230,643 loops=1)

  • Group Key: factura.fac_nrutoperador, jerarquia_linea.jli_sdeslinea, jerarquia_categoria.jca_sdescategoria, jerarquia_productobase.jpb_sdesproductobase, articulo.art_scodformato, articulo.art_scodvariedad, relacion_come (...)
8. 0.000 4,778.525 ↓ 14,415.2 230,643 1

Gather Merge (cost=540,924.96..540,927.67 rows=16 width=247) (actual time=4,166.528..4,778.525 rows=230,643 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
9. 492.210 11,853.126 ↓ 9,610.1 76,881 3

Partial GroupAggregate (cost=539,924.94..539,925.80 rows=8 width=247) (actual time=3,774.748..3,951.042 rows=76,881 loops=3)

  • Group Key: factura.fac_nrutoperador, jerarquia_linea.jli_sdeslinea, jerarquia_categoria.jca_sdescategoria, jerarquia_productobase.jpb_sdesproductobase, articulo.art_scodformato, articulo.art_scodvariedad, r (...)
10. 1,996.353 11,360.916 ↓ 9,633.6 77,069 3

Sort (cost=539,924.94..539,924.96 rows=8 width=205) (actual time=3,774.713..3,786.972 rows=77,069 loops=3)

  • Sort Key: factura.fac_nrutoperador, jerarquia_linea.jli_sdeslinea, jerarquia_categoria.jca_sdescategoria, jerarquia_productobase.jpb_sdesproductobase, articulo.art_scodformato, articulo.art_scodvaried (...)
  • Sort Method: quicksort Memory: 29274kB
11. 444.240 9,364.563 ↓ 9,633.6 77,069 3

Hash Left Join (cost=394,173.12..539,924.82 rows=8 width=205) (actual time=2,073.066..3,121.521 rows=77,069 loops=3)

  • Hash Cond: ((jerarquia_categoria.jca_scodlinea)::text = (jerarquia_linea.jli_scodlinea)::text)
12. 107.775 8,920.266 ↓ 9,633.6 77,069 3

Hash Left Join (cost=394,171.76..539,923.18 rows=8 width=177) (actual time=2,073.013..2,973.422 rows=77,069 loops=3)

  • Hash Cond: ((jerarquia_agrupacion.jag_scodcategoria)::text = (jerarquia_categoria.jca_scodcategoria)::text)
13. 113.640 8,812.383 ↓ 9,633.6 77,069 3

Hash Left Join (cost=394,169.47..539,920.87 rows=8 width=163) (actual time=2,072.969..2,937.461 rows=77,069 loops=3)

  • Hash Cond: ((jerarquia_productobase.jpb_scodagrupacion)::text = (jerarquia_agrupacion.jag_scodagrupacion)::text)
14. 118.428 8,698.506 ↓ 9,633.6 77,069 3

Hash Join (cost=394,163.49..539,914.87 rows=8 width=163) (actual time=2,072.879..2,899.502 rows=77,069 loops=3)

  • Hash Cond: ((articulo.art_scodjerproducbase)::text = (jerarquia_productobase.jpb_scodproductobase)::text)
15. 121.429 8,579.247 ↓ 9,633.6 77,069 3

Nested Loop (cost=394,143.91..539,895.27 rows=8 width=147) (actual time=2,072.564..2,859.749 rows=77,069 loops=3)

16. 97.478 7,290.678 ↓ 7,780.9 77,809 3

Nested Loop (cost=394,143.63..539,830.70 rows=10 width=107) (actual time=2,072.538..2,430.226 rows=77,809 loops=3)

  • Join Filter: ((relacion_comer_localcliente.rco_scodrelacioncomercial)::text = (detalle_factura.dfa_scodrelacioncomercial)::text)
  • Rows Removed by Join Filter: 72399
17. 224.613 6,549.648 ↓ 8.6 16,501 3

Merge Join (cost=394,143.06..395,724.10 rows=1,915 width=96) (actual time=2,072.342..2,183.216 rows=16,501 loops=3)

  • Merge Cond: ((relacion_comer_localcliente.rco_nrutoperador = factura.fac_nrutoperador) AND (relacion_comer_localcliente.rco_nrutcliente = factura.fac_nrutclie (...)
18. 2,512.779 3,201.798 ↓ 1.5 198,981 3

Sort (cost=40,573.66..40,898.75 rows=130,037 width=75) (actual time=1,035.766..1,067.266 rows=198,981 loops=3)

  • Sort Key: relacion_comer_localcliente.rco_nrutoperador, relacion_comer_localcliente.rco_nrutcliente, relacion_comer_localcliente.rco_nnumlocal
  • Sort Method: quicksort Memory: 38604kB
19. 494.886 689.019 ↓ 1.6 210,795 3

Hash Join (cost=98.40..29,527.95 rows=130,037 width=75) (actual time=1.501..229.673 rows=210,795 loops=3)

  • Hash Cond: ((relacion_comer_localcliente.rco_nrutoperador = territorio.ter_nrutoperador) AND (relacion_comer_localcliente.rco_nidterritorio = terr (...)
20. 189.795 189.795 ↑ 1.3 224,635 3

Parallel Seq Scan on relacion_comer_localcliente (cost=0.00..27,926.18 rows=286,218 width=51) (actual time=0.010..63.265 rows=224,635 loops=3)

21. 2.241 4.338 ↓ 1.0 2,217 3

Hash (cost=65.16..65.16 rows=2,216 width=40) (actual time=1.446..1.446 rows=2,217 loops=3)

  • Buckets: 4096 Batches: 1 Memory Usage: 193kB
22. 2.097 2.097 ↓ 1.0 2,217 3

Seq Scan on territorio (cost=0.00..65.16 rows=2,216 width=40) (actual time=0.019..0.699 rows=2,217 loops=3)

23. 221.091 3,123.237 ↑ 1.2 30,122 3

Sort (cost=353,569.41..353,658.63 rows=35,688 width=32) (actual time=1,036.546..1,041.079 rows=30,122 loops=3)

  • Sort Key: factura.fac_nrutoperador, factura.fac_nrutcliente, factura.fac_nnumlocal
  • Sort Method: quicksort Memory: 2785kB
24. 2,902.146 2,902.146 ↑ 1.4 25,811 3

Index Scan using idx_factura_idx04 on factura (cost=0.44..350,870.83 rows=35,688 width=32) (actual time=0.331..967.382 rows=25,811 loops=3)

  • Index Cond: (((fac_scoddoctooriginal)::text = 'PED'::text) AND (fac_dfhoemision >= to_date('01/05/2019'::character varying, 'dd/mm/yyyy'::characte (...)
25. 643.552 643.552 ↓ 9.0 9 49,504

Index Scan using detalle_factura_pk on detalle_factura (cost=0.57..75.24 rows=1 width=41) (actual time=0.008..0.013 rows=9 loops=49,504)

  • Index Cond: ((dfa_nidfactura = factura.fac_nidfactura) AND (dfa_nrutoperador = factura.fac_nrutoperador))
  • Filter: ((dfa_scodvariedad)::text = (CASE WHEN ((dfa_sindbonificado)::text = 'S'::text) THEN dfa_scodvariedadorigen ELSE dfa_scodvariedad END)::text)
26. 1,167.140 1,167.140 ↑ 1.0 1 233,428

Index Scan using idx1_articulo on articulo (cost=0.28..6.46 rows=1 width=50) (actual time=0.005..0.005 rows=1 loops=233,428)

  • Index Cond: (((art_scodformato)::text = (detalle_factura.dfa_scodformato)::text) AND ((art_scodvariedad)::text = (detalle_factura.dfa_scodvariedad)::text) AND ((art (...)
27. 0.402 0.831 ↑ 1.0 559 3

Hash (cost=12.59..12.59 rows=559 width=26) (actual time=0.277..0.277 rows=559 loops=3)

  • Buckets: 1024 Batches: 1 Memory Usage: 41kB
28. 0.429 0.429 ↑ 1.0 559 3

Seq Scan on jerarquia_productobase (cost=0.00..12.59 rows=559 width=26) (actual time=0.022..0.143 rows=559 loops=3)

29. 0.087 0.237 ↑ 1.0 177 3

Hash (cost=3.77..3.77 rows=177 width=10) (actual time=0.079..0.079 rows=177 loops=3)

  • Buckets: 1024 Batches: 1 Memory Usage: 16kB
30. 0.150 0.150 ↑ 1.0 177 3

Seq Scan on jerarquia_agrupacion (cost=0.00..3.77 rows=177 width=10) (actual time=0.026..0.050 rows=177 loops=3)

31. 0.054 0.108 ↑ 1.0 57 3

Hash (cost=1.57..1.57 rows=57 width=24) (actual time=0.036..0.036 rows=57 loops=3)

  • Buckets: 1024 Batches: 1 Memory Usage: 12kB
32. 0.054 0.054 ↑ 1.0 57 3

Seq Scan on jerarquia_categoria (cost=0.00..1.57 rows=57 width=24) (actual time=0.011..0.018 rows=57 loops=3)

33. 0.024 0.057 ↑ 1.0 16 3

Hash (cost=1.16..1.16 rows=16 width=20) (actual time=0.019..0.019 rows=16 loops=3)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
34. 0.033 0.033 ↑ 1.0 16 3

Seq Scan on jerarquia_linea (cost=0.00..1.16 rows=16 width=20) (actual time=0.008..0.011 rows=16 loops=3)

35. 4.404 651.392 ↓ 2,751.0 2,751 1

Finalize GroupAggregate (cost=1,474,833.50..1,474,833.65 rows=1 width=247) (actual time=646.864..651.392 rows=2,751 loops=1)

  • Group Key: factura_1.fac_nrutoperador, jerarquia_linea_1.jli_sdeslinea, jerarquia_categoria_1.jca_sdescategoria, jerarquia_productobase_1.jpb_sdesproductobase, artunit.art_scodformato, artunit.art_scodvariedad, pack.ar (...)
36. 18.291 646.988 ↓ 1,375.5 2,751 1

Sort (cost=1,474,833.50..1,474,833.50 rows=2 width=247) (actual time=646.852..646.988 rows=2,751 loops=1)

  • Sort Key: factura_1.fac_nrutoperador, jerarquia_linea_1.jli_sdeslinea, jerarquia_categoria_1.jca_sdescategoria, jerarquia_productobase_1.jpb_sdesproductobase, artunit.art_scodformato, artunit.art_scodvariedad, pa (...)
  • Sort Method: quicksort Memory: 985kB
37. 22.242 628.697 ↓ 1,375.5 2,751 1

Gather (cost=1,474,833.15..1,474,833.49 rows=2 width=247) (actual time=622.966..628.697 rows=2,751 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
38. 2.839 606.455 ↓ 917.0 917 3

Partial GroupAggregate (cost=1,473,833.15..1,473,833.29 rows=1 width=247) (actual time=603.586..606.455 rows=917 loops=3)

  • Group Key: factura_1.fac_nrutoperador, jerarquia_linea_1.jli_sdeslinea, jerarquia_categoria_1.jca_sdescategoria, jerarquia_productobase_1.jpb_sdesproductobase, artunit.art_scodformato, artunit.art_sco (...)
39. 5.302 603.616 ↓ 918.0 918 3

Sort (cost=1,473,833.15..1,473,833.15 rows=1 width=216) (actual time=603.555..603.616 rows=918 loops=3)

  • Sort Key: factura_1.fac_nrutoperador, jerarquia_linea_1.jli_sdeslinea, jerarquia_categoria_1.jca_sdescategoria, jerarquia_productobase_1.jpb_sdesproductobase, artunit.art_scodformato, artunit.ar (...)
  • Sort Method: quicksort Memory: 357kB
40. 6.215 598.314 ↓ 918.0 918 3

Nested Loop (cost=1,473,719.15..1,473,833.14 rows=1 width=216) (actual time=547.773..598.314 rows=918 loops=3)

  • Join Filter: (factura_1.fac_nrutoperador = territorio_1.ter_nrutoperador)
41. 12.156 592.096 ↓ 918.0 918 3

Nested Loop Left Join (cost=1,473,718.87..1,473,826.87 rows=1 width=188) (actual time=547.728..592.096 rows=918 loops=3)

42. 10.181 579.928 ↓ 918.0 918 3

Nested Loop (cost=1,473,716.67..1,473,823.42 rows=1 width=164) (actual time=547.680..579.928 rows=918 loops=3)

  • Join Filter: ((detalle_factura_1.dfa_scodrelacioncomercial)::text = (relacion_comer_localcliente_1.rco_scodrelacioncomercial)::text)
  • Rows Removed by Join Filter: 125
  • -> Index Scan using relcomerclie_localclie_idx on relacion_comer_localcliente relacion_comer_localcliente_1 (cost=0.42..6.78 rows=1 width=51) (actual time=0.009..0.010 rows=1 (...)
43. 0.569 569.747 ↓ 306.0 918 3

Hash Left Join (cost=1,473,716.24..1,473,803.04 rows=3 width=124) (actual time=547.642..569.747 rows=918 loops=3)

  • Hash Cond: ((jerarquia_productobase_1.jpb_scodagrupacion)::text = (jerarquia_agrupacion_1.jag_scodagrupacion)::text)
  • Index Cond: ((rco_nrutoperador = factura_1.fac_nrutoperador) AND (rco_nrutcliente = factura_1.fac_nrutcliente) AND (rco_nnumlocal = factura_1.fac_nnumlocal))
44. 4.194 569.101 ↓ 306.0 918 3

Nested Loop (cost=1,473,710.26..1,473,797.05 rows=3 width=124) (actual time=547.554..569.101 rows=918 loops=3)

  • -> Index Scan using pk_jerarquia_productobase on jerarquia_productobase jerarquia_productobase_1 (cost=0.28..5.55 rows=1 width=26) (actual time=0.004..0.004 rows= (...)
45. 14.377 564.907 ↓ 306.0 918 3

Nested Loop (cost=1,473,709.99..1,473,780.38 rows=3 width=108) (actual time=547.531..564.907 rows=918 loops=3)

  • Join Filter: ((precio_articulo.pra_dfhoiniciovigencia <= factura_1.fac_dfhocreacion) AND (precio_articulo.pra_dfhofinvigencia > factura_1.fac_dfhocreacion))
  • Rows Removed by Join Filter: 11772
  • Index Cond: ((jpb_scodproductobase)::text = (artunit.art_scodjerproducbase)::text)
46. 2.640 550.517 ↓ 306.0 918 3

Merge Join (cost=1,473,709.70..1,473,760.75 rows=3 width=116) (actual time=547.420..550.517 rows=918 loops=3)

  • Merge Cond: (((detalle_pack.dpk_scodformato)::text = (artunit.art_scodformato)::text) AND ((detalle_pack.dpk_scodvariedad)::text = (artunit.art_scodvari (...)
47. 1.605 523.460 ↓ 306.0 918 3

Sort (cost=1,472,890.30..1,472,890.30 rows=3 width=96) (actual time=523.327..523.460 rows=918 loops=3)

  • Sort Key: detalle_pack.dpk_scodformato, detalle_pack.dpk_scodvariedad
  • Sort Method: quicksort Memory: 233kB
48. 1.228 521.855 ↓ 306.0 918 3

Hash Join (cost=611.92..1,472,890.27 rows=3 width=96) (actual time=386.434..521.855 rows=918 loops=3)

  • Hash Cond: (((pack.art_scodformato)::numeric = detalle_pack.dpk_scodformatopack) AND ((pack.art_scodvariedad)::numeric = detalle_pack.dpk_sc (...)
49. 14.700 517.958 ↓ 3.0 740 3

Hash Join (cost=432.09..1,472,607.30 rows=247 width=91) (actual time=383.702..517.958 rows=740 loops=3)

  • Hash Cond: (((detalle_factura_1.dfa_scodformato)::text = (pack.art_scodformato)::text) AND ((CASE WHEN ((detalle_factura_1.dfa_sindbon (...)
50. 500.570 500.570 ↑ 1.4 77,809 3

Nested Loop (cost=1.01..1,471,573.10 rows=112,206 width=60) (actual time=251.901..500.570 rows=77,809 loops=3)

  • -> Parallel Index Scan using idx_factura_idx04 on factura factura_1 (cost=0.44..350662.65 rows=14870 width=40) (actual time=25 (...)
  • Index Cond: (((fac_scoddoctooriginal)::text = 'PED'::text) AND (fac_dfhoemision >= to_date('01/05/2019'::character varying (...)
  • -> Index Scan using detalle_factura_pk on detalle_factura detalle_factura_1 (cost=0.57..75.10 rows=28 width=36) (actual time=0 (...)
  • Index Cond: ((dfa_nidfactura = factura_1.fac_nidfactura) AND (dfa_nrutoperador = factura_1.fac_nrutoperador))
51. 0.665 2.688 ↓ 1.0 2,381 3

Hash (cost=395.43..395.43 rows=2,377 width=41) (actual time=2.688..2.688 rows=2,381 loops=3)

  • Buckets: 4096 Batches: 1 Memory Usage: 218kB
52. 2.023 2.023 ↓ 1.0 2,381 3

Bitmap Heap Scan on articulo pack (cost=48.72..395.43 rows=2,377 width=41) (actual time=0.183..2.023 rows=2,381 loops=3)

  • Recheck Cond: ((art_scodcomposicion)::text = 'PACKS'::text)
  • Heap Blocks: exact=234
  • -> Bitmap Index Scan on idx_extra_articulo (cost=0.00..48.12 rows=2377 width=0) (actual time=0.150..0.150 rows=2381 loop (...)
53. 1.597 2.669 ↓ 1.0 5,736 3

Hash (cost=94.13..94.13 rows=5,713 width=19) (actual time=2.669..2.669 rows=5,736 loops=3)

  • Buckets: 8192 Batches: 1 Memory Usage: 355kB
54. 1.072 1.072 ↓ 1.0 5,736 3

Seq Scan on detalle_pack (cost=0.00..94.13 rows=5,713 width=19) (actual time=0.026..1.072 rows=5,736 loops=3)

55. 21.697 24.417 ↑ 1.0 6,774 3

Sort (cost=819.40..836.45 rows=6,819 width=20) (actual time=24.024..24.417 rows=6,774 loops=3)

  • Sort Key: artunit.art_scodformato, artunit.art_scodvariedad
  • Sort Method: quicksort Memory: 724kB
56. 2.720 2.720 ↑ 1.0 6,809 3

Seq Scan on articulo artunit (cost=0.00..385.19 rows=6,819 width=20) (actual time=0.013..2.720 rows=6,809 loops=3)

57. 0.013 0.013 ↓ 14.0 14 2,753

Index Scan using pk_precio_articulo on precio_articulo (cost=0.29..6.53 rows=1 width=28) (actual time=0.007..0.013 rows=14 loops=2,753)

  • Index Cond: (((pra_scodformato)::text = (detalle_pack.dpk_scodformato)::text) AND ((pra_scodvariedad)::text = (detalle_pack.dpk_scodvariedad)::text))
58. 0.035 0.077 ↑ 1.0 177 3

Hash (cost=3.77..3.77 rows=177 width=10) (actual time=0.077..0.077 rows=177 loops=3)

  • Buckets: 1024 Batches: 1 Memory Usage: 16kB
59. 0.042 0.042 ↑ 1.0 177 3

Seq Scan on jerarquia_agrupacion jerarquia_agrupacion_1 (cost=0.00..3.77 rows=177 width=10) (actual time=0.019..0.042 rows=177 loops=3)

60. 0.006 0.012 ↑ 1.0 1 2,753

Hash Right Join (cost=2.20..3.43 rows=1 width=34) (actual time=0.007..0.012 rows=1 loops=2,753)

  • Hash Cond: ((jerarquia_linea_1.jli_scodlinea)::text = (jerarquia_categoria_1.jca_scodlinea)::text)
61. 0.002 0.002 ↑ 1.0 16 2,753

Seq Scan on jerarquia_linea jerarquia_linea_1 (cost=0.00..1.16 rows=16 width=20) (actual time=0.001..0.002 rows=16 loops=2,753)

62. 0.001 0.004 ↑ 1.0 1 2,753

Hash (cost=2.19..2.19 rows=1 width=24) (actual time=0.004..0.004 rows=1 loops=2,753)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
63. 0.003 0.003 ↑ 1.0 1 2,753

Index Scan using pk_jerarquia_categoria on jerarquia_categoria jerarquia_categoria_1 (cost=0.14..2.19 rows=1 width=24) (actual time=0.003..0.003 rows=1 loops=2,753)

  • Index Cond: ((jerarquia_agrupacion_1.jag_scodcategoria)::text = (jca_scodcategoria)::text)
64. 0.003 0.003 ↑ 1.0 1 2,753

Index Scan using ter_id_uk1 on territorio territorio_1 (cost=0.28..6.23 rows=1 width=40) (actual time=0.003..0.003 rows=1 loops=2,753)

  • Index Cond: ((ter_nrutoperador = relacion_comer_localcliente_1.rco_nrutoperador) AND (ter_nidterritorio = relacion_comer_localcliente_1.rco_nidterritorio))
65. 622.300 8,624.463 ↓ 360,482.0 360,482 1

GroupAggregate (cost=18,491.98..18,492.09 rows=1 width=247) (actual time=7,667.185..8,624.463 rows=360,482 loops=1)

  • Group Key: factura_recorrido.far_nrutoperador, jerarquia_linea_2.jli_sdeslinea, jerarquia_categoria_2.jca_sdescategoria, jerarquia_productobase_2.jpb_sdesproductobase, articulo_1.art_scodformato, articulo_1.art_scodvar (...)
66. 4,031.018 8,002.163 ↓ 361,072.0 361,072 1

Sort (cost=18,491.98..18,491.98 rows=1 width=205) (actual time=7,667.152..8,002.163 rows=361,072 loops=1)

  • Sort Key: factura_recorrido.far_nrutoperador, jerarquia_linea_2.jli_sdeslinea, jerarquia_categoria_2.jca_sdescategoria, jerarquia_productobase_2.jpb_sdesproductobase, articulo_1.art_scodformato, articulo_1.art_sc (...)
  • Sort Method: external merge Disk: 64752kB
67. 621.676 3,971.145 ↓ 361,072.0 361,072 1

Nested Loop Left Join (cost=1,470.68..18,491.97 rows=1 width=205) (actual time=8.594..3,971.145 rows=361,072 loops=1)

68. 259.632 2,627.325 ↓ 361,072.0 361,072 1

Nested Loop Left Join (cost=1,470.55..18,491.55 rows=1 width=177) (actual time=8.576..2,627.325 rows=361,072 loops=1)

69. 0.000 1,645.549 ↓ 361,072.0 361,072 1

Gather (cost=1,470.41..18,491.32 rows=1 width=163) (actual time=8.569..1,645.549 rows=361,072 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
70. 453.264 3,207.133 ↓ 120,357.0 120,357 3

Nested Loop (cost=470.41..17,491.22 rows=1 width=163) (actual time=6.376..3,207.133 rows=120,357 loops=3)

  • Join Filter: (factura_recorrido.far_nrutoperador = territorio_2.ter_nrutoperador)
71. 349.234 2,753.866 ↓ 120,357.0 120,357 3

Nested Loop Left Join (cost=470.13..17,490.91 rows=1 width=153) (actual time=6.339..2,753.866 rows=120,357 loops=3)

72. 547.547 2,404.630 ↓ 120,357.0 120,357 3

Nested Loop (cost=469.98..17,490.71 rows=1 width=153) (actual time=6.316..2,404.630 rows=120,357 loops=3)

  • -> Index Scan using pk_jerarquia_productobase on jerarquia_productobase jerarquia_productobase_2 (cost=0.28..0.30 rows=1 width=26) (actual time=0.004..0.004 rows=1 loops=3610 (...)
73. 813.783 1,857.083 ↓ 120,357.0 120,357 3

Nested Loop (cost=469.71..17,490.41 rows=1 width=137) (actual time=6.281..1,857.083 rows=120,357 loops=3)

  • Join Filter: ((detalle_factura_recorrido.dfr_scodrelacioncomercial)::text = (relacion_comer_localcliente_2.rco_scodrelacioncomercial)::text)
  • Rows Removed by Join Filter: 11864
  • -> Index Scan using relcomerclie_localclie_idx on relacion_comer_localcliente relacion_comer_localcliente_2 (cost=0.42..3.02 rows=1 width=51) (actual time=0.006..0.006 (...)
  • Index Cond: ((jpb_scodproductobase)::text = (articulo_1.art_scodjerproducbase)::text)
74. 865.328 1,043.300 ↓ 2,674.6 120,357 3

Nested Loop (cost=469.28..17,353.82 rows=45 width=97) (actual time=6.232..1,043.300 rows=120,357 loops=3)

  • Index Cond: ((rco_nrutoperador = factura_recorrido.far_nrutoperador) AND (rco_nrutcliente = factura_recorrido.far_nrutcliente) AND (rco_nnumlocal = factura_recorrid (...)
75. 90.182 177.966 ↓ 195.6 134,006 3

Hash Join (cost=468.87..11,765.59 rows=685 width=82) (actual time=6.037..177.966 rows=134,006 loops=3)

  • Hash Cond: (((detalle_factura_recorrido.dfr_scodformato)::text = (articulo_1.art_scodformato)::text) AND ((detalle_factura_recorrido.dfr_scodvariedad)::text = (...)
76. 81.869 81.869 ↓ 159.6 140,566 3

Parallel Seq Scan on detalle_factura_recorrido (cost=0.00..11,292.09 rows=881 width=42) (actual time=0.022..81.869 rows=140,566 loops=3)

  • Filter: ((dfr_scodvariedad)::text = (CASE WHEN ((dfr_sindbonificado)::text = 'S'::text) THEN dfr_scodvariedadorigen ELSE dfr_scodvariedad END)::text)
77. 1.392 5.915 ↑ 1.0 4,428 3

Hash (cost=402.24..402.24 rows=4,442 width=50) (actual time=5.915..5.915 rows=4,428 loops=3)

  • Buckets: 8192 Batches: 1 Memory Usage: 427kB
78. 4.523 4.523 ↑ 1.0 4,428 3

Seq Scan on articulo articulo_1 (cost=0.00..402.24 rows=4,442 width=50) (actual time=0.017..4.523 rows=4,428 loops=3)

  • Filter: ((art_scodcomposicion)::text = 'UNITA'::text)
  • Rows Removed by Filter: 2381
79. 0.006 0.006 ↑ 1.0 1 402,018

Index Scan using pk_factura_recorrido on factura_recorrido (cost=0.41..8.16 rows=1 width=32) (actual time=0.006..0.006 rows=1 loops=402,018)

  • Index Cond: ((far_nidfactura = detalle_factura_recorrido.dfr_nidfactura) AND (far_nrutoperador = detalle_factura_recorrido.dfr_nrutoperador))
  • Filter: (((far_scoddoctooriginal)::text = 'PED'::text) AND (far_dfhoemision >= to_date('01/05/2019'::character varying, 'dd/mm/yyyy'::character varying)) AND (...)
  • Rows Removed by Filter: 0
80. 0.002 0.002 ↑ 1.0 1 361,072

Index Scan using pk_jerarquia_agrupacion on jerarquia_agrupacion jerarquia_agrupacion_2 (cost=0.14..0.19 rows=1 width=10) (actual time=0.002..0.002 rows=1 loops=361,072)

  • Index Cond: ((jerarquia_productobase_2.jpb_scodagrupacion)::text = (jag_scodagrupacion)::text)
81. 0.003 0.003 ↑ 1.0 1 361,072

Index Scan using idx_id_territorio on territorio territorio_2 (cost=0.28..0.30 rows=1 width=40) (actual time=0.003..0.003 rows=1 loops=361,072)

  • Index Cond: ((ter_nrutoperador = relacion_comer_localcliente_2.rco_nrutoperador) AND (ter_nidterritorio = relacion_comer_localcliente_2.rco_nidterritorio))
82. 722.144 722.144 ↑ 1.0 1 361,072

Index Scan using pk_jerarquia_categoria on jerarquia_categoria jerarquia_categoria_2 (cost=0.14..0.23 rows=1 width=24) (actual time=0.002..0.002 rows=1 loops=361,072)

  • Index Cond: ((jerarquia_agrupacion_2.jag_scodcategoria)::text = (jca_scodcategoria)::text)
83. 722.144 722.144 ↑ 1.0 1 361,072

Index Scan using idx_jli_extra on jerarquia_linea jerarquia_linea_2 (cost=0.14..0.36 rows=1 width=20) (actual time=0.002..0.002 rows=1 loops=361,072)

  • Index Cond: ((jerarquia_categoria_2.jca_scodlinea)::text = (jli_scodlinea)::text)
84. 34.643 570.175 ↓ 13,470.0 13,470 1

GroupAggregate (cost=12,976.88..12,977.02 rows=1 width=247) (actual time=534.625..570.175 rows=13,470 loops=1)

  • Group Key: factura_recorrido_1.far_nrutoperador, jerarquia_linea_3.jli_sdeslinea, jerarquia_categoria_3.jca_sdescategoria, jerarquia_productobase_3.jpb_sdesproductobase, artunit_1.art_scodformato, artunit_1.art_scodvar (...)
85. 131.020 535.532 ↓ 13,481.0 13,481 1

Sort (cost=12,976.88..12,976.89 rows=1 width=216) (actual time=534.598..535.532 rows=13,481 loops=1)

  • Sort Key: factura_recorrido_1.far_nrutoperador, jerarquia_linea_3.jli_sdeslinea, jerarquia_categoria_3.jca_sdescategoria, jerarquia_productobase_3.jpb_sdesproductobase, artunit_1.art_scodformato, artunit_1.art_sc (...)
  • Sort Method: quicksort Memory: 3965kB
86. 30.132 404.512 ↓ 13,481.0 13,481 1

Nested Loop Left Join (cost=1,433.76..12,976.87 rows=1 width=216) (actual time=6.264..404.512 rows=13,481 loops=1)

87. 10.393 347.418 ↓ 13,481.0 13,481 1

Nested Loop (cost=1,433.63..12,976.45 rows=1 width=188) (actual time=6.240..347.418 rows=13,481 loops=1)

  • Join Filter: (factura_recorrido_1.far_nrutoperador = territorio_3.ter_nrutoperador)
88. 10.813 296.582 ↓ 13,481.0 13,481 1

Nested Loop (cost=1,433.35..12,976.14 rows=1 width=178) (actual time=6.225..296.582 rows=13,481 loops=1)

  • Join Filter: ((detalle_factura_recorrido_1.dfr_scodrelacioncomercial)::text = (relacion_comer_localcliente_3.rco_scodrelacioncomercial)::text)
  • Rows Removed by Join Filter: 363
89. 11.707 204.883 ↓ 13,481.0 13,481 1

Nested Loop Left Join (cost=1,432.92..12,973.10 rows=1 width=138) (actual time=6.195..204.883 rows=13,481 loops=1)

90. 0.000 166.214 ↓ 13,481.0 13,481 1

Gather (cost=1,432.78..12,972.87 rows=1 width=124) (actual time=6.185..166.214 rows=13,481 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
91. 13.962 318.560 ↓ 4,494.0 4,494 3

Nested Loop Left Join (cost=432.78..11,972.77 rows=1 width=124) (actual time=3.672..318.560 rows=4,494 loops=3)

92. 21.033 304.596 ↓ 4,494.0 4,494 3

Nested Loop (cost=432.64..11,972.58 rows=1 width=124) (actual time=3.651..304.596 rows=4,494 loops=3)

  • -> Index Scan using pk_jerarquia_productobase on jerarquia_productobase jerarquia_productobase_3 (cost=0.28..0.30 rows=1 width=26) (actual time=0.004..0.004 rows=1 loop (...)
93. 27.264 283.563 ↓ 4,494.0 4,494 3

Nested Loop (cost=432.36..11,972.28 rows=1 width=108) (actual time=3.621..283.563 rows=4,494 loops=3)

  • Join Filter: (((detalle_pack_1.dpk_scodformato)::text = (artunit_1.art_scodformato)::text) AND ((detalle_pack_1.dpk_scodvariedad)::text = (artunit_1.art_scodvarieda (...)
  • Index Cond: ((jpb_scodproductobase)::text = (artunit_1.art_scodjerproducbase)::text)
94. 83.368 256.294 ↓ 4,494.0 4,494 3

Nested Loop (cost=432.08..11,971.90 rows=1 width=100) (actual time=3.593..256.294 rows=4,494 loops=3)

  • Join Filter: ((precio_articulo_1.pra_dfhoiniciovigencia <= factura_recorrido_1.far_dfhocreacion) AND (precio_articulo_1.pra_dfhofinvigencia > factura_recorrid (...)
  • Rows Removed by Join Filter: 71120
  • -> Index Scan using precio_articulo_idx on precio_articulo precio_articulo_1 (cost=0.29..0.58 rows=1 width=28) (actual time=0.007..0.015 rows=17 loops=13481 (...)
95. 63.809 172.926 ↓ 4,494.0 4,494 3

Nested Loop (cost=431.79..11,971.30 rows=1 width=96) (actual time=3.534..172.926 rows=4,494 loops=3)

  • -> Index Scan using pk_factura_recorrido on factura_recorrido factura_recorrido_1 (cost=0.41..2.51 rows=1 width=40) (actual time=0.006..0.006 rows=0 l (...)
  • Index Cond: (((pra_scodformato)::text = (detalle_pack_1.dpk_scodformato)::text) AND ((pra_scodvariedad)::text = (detalle_pack_1.dpk_scodvariedad)::text) (...)
96. 28.288 109.117 ↓ 1,807.8 9,039 3

Nested Loop (cost=431.38..11,958.77 rows=5 width=73) (actual time=3.071..109.117 rows=9,039 loops=3)

  • -> Index Scan using pk_detalle_pack on detalle_pack detalle_pack_1 (cost=0.29..0.43 rows=1 width=19) (actual time=0.003..0.003 rows=1 loops=1967 (...)
  • Index Cond: ((far_nidfactura = detalle_factura_recorrido_1.dfr_nidfactura) AND (far_nrutoperador = detalle_factura_recorrido_1.dfr_nrutoperador))
  • Filter: (((far_scoddoctooriginal)::text = 'PED'::text) AND (far_dfhoemision >= to_date('01/05/2019'::character varying, 'dd/mm/yyyy'::character va (...)
  • Rows Removed by Filter: 1
97. 77.975 80.829 ↓ 17.0 6,560 3

Hash Join (cost=431.09..11,789.26 rows=385 width=68) (actual time=3.020..80.829 rows=6,560 loops=3)

  • Hash Cond: (((detalle_factura_recorrido_1.dfr_scodformato)::text = (pack_1.art_scodformato)::text) AND ((CASE WHEN ((detalle_factura_recorri (...)
  • -> Parallel Seq Scan on detalle_factura_recorrido detalle_factura_recorrido_1 (cost=0.00..10411.06 rows=176206 width=37) (actual time=0.01 (...)
  • Index Cond: ((dpk_scodformatopack = (pack_1.art_scodformato)::numeric) AND (dpk_scodvariedadpack = (pack_1.art_scodvariedad)::numeric))
98. 0.658 2.854 ↓ 1.0 2,381 3

Hash (cost=395.43..395.43 rows=2,377 width=41) (actual time=2.854..2.854 rows=2,381 loops=3)

  • Buckets: 4096 Batches: 1 Memory Usage: 218kB
99. 2.035 2.196 ↓ 1.0 2,381 3

Bitmap Heap Scan on articulo pack_1 (cost=48.72..395.43 rows=2,377 width=41) (actual time=0.198..2.196 rows=2,381 loops=3)

  • Recheck Cond: ((art_scodcomposicion)::text = 'PACKS'::text)
  • Heap Blocks: exact=234
100. 0.161 0.161 ↓ 1.0 2,381 3

Bitmap Index Scan on idx_extra_articulo (cost=0.00..48.12 rows=2,377 width=0) (actual time=0.161..0.161 rows=2,381 loops=3)

101. 0.005 0.005 ↑ 1.0 1 13,481

Index Scan using idx1_articulo on articulo artunit_1 (cost=0.28..0.36 rows=1 width=20) (actual time=0.005..0.005 rows=1 loops=13,481)

  • Index Cond: (((art_scodformato)::text = (precio_articulo_1.pra_scodformato)::text) AND ((art_scodvariedad)::text = (precio_articulo_1.pra_scodvariedad)::text) (...)
102. 0.002 0.002 ↑ 1.0 1 13,481

Index Scan using pk_jerarquia_agrupacion on jerarquia_agrupacion jerarquia_agrupacion_3 (cost=0.14..0.19 rows=1 width=10) (actual time=0.002..0.002 rows=1 loops=13,481)

  • Index Cond: ((jerarquia_productobase_3.jpb_scodagrupacion)::text = (jag_scodagrupacion)::text)
103. 26.962 26.962 ↑ 1.0 1 13,481

Index Scan using pk_jerarquia_categoria on jerarquia_categoria jerarquia_categoria_3 (cost=0.14..0.23 rows=1 width=24) (actual time=0.002..0.002 rows=1 loops=13,481)

  • Index Cond: ((jerarquia_agrupacion_3.jag_scodcategoria)::text = (jca_scodcategoria)::text)
104. 80.886 80.886 ↑ 1.0 1 13,481

Index Scan using relcomerclie_localclie_idx on relacion_comer_localcliente relacion_comer_localcliente_3 (cost=0.42..3.02 rows=1 width=51) (actual time=0.006..0.006 rows=1 loops=13,481)

  • Index Cond: ((rco_nrutoperador = factura_recorrido_1.far_nrutoperador) AND (rco_nrutcliente = factura_recorrido_1.far_nrutcliente) AND (rco_nnumlocal = factura_recorrido_1.far_nnumlocal))
105. 40.443 40.443 ↑ 1.0 1 13,481

Index Scan using idx_id_territorio on territorio territorio_3 (cost=0.28..0.30 rows=1 width=40) (actual time=0.003..0.003 rows=1 loops=13,481)

  • Index Cond: ((ter_nrutoperador = relacion_comer_localcliente_3.rco_nrutoperador) AND (ter_nidterritorio = relacion_comer_localcliente_3.rco_nidterritorio))
106. 26.962 26.962 ↑ 1.0 1 13,481

Index Scan using idx_jli_extra on jerarquia_linea jerarquia_linea_3 (cost=0.14..0.36 rows=1 width=20) (actual time=0.002..0.002 rows=1 loops=13,481)

  • Index Cond: ((jerarquia_categoria_3.jca_scodlinea)::text = (jli_scodlinea)::text)
107. 60.567 154,463.330 ↓ 14,794.5 29,589 1

GroupAggregate (cost=64,769.49..64,769.72 rows=2 width=247) (actual time=154,399.545..154,463.330 rows=29,589 loops=1)

  • Group Key: nota_credito.ncr_nrutoperador, jerarquia_linea_4.jli_sdeslinea, jerarquia_categoria_4.jca_sdescategoria, jerarquia_productobase_4.jpb_sdesproductobase, articulo_2.art_scodformato, articulo_2.art_scodvariedad (...)
108. 238.494 154,402.763 ↓ 14,921.5 29,843 1

Sort (cost=64,769.49..64,769.50 rows=2 width=205) (actual time=154,399.525..154,402.763 rows=29,843 loops=1)

  • Sort Key: nota_credito.ncr_nrutoperador, jerarquia_linea_4.jli_sdeslinea, jerarquia_categoria_4.jca_sdescategoria, jerarquia_productobase_4.jpb_sdesproductobase, articulo_2.art_scodformato, articulo_2.art_scodvar (...)
  • Sort Method: quicksort Memory: 8704kB
109. 43,287.113 154,164.269 ↓ 14,921.5 29,843 1

Gather (cost=60,427.64..64,769.48 rows=2 width=205) (actual time=149.908..154,164.269 rows=29,843 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
110. 110,340.784 110,877.156 ↓ 9,948.0 9,948 3

Nested Loop Semi Join (cost=59,427.64..63,769.25 rows=1 width=205) (actual time=137.746..110,877.156 rows=9,948 loops=3)

  • Join Filter: ((nota_credito.ncr_nidnotacredito = factura_notacredito.fan_nidnotacredito) AND (nota_credito.ncr_nrutoperador = factura_notacredito.fan_nrutoperador))
111. 43.331 527.422 ↓ 12,323.0 12,323 3

Nested Loop Left Join (cost=59,427.21..63,370.38 rows=1 width=217) (actual time=122.588..527.422 rows=12,323 loops=3)

112. 47.494 484.089 ↓ 12,323.0 12,323 3

Nested Loop Left Join (cost=59,427.08..63,369.99 rows=1 width=207) (actual time=122.571..484.089 rows=12,323 loops=3)

113. 48.400 436.592 ↓ 12,323.0 12,323 3

Nested Loop Left Join (cost=59,426.94..63,369.76 rows=1 width=193) (actual time=122.551..436.592 rows=12,323 loops=3)

114. 70.226 388.189 ↓ 12,323.0 12,323 3

Nested Loop (cost=59,426.79..63,369.57 rows=1 width=193) (actual time=122.528..388.189 rows=12,323 loops=3)

  • -> Index Scan using pk_jerarquia_productobase on jerarquia_productobase jerarquia_productobase_4 (cost=0.28..0.30 rows=1 width=26) (actual time=0.005..0.005 rows=1 loops=3696 (...)
115. 113.865 317.963 ↓ 12,323.0 12,323 3

Nested Loop (cost=59,426.52..63,369.26 rows=1 width=177) (actual time=122.499..317.963 rows=12,323 loops=3)

  • Index Cond: ((jpb_scodproductobase)::text = (articulo_2.art_scodjerproducbase)::text)
116. 75.421 204.091 ↓ 12,593.0 12,593 3

Nested Loop (cost=59,426.24..63,368.92 rows=1 width=137) (actual time=122.449..204.091 rows=12,593 loops=3)

  • Join Filter: ((relacion_comer_localcliente_4.rco_scodrelacioncomercial)::text = (detalle_notacredito.dnc_scodrelacioncomercial)::text)
  • Rows Removed by Join Filter: 11152
117. 6.772 128.658 ↓ 20.7 5,088 3

Merge Join (cost=59,425.68..59,447.72 rows=246 width=96) (actual time=120.048..128.658 rows=5,088 loops=3)

  • Merge Cond: ((nota_credito.ncr_nrutoperador = territorio_4.ter_nrutoperador) AND (relacion_comer_localcliente_4.rco_nidterritorio = territorio_4.ter_nidterrit (...)
118. 16.736 116.527 ↓ 11.4 5,100 3

Sort (cost=59,237.38..59,238.50 rows=448 width=72) (actual time=114.993..116.527 rows=5,100 loops=3)

  • Sort Key: nota_credito.ncr_nrutoperador, relacion_comer_localcliente_4.rco_nidterritorio
  • Sort Method: quicksort Memory: 1247kB
119. 99.791 99.791 ↓ 11.4 5,100 3

Nested Loop (cost=0.86..59,217.65 rows=448 width=72) (actual time=14.016..99.791 rows=5,100 loops=3)

  • -> Parallel Index Scan using idx_nota_credito_idx04 on nota_credito (cost=0.43..46957.30 rows=1875 width=32) (actual time=13.960..61.706 rows=26 (...)
  • Index Cond: (((ncr_scoddoctooriginal)::text = 'FACTU'::text) AND (ncr_dfhoemision >= to_date('01/05/2019'::character varying, 'dd/mm/yyyy':: (...)
  • -> Index Scan using relcomerclie_localclie_idx on relacion_comer_localcliente relacion_comer_localcliente_4 (cost=0.42..6.53 rows=1 width=51) (a (...)
  • Index Cond: ((rco_nrutoperador = nota_credito.ncr_nrutoperador) AND (rco_nrutcliente = nota_credito.ncr_nrutcliente) AND (rco_nnumlocal = no (...)
120. 4.859 5.359 ↑ 1.1 2,027 3

Sort (cost=188.30..193.84 rows=2,216 width=40) (actual time=5.046..5.359 rows=2,027 loops=3)

  • Sort Key: territorio_4.ter_nrutoperador, territorio_4.ter_nidterritorio
  • Sort Method: quicksort Memory: 303kB
121. 0.500 0.500 ↓ 1.0 2,217 3

Seq Scan on territorio territorio_4 (cost=0.00..65.16 rows=2,216 width=40) (actual time=0.023..0.500 rows=2,217 loops=3)

122. 0.012 0.012 ↓ 5.0 5 15,263

Index Scan using pk_detalle_notacredito on detalle_notacredito (cost=0.56..15.93 rows=1 width=41) (actual time=0.008..0.012 rows=5 loops=15,263)

  • Index Cond: ((dnc_nidnotacredito = nota_credito.ncr_nidnotacredito) AND (dnc_nrutoperador = nota_credito.ncr_nrutoperador))
  • Filter: ((dnc_scodvariedad)::text = (CASE WHEN ((dnc_sindbonificado)::text = 'S'::text) THEN dnc_scodvariedadorigen ELSE dnc_scodvariedad END)::text)
123. 0.007 0.007 ↑ 1.0 1 37,780

Index Scan using idx1_articulo on articulo articulo_2 (cost=0.28..0.34 rows=1 width=50) (actual time=0.007..0.007 rows=1 loops=37,780)

  • Index Cond: (((art_scodformato)::text = (detalle_notacredito.dnc_scodformato)::text) AND ((art_scodvariedad)::text = (detalle_notacredito.dnc_scodvariedad)::text) A (...)
124. 0.003 0.003 ↑ 1.0 1 36,968

Index Scan using pk_jerarquia_agrupacion on jerarquia_agrupacion jerarquia_agrupacion_4 (cost=0.14..0.19 rows=1 width=10) (actual time=0.003..0.003 rows=1 loops=36,968)

  • Index Cond: ((jerarquia_productobase_4.jpb_scodagrupacion)::text = (jag_scodagrupacion)::text)
125. 0.003 0.003 ↑ 1.0 1 36,968

Index Scan using pk_jerarquia_categoria on jerarquia_categoria jerarquia_categoria_4 (cost=0.14..0.23 rows=1 width=24) (actual time=0.003..0.003 rows=1 loops=36,968)

  • Index Cond: ((jerarquia_agrupacion_4.jag_scodcategoria)::text = (jca_scodcategoria)::text)
126. 0.002 0.002 ↑ 1.0 1 36,968

Index Scan using idx_jli_extra on jerarquia_linea jerarquia_linea_4 (cost=0.14..0.36 rows=1 width=20) (actual time=0.002..0.002 rows=1 loops=36,968)

  • Index Cond: ((jerarquia_categoria_4.jca_scodlinea)::text = (jli_scodlinea)::text)
127. 8.950 8.950 ↑ 1.0 1 36,968

Index Only Scan using pk_factura_notacredito on factura_notacredito (cost=0.43..398.83 rows=1 width=15) (actual time=8.950..8.950 rows=1 loops=36,968)

  • Index Cond: ((fan_nrutoperador = detalle_notacredito.dnc_nrutoperador) AND (fan_nidnotacredito = detalle_notacredito.dnc_nidnotacredito))
  • Heap Fetches: 13221
128. 2.949 9,589.919 ↓ 1,028.0 1,028 1

GroupAggregate (cost=78,736.34..78,736.48 rows=1 width=247) (actual time=9,586.927..9,589.919 rows=1,028 loops=1)

  • Group Key: nota_credito_1.ncr_nrutoperador, jerarquia_linea_5.jli_sdeslinea, jerarquia_categoria_5.jca_sdescategoria, jerarquia_productobase_5.jpb_sdesproductobase, artunit_2.art_scodformato, artunit_2.art_scodvariedad (...)
129. 6.109 9,586.970 ↓ 1,040.0 1,040 1

Sort (cost=78,736.34..78,736.35 rows=1 width=216) (actual time=9,586.906..9,586.970 rows=1,040 loops=1)

  • Sort Key: nota_credito_1.ncr_nrutoperador, jerarquia_linea_5.jli_sdeslinea, jerarquia_categoria_5.jca_sdescategoria, jerarquia_productobase_5.jpb_sdesproductobase, artunit_2.art_scodformato, artunit_2.art_scodvar (...)
  • Sort Method: quicksort Memory: 325kB
130. 4.847 9,580.861 ↓ 1,040.0 1,040 1

Nested Loop Left Join (cost=1,434.77..78,736.33 rows=1 width=216) (actual time=51.395..9,580.861 rows=1,040 loops=1)

131. 1.888 9,572.894 ↓ 1,040.0 1,040 1

Nested Loop (cost=1,434.63..78,735.91 rows=1 width=188) (actual time=51.373..9,572.894 rows=1,040 loops=1)

  • Join Filter: (nota_credito_1.ncr_nrutoperador = territorio_5.ter_nrutoperador)
132. 2.695 9,565.806 ↓ 1,040.0 1,040 1

Nested Loop Semi Join (cost=1,434.35..78,735.60 rows=1 width=185) (actual time=51.347..9,565.806 rows=1,040 loops=1)

  • Join Filter: ((nota_credito_1.ncr_nidnotacredito = factura_notacredito_1.fan_nidnotacredito) AND (nota_credito_1.ncr_nrutoperador = factura_notacredito_1.fan_nrutoperador))
133. 1.745 52.566 ↓ 1,045.0 1,045 1

Nested Loop (cost=1,433.92..78,338.43 rows=1 width=194) (actual time=26.495..52.566 rows=1,045 loops=1)

  • Join Filter: ((detalle_notacredito_1.dnc_scodrelacioncomercial)::text = (relacion_comer_localcliente_5.rco_scodrelacioncomercial)::text)
  • Rows Removed by Join Filter: 124
134. 1.258 41.416 ↓ 1,045.0 1,045 1

Nested Loop Left Join (cost=1,433.50..78,331.88 rows=1 width=154) (actual time=26.476..41.416 rows=1,045 loops=1)

135. 0.000 37.023 ↓ 1,045.0 1,045 1

Gather (cost=1,433.36..78,331.66 rows=1 width=140) (actual time=26.466..37.023 rows=1,045 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
136. 1.159 109.962 ↓ 348.0 348 3

Nested Loop Left Join (cost=433.36..77,331.56 rows=1 width=140) (actual time=22.559..109.962 rows=348 loops=3)

  • -> Index Scan using pk_jerarquia_agrupacion on jerarquia_agrupacion jerarquia_agrupacion_5 (cost=0.14..0.19 rows=1 width=10) (actual time=0.002..0.002 rows=1 loops=1045 (...)
137. 1.933 108.803 ↓ 348.0 348 3

Nested Loop (cost=433.21..77,331.36 rows=1 width=140) (actual time=22.535..108.803 rows=348 loops=3)

  • -> Index Scan using pk_jerarquia_productobase on jerarquia_productobase jerarquia_productobase_5 (cost=0.28..0.30 rows=1 width=26) (actual time=0.004..0.004 rows= (...)
  • Index Cond: ((jerarquia_productobase_5.jpb_scodagrupacion)::text = (jag_scodagrupacion)::text)
138. 2.415 106.870 ↓ 348.0 348 3

Nested Loop (cost=432.94..77,331.06 rows=1 width=124) (actual time=22.505..106.870 rows=348 loops=3)

  • Join Filter: (((detalle_pack_2.dpk_scodformato)::text = (artunit_2.art_scodformato)::text) AND ((detalle_pack_2.dpk_scodvariedad)::text = (artunit_2.art_scodv (...)
  • Index Cond: ((jpb_scodproductobase)::text = (artunit_2.art_scodjerproducbase)::text)
139. 7.381 104.450 ↓ 348.0 348 3

Nested Loop (cost=432.66..77,330.69 rows=1 width=86) (actual time=22.472..104.450 rows=348 loops=3)

  • Join Filter: ((precio_articulo_2.pra_dfhoiniciovigencia <= nota_credito_1.ncr_dfhocreacion) AND (precio_articulo_2.pra_dfhofinvigencia > nota_credito_1. (...)
  • Rows Removed by Join Filter: 5096
  • -> Index Scan using precio_articulo_idx on precio_articulo precio_articulo_2 (cost=0.29..0.58 rows=1 width=28) (actual time=0.008..0.018 rows=16 loops (...)
140. 1.796 97.069 ↓ 348.0 348 3

Nested Loop (cost=432.37..77,330.09 rows=1 width=82) (actual time=22.344..97.069 rows=348 loops=3)

  • Index Cond: (((pra_scodformato)::text = (detalle_pack_2.dpk_scodformato)::text) AND ((pra_scodvariedad)::text = (detalle_pack_2.dpk_scodvariedad): (...)
141. 3.072 95.268 ↓ 16.9 271 3

Hash Join (cost=432.08..77,323.04 rows=16 width=77) (actual time=22.294..95.268 rows=271 loops=3)

  • Hash Cond: (((detalle_notacredito_1.dnc_scodformato)::text = (pack_2.art_scodformato)::text) AND ((CASE WHEN ((detalle_notacredito_1.dnc_sin (...)
142. 89.603 89.603 ↓ 1.6 12,593 3

Nested Loop (cost=0.99..76,849.22 rows=7,952 width=76) (actual time=13.959..89.603 rows=12,593 loops=3)

  • -> Parallel Index Scan using idx_nota_credito_idx04 on nota_credito nota_credito_1 (cost=0.43..46957.30 rows=1875 width=40) (actual (...)
  • Index Cond: (((ncr_scoddoctooriginal)::text = 'FACTU'::text) AND (ncr_dfhoemision >= to_date('01/05/2019'::character varying, 'd (...)
  • -> Index Scan using pk_detalle_notacredito on detalle_notacredito detalle_notacredito_1 (cost=0.56..15.91 rows=3 width=36) (actual t (...)
  • Index Cond: ((dnc_nidnotacredito = nota_credito_1.ncr_nidnotacredito) AND (dnc_nrutoperador = nota_credito_1.ncr_nrutoperador))
143. 0.516 2.593 ↓ 1.0 2,381 3

Hash (cost=395.43..395.43 rows=2,377 width=11) (actual time=2.593..2.593 rows=2,381 loops=3)

  • Buckets: 4096 Batches: 1 Memory Usage: 135kB
144. 1.917 2.077 ↓ 1.0 2,381 3

Bitmap Heap Scan on articulo pack_2 (cost=48.72..395.43 rows=2,377 width=11) (actual time=0.195..2.077 rows=2,381 loops=3)

  • Recheck Cond: ((art_scodcomposicion)::text = 'PACKS'::text)
  • Heap Blocks: exact=234
145. 0.160 0.160 ↓ 1.0 2,381 3

Bitmap Index Scan on idx_extra_articulo (cost=0.00..48.12 rows=2,377 width=0) (actual time=0.160..0.160 rows=2,381 loops=3)

146. 0.005 0.005 ↑ 1.0 1 812

Index Scan using pk_detalle_pack on detalle_pack detalle_pack_2 (cost=0.29..0.43 rows=1 width=19) (actual time=0.004..0.005 rows=1 loops=812)

  • Index Cond: ((dpk_scodformatopack = (pack_2.art_scodformato)::numeric) AND (dpk_scodvariedadpack = (pack_2.art_scodvariedad)::numeric))
147. 0.005 0.005 ↑ 1.0 1 1,045

Index Scan using idx1_articulo on articulo artunit_2 (cost=0.28..0.36 rows=1 width=50) (actual time=0.005..0.005 rows=1 loops=1,045)

  • Index Cond: (((art_scodformato)::text = (precio_articulo_2.pra_scodformato)::text) AND ((art_scodvariedad)::text = (precio_articulo_2.pra_scodvariedad): (...)
148. 3.135 3.135 ↑ 1.0 1 1,045

Index Scan using pk_jerarquia_categoria on jerarquia_categoria jerarquia_categoria_5 (cost=0.14..0.23 rows=1 width=24) (actual time=0.003..0.003 rows=1 loops=1,045)

  • Index Cond: ((jerarquia_agrupacion_5.jag_scodcategoria)::text = (jca_scodcategoria)::text)
149. 9.405 9.405 ↑ 1.0 1 1,045

Index Scan using relcomerclie_localclie_idx on relacion_comer_localcliente relacion_comer_localcliente_5 (cost=0.42..6.53 rows=1 width=51) (actual time=0.009..0.009 rows=1 loops=1,045)

  • Index Cond: ((rco_nrutoperador = nota_credito_1.ncr_nrutoperador) AND (rco_nrutcliente = nota_credito_1.ncr_nrutcliente) AND (rco_nnumlocal = nota_credito_1.ncr_nnumlocal))
150. 9,510.545 9,510.545 ↑ 1.0 1 1,045

Index Only Scan using pk_factura_notacredito on factura_notacredito factura_notacredito_1 (cost=0.43..397.16 rows=1 width=15) (actual time=9.101..9.101 rows=1 loops=1,045)

  • Index Cond: ((fan_nrutoperador = detalle_notacredito_1.dnc_nrutoperador) AND (fan_nidnotacredito = detalle_notacredito_1.dnc_nidnotacredito))
  • Heap Fetches: 1040
151. 5.200 5.200 ↑ 1.0 1 1,040

Index Scan using idx_id_territorio on territorio territorio_5 (cost=0.28..0.30 rows=1 width=40) (actual time=0.005..0.005 rows=1 loops=1,040)

  • Index Cond: ((ter_nrutoperador = relacion_comer_localcliente_5.rco_nrutoperador) AND (ter_nidterritorio = relacion_comer_localcliente_5.rco_nidterritorio))
152. 3.120 3.120 ↑ 1.0 1 1,040

Index Scan using idx_jli_extra on jerarquia_linea jerarquia_linea_5 (cost=0.14..0.36 rows=1 width=20) (actual time=0.003..0.003 rows=1 loops=1,040)

  • Index Cond: ((jerarquia_categoria_5.jca_scodlinea)::text = (jli_scodlinea)::text)
153. 3,189.795 3,189.795 ↑ 1.0 1 637,959

Index Scan using "idx$$_1c630004" on local_cliente (cost=0.42..8.44 rows=1 width=26) (actual time=0.005..0.005 rows=1 loops=637,959)

  • Index Cond: ((loc_nrutoperador = relacion_comer_localcliente.rco_nrutoperador) AND (loc_nrutcliente = relacion_comer_localcliente.rco_nrutcliente) AND (loc_nnumlocal = relacion_comer_localcliente.rco_nnumlocal))
154. 2,551.836 2,551.836 ↑ 1.0 1 637,959

Index Only Scan using "idx$$_1c630002" on cliente (cost=0.42..0.54 rows=1 width=13) (actual time=0.004..0.004 rows=1 loops=637,959)

  • Index Cond: ((cli_nrutoperador = local_cliente.loc_nrutoperador) AND (cli_nrutcliente = local_cliente.loc_nrutcliente))
  • Heap Fetches: 638074