explain.depesz.com

PostgreSQL's explain analyze made readable

Result: c8tF

Settings
# exclusive inclusive rows x rows loops node
1. 84.819 15,904.766 ↑ 12,759,988.7 14,123 1

Merge Right Join (cost=10,614,739,034.49..20,753,478,827.90 rows=180,209,319,878 width=4,372) (actual time=15,782.411..15,904.766 rows=14,123 loops=1)

  • Merge Cond: (((aal.codigo)::bigint) = ((art.codigoarticulo)::bigint))
  • Execution time: 15,920.970 ms(161 filas)
2. 35.441 661.949 ↑ 1.0 45,837 1

Sort (cost=6,013.33..6,127.98 rows=45,858 width=16) (actual time=655.332..661.949 rows=45,837 loops=1)

  • Sort Key: ((aal.codigo)::bigint)
  • Sort Method: external merge Disk: 1,816kB
3. 30.278 626.508 ↑ 1.0 45,858 1

Hash Right Join (cost=2,205.05..2,462.80 rows=45,858 width=16) (actual time=588.902..626.508 rows=45,858 loops=1)

  • Hash Cond: (stockvendible.idarticuloalmacen = aal.idarticulo)
4. 576.495 576.495 ↓ 42.6 42,635 1

Function Scan on devuelvestockalmacenexistenciaspedidos stockvendible (cost=0.25..10.25 rows=1,000 width=16) (actual time=569.041..576.495 rows=42,635 loops=1)

5. 9.718 19.735 ↑ 1.0 45,858 1

Hash (cost=1,407.58..1,407.58 rows=45,858 width=16) (actual time=19.735..19.735 rows=45,858 loops=1)

  • Buckets: 65,536 Batches: 2 Memory Usage: 1,752kB
6. 10.017 10.017 ↑ 1.0 45,858 1

Seq Scan on articuloalmacen aal (cost=0.00..1,407.58 rows=45,858 width=16) (actual time=0.014..10.017 rows=45,858 loops=1)

7. 1.945 15,157.998 ↑ 55,650.0 14,123 1

Materialize (cost=10,614,733,021.16..10,618,662,745.96 rows=785,944,960 width=4,397) (actual time=15,127.030..15,157.998 rows=14,123 loops=1)

8. 125.679 15,156.053 ↑ 55,650.0 14,123 1

Sort (cost=10,614,733,021.16..10,616,697,883.56 rows=785,944,960 width=4,397) (actual time=15,127.025..15,156.053 rows=14,123 loops=1)

  • Sort Key: ((art.codigoarticulo)::bigint)
  • Sort Method: external merge Disk: 11,384kB
9. 82.333 15,030.374 ↑ 55,650.0 14,123 1

Hash Left Join (cost=6,121,909.40..99,806,220.82 rows=785,944,960 width=4,397) (actual time=13,694.695..15,030.374 rows=14,123 loops=1)

  • Hash Cond: (vd11.artcod = (art_1.codigoarticulo)::integer)
10. 29.773 12,377.086 ↑ 11,130.0 14,123 1

Hash Left Join (cost=6,118,193.31..32,604,210.64 rows=157,188,992 width=4,371) (actual time=11,123.385..12,377.086 rows=14,123 loops=1)

  • Hash Cond: ((art.codigoarticulo)::integer = (ventasultimasemana.codigoarticulo)::integer)
11. 1,224.191 12,347.245 ↑ 695.6 14,123 1

Hash Right Join (cost=5,845,170.93..11,086,113.57 rows=9,824,312 width=4,331) (actual time=11,123.294..12,347.245 rows=14,123 loops=1)

  • Hash Cond: (ventasultimasemanapr.articulo_id = art.idarticulo)
12. 0.001 0.076 ↓ 0.0 0 1

Subquery Scan on ventasultimasemanapr (cost=42,515.29..42,702.21 rows=9,346 width=24) (actual time=0.076..0.076 rows=0 loops=1)

13. 0.031 0.075 ↓ 0.0 0 1

HashAggregate (cost=42,515.29..42,608.75 rows=9,346 width=24) (actual time=0.075..0.075 rows=0 loops=1)

  • Group Key: venartdia.articulo_id
14. 0.001 0.044 ↓ 0.0 0 1

Bitmap Heap Scan on ventaarticulodia venartdia (cost=409.59..42,082.52 rows=19,234 width=72) (actual time=0.044..0.044 rows=0 loops=1)

  • Recheck Cond: (((fechaventa)::date >= (('now'::cstring)::date - 7)) AND ((fechaventa)::date <= (('now'::cstring)::date - 1)))
15. 0.043 0.043 ↓ 0.0 0 1

Bitmap Index Scan on ventaarticulodia_fechaventa_date (cost=0.00..404.79 rows=19,234 width=0) (actual time=0.042..0.043 rows=0 loops=1)

  • Index Cond: (((fechaventa)::date >= (('now'::cstring)::date - 7)) AND ((fechaventa)::date <= (('now'::cstring)::date - 1)))
16. 594.235 11,122.978 ↑ 695.6 14,123 1

Hash (cost=460,685.75..460,685.75 rows=9,824,312 width=4,323) (actual time=11,122.978..11,122.978 rows=14,123 loops=1)

  • Buckets: 1,024 Batches: 32,768 Memory Usage: 8kB
17. 17.705 10,528.743 ↑ 695.6 14,123 1

Merge Right Join (cost=62,432.30..460,685.75 rows=9,824,312 width=4,323) (actual time=10,354.272..10,528.743 rows=14,123 loops=1)

  • Merge Cond: (((pvaux.codigoarticulo)::integer) = vd11.artcod)
18. 0.004 10,155.855 ↓ 0.0 0 1

Sort (cost=33.19..33.69 rows=200 width=40) (actual time=10,155.855..10,155.855 rows=0 loops=1)

  • Sort Key: ((pvaux.codigoarticulo)::integer)
  • Sort Method: quicksort Memory: 25kB
19. 0.001 10,155.851 ↓ 0.0 0 1

Subquery Scan on pvaux (cost=21.55..25.55 rows=200 width=40) (actual time=10,155.851..10,155.851 rows=0 loops=1)

20. 0.000 10,155.850 ↓ 0.0 0 1

HashAggregate (cost=21.55..23.55 rows=200 width=40) (actual time=10,155.850..10,155.850 rows=0 loops=1)

  • Group Key: pvintercambios.codigoarticulo
21.          

Initplan (for HashAggregate)

22. 0.024 0.024 ↑ 1.0 1 1

Seq Scan on tienda t (cost=0.00..2.09 rows=1 width=4) (actual time=0.020..0.024 rows=1 loops=1)

  • Filter: actual
  • Rows Removed by Filter: 8
23. 0.007 0.007 ↑ 1.0 1 1

Seq Scan on tienda t_1 (cost=0.00..2.09 rows=1 width=4) (actual time=0.005..0.007 rows=1 loops=1)

  • Filter: actual
  • Rows Removed by Filter: 8
24. 0.006 0.006 ↑ 1.0 1 1

Seq Scan on tienda t_2 (cost=0.00..2.09 rows=1 width=4) (actual time=0.005..0.006 rows=1 loops=1)

  • Filter: actual
  • Rows Removed by Filter: 8
25. 10,155.846 10,155.846 ↓ 0.0 0 1

Function Scan on pendienteporvenir pvintercambios (cost=0.28..10.28 rows=1,000 width=40) (actual time=10,155.846..10,155.846 rows=0 loops=1)

26. 43.423 355.183 ↑ 695.6 14,123 1

Materialize (cost=62,399.11..288,725.10 rows=9,824,312 width=4,315) (actual time=198.412..355.183 rows=14,123 loops=1)

27. 57.408 311.760 ↑ 695.6 14,123 1

Merge Join (cost=62,399.11..264,164.32 rows=9,824,312 width=4,315) (actual time=198.406..311.760 rows=14,123 loops=1)

  • Merge Cond: ((art.codigoarticulo)::integer = vd11.artcod)
28. 18.009 143.859 ↑ 2.9 48,105 1

Merge Left Join (cost=7,686.13..11,886.35 rows=139,125 width=31) (actual time=111.809..143.859 rows=48,105 loops=1)

  • Merge Cond: (((art.codigoarticulo)::integer) = ((artcat.codigo)::integer))
29. 43.799 84.163 ↑ 1.0 48,105 1

Sort (cost=6,834.49..6,954.84 rows=48,140 width=23) (actual time=73.757..84.163 rows=48,105 loops=1)

  • Sort Key: ((art.codigoarticulo)::integer)
  • Sort Method: external merge Disk: 1,976kB
30. 30.783 40.364 ↑ 1.0 48,140 1

Hash Join (cost=1.09..3,090.42 rows=48,140 width=23) (actual time=0.044..40.364 rows=48,140 loops=1)

  • Hash Cond: (art.tipoarticulologistica_id = tipartlog.idtipoarticulologistica)
31. 9.569 9.569 ↑ 1.0 48,140 1

Seq Scan on articulo art (cost=0.00..2,427.40 rows=48,140 width=27) (actual time=0.014..9.569 rows=48,140 loops=1)

32. 0.005 0.012 ↑ 1.0 4 1

Hash (cost=1.04..1.04 rows=4 width=12) (actual time=0.011..0.012 rows=4 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
33. 0.007 0.007 ↑ 1.0 4 1

Seq Scan on tipoarticulologistica tipartlog (cost=0.00..1.04 rows=4 width=12) (actual time=0.007..0.007 rows=4 loops=1)

34. 7.802 41.687 ↓ 18.9 10,939 1

Sort (cost=851.64..853.08 rows=578 width=16) (actual time=38.048..41.687 rows=10,939 loops=1)

  • Sort Key: ((artcat.codigo)::integer)
  • Sort Method: quicksort Memory: 1,239kB
35. 6.402 33.885 ↓ 18.9 10,939 1

Nested Loop (cost=0.71..825.12 rows=578 width=16) (actual time=0.366..33.885 rows=10,939 loops=1)

36. 1.638 5.605 ↓ 18.9 10,939 1

Nested Loop (cost=0.42..636.01 rows=578 width=16) (actual time=0.354..5.605 rows=10,939 loops=1)

37. 0.039 0.338 ↑ 1.0 1 1

Nested Loop (cost=0.00..2.95 rows=1 width=8) (actual time=0.333..0.338 rows=1 loops=1)

  • Join Filter: (sur.annocomercial_id = anncom.idannocomercial)
  • Rows Removed by Join Filter: 14
38. 0.074 0.074 ↓ 15.0 15 1

Seq Scan on surtido sur (cost=0.00..1.58 rows=1 width=16) (actual time=0.028..0.074 rows=15 loops=1)

  • Filter: ((tiposurtido)::text ~~* 'IXP'::text)
  • Rows Removed by Filter: 31
39. 0.225 0.225 ↑ 2.0 1 15

Seq Scan on annocomercial anncom (cost=0.00..1.35 rows=2 width=8) (actual time=0.014..0.015 rows=1 loops=15)

  • Filter: ((('now'::cstring)::date >= fechainicio) AND (('now'::cstring)::date <= fechafin))
  • Rows Removed by Filter: 13
40. 3.629 3.629 ↓ 2.2 10,939 1

Index Scan using indicefk_00000078 on articuloventa artven (cost=0.42..582.72 rows=5,034 width=16) (actual time=0.016..3.629 rows=10,939 loops=1)

  • Index Cond: (surtido_id = sur.idsurtido)
41. 21.878 21.878 ↑ 1.0 1 10,939

Index Scan using articulocatalogo_pkey on articulocatalogo artcat (cost=0.29..0.32 rows=1 width=16) (actual time=0.002..0.002 rows=1 loops=10,939)

  • Index Cond: (idarticulocatalogo = artven.articulocatalogo_id)
42. 3.937 110.493 ↑ 1.0 14,123 1

Materialize (cost=54,712.98..54,783.59 rows=14,123 width=4,284) (actual time=86.583..110.493 rows=14,123 loops=1)

43. 75.354 106.556 ↑ 1.0 14,123 1

Sort (cost=54,712.98..54,748.29 rows=14,123 width=4,284) (actual time=86.561..106.556 rows=14,123 loops=1)

  • Sort Key: vd11.artcod
  • Sort Method: external merge Disk: 10,568kB
44. 26.824 31.202 ↑ 1.0 14,123 1

Nested Loop (cost=0.00..1,701.50 rows=14,123 width=4,284) (actual time=0.033..31.202 rows=14,123 loops=1)

45. 0.017 0.017 ↑ 1.0 1 1

Seq Scan on divisalogistica div (cost=0.00..1.04 rows=1 width=8) (actual time=0.017..0.017 rows=1 loops=1)

  • Filter: ((codigodivisalogistica)::text ~~* 'USD'::text)
  • Rows Removed by Filter: 2
46. 4.361 4.361 ↑ 1.0 14,123 1

Seq Scan on vd11 (cost=0.00..1,559.23 rows=14,123 width=4,276) (actual time=0.008..4.361 rows=14,123 loops=1)

47. 0.000 0.068 ↓ 0.0 0 1

Hash (cost=272,982.37..272,982.37 rows=3,200 width=556) (actual time=0.068..0.068 rows=0 loops=1)

  • Buckets: 4,096 Batches: 1 Memory Usage: 32kB
48. 0.001 0.068 ↓ 0.0 0 1

Subquery Scan on ventasultimasemana (cost=272,910.37..272,982.37 rows=3,200 width=556) (actual time=0.068..0.068 rows=0 loops=1)

49. 0.009 0.067 ↓ 0.0 0 1

HashAggregate (cost=272,910.37..272,950.37 rows=3,200 width=556) (actual time=0.067..0.067 rows=0 loops=1)

  • Group Key: COALESCE(elefac.codigoelemento, abo.codigoarticulo)
50. 0.010 0.058 ↓ 0.0 0 1

Hash Full Join (cost=269,116.14..272,332.33 rows=46,243 width=596) (actual time=0.058..0.058 rows=0 loops=1)

  • Hash Cond: ((elefac.codigoelemento)::text = (abo.codigoarticulo)::text)
51. 0.000 0.018 ↓ 0.0 0 1

GroupAggregate (cost=265,749.48..268,292.85 rows=46,243 width=52) (actual time=0.018..0.018 rows=0 loops=1)

  • Group Key: ((fac_1.fechacreacion)::date), elefac.codigoelemento
52. 0.004 0.018 ↓ 0.0 0 1

Sort (cost=265,749.48..265,865.09 rows=46,243 width=36) (actual time=0.018..0.018 rows=0 loops=1)

  • Sort Key: ((fac_1.fechacreacion)::date), elefac.codigoelemento
  • Sort Method: quicksort Memory: 25kB
53. 0.000 0.014 ↓ 0.0 0 1

Nested Loop (cost=403.17..260,899.36 rows=46,243 width=36) (actual time=0.014..0.014 rows=0 loops=1)

54. 0.000 0.014 ↓ 0.0 0 1

Nested Loop (cost=402.74..232,529.56 rows=47,142 width=24) (actual time=0.014..0.014 rows=0 loops=1)

55. 0.002 0.014 ↓ 0.0 0 1

Bitmap Heap Scan on factura fac_1 (cost=402.30..51,394.04 rows=18,913 width=16) (actual time=0.014..0.014 rows=0 loops=1)

  • Recheck Cond: (((fechacreacion)::date >= (('now'::cstring)::date - 7)) AND ((fechacreacion)::date <= (('now'::cstring)::date - 1)))
56. 0.012 0.012 ↓ 0.0 0 1

Bitmap Index Scan on factura_fechacreacion_date (cost=0.00..397.57 rows=18,913 width=0) (actual time=0.012..0.012 rows=0 loops=1)

  • Index Cond: (((fechacreacion)::date >= (('now'::cstring)::date - 7)) AND ((fechacreacion)::date <= (('now'::cstring)::date - 1)))
57. 0.000 0.000 ↓ 0.0 0

Index Scan using indicefk_00001289 on lineafactura linfac (cost=0.43..9.23 rows=35 width=24) (never executed)

  • Index Cond: (factura_id = fac_1.iddocumento)
  • Filter: ((reserva IS NULL) OR ((reserva)::text !~~* 'RA'::text))
58. 0.000 0.000 ↓ 0.0 0

Index Scan using elementofactura_pkey on elementofactura elefac (cost=0.43..0.59 rows=1 width=32) (never executed)

  • Index Cond: (idelemento = linfac.elementofactura_id)
  • Filter: ((tipoelemento)::text ~~* 'Articulo'::text)
59. 0.000 0.030 ↓ 0.0 0 1

Hash (cost=3,366.45..3,366.45 rows=16 width=48) (actual time=0.030..0.030 rows=0 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
60. 0.000 0.030 ↓ 0.0 0 1

Subquery Scan on abo (cost=3,365.41..3,366.45 rows=16 width=48) (actual time=0.030..0.030 rows=0 loops=1)

61. 0.002 0.030 ↓ 0.0 0 1

GroupAggregate (cost=3,365.41..3,366.29 rows=16 width=52) (actual time=0.030..0.030 rows=0 loops=1)

  • Group Key: ((abo_1.fechacreacion)::date), eleabo.codigoelemento
62. 0.007 0.028 ↓ 0.0 0 1

Sort (cost=3,365.41..3,365.45 rows=16 width=36) (actual time=0.028..0.028 rows=0 loops=1)

  • Sort Key: ((abo_1.fechacreacion)::date), eleabo.codigoelemento
  • Sort Method: quicksort Memory: 25kB
63. 0.001 0.021 ↓ 0.0 0 1

Nested Loop (cost=29.01..3,365.09 rows=16 width=36) (actual time=0.021..0.021 rows=0 loops=1)

64. 0.000 0.020 ↓ 0.0 0 1

Nested Loop (cost=28.59..3,355.77 rows=17 width=24) (actual time=0.020..0.020 rows=0 loops=1)

65. 0.002 0.020 ↓ 0.0 0 1

Bitmap Heap Scan on abono abo_1 (cost=28.17..3,253.99 rows=12 width=16) (actual time=0.020..0.020 rows=0 loops=1)

  • Recheck Cond: (((fechacreacion)::date >= (('now'::cstring)::date - 7)) AND ((fechacreacion)::date <= (('now'::cstring)::date - 1)))
  • Filter: (((estado)::text ~~* 'Cerrado'::text) AND (upper((tipo)::text) = ANY ('{ABONODEVOLUCION,ABONOANULACION}'::text[])))
66. 0.018 0.018 ↓ 0.0 0 1

Bitmap Index Scan on abono_fechacreacion_date (cost=0.00..28.17 rows=1,173 width=0) (actual time=0.018..0.018 rows=0 loops=1)

  • Index Cond: (((fechacreacion)::date >= (('now'::cstring)::date - 7)) AND ((fechacreacion)::date <= (('now'::cstring)::date - 1)))
67. 0.000 0.000 ↓ 0.0 0

Index Scan using indicefk_00001214 on lineaabono linabo (cost=0.42..8.46 rows=2 width=32) (never executed)

  • Index Cond: (abono_id = abo_1.iddocumento)
68. 0.000 0.000 ↓ 0.0 0

Index Scan using elementoabono_pkey on elementoabono eleabo (cost=0.42..0.54 rows=1 width=32) (never executed)

  • Index Cond: (idelemento = linabo.elementoabono_id)
  • Filter: ((tipoelemento)::text ~~* 'Articulo'::text)
69. 14.307 2,570.955 ↓ 42.5 42,484 1

Hash (cost=3,703.60..3,703.60 rows=1,000 width=34) (actual time=2,570.954..2,570.955 rows=42,484 loops=1)

  • Buckets: 65,536 (originally 1024) Batches: 2 (originally 1) Memory Usage: 2,073kB
70. 7.978 2,556.648 ↓ 42.5 42,484 1

Merge Left Join (cost=3,651.83..3,703.60 rows=1,000 width=34) (actual time=2,542.589..2,556.648 rows=42,484 loops=1)

  • Merge Cond: ((iva.idindiceventaanual = ivm.indiceventaanual_id) AND (((date_part('month'::text, (('now'::cstring)::date + (((ceil((articleslt.leadtime / '4'::double precision)))::text || ' MONTH'::text))::interval)))::integer) = ((ivm.mes)::integer)))
71. 68.402 2,548.670 ↓ 42.5 42,484 1

Sort (cost=3,639.96..3,642.46 rows=1,000 width=34) (actual time=2,542.586..2,548.670 rows=42,484 loops=1)

  • Sort Key: iva.idindiceventaanual, ((date_part('month'::text, (('now'::cstring)::date + (((ceil((articleslt.leadtime / '4'::double precision)))::text || ' MONTH'::text))::interval)))::integer)
  • Sort Method: external merge Disk: 2,056kB
72. 176.202 2,480.268 ↓ 42.5 42,484 1

Hash Left Join (cost=3,550.53..3,590.13 rows=1,000 width=34) (actual time=2,292.639..2,480.268 rows=42,484 loops=1)

  • Hash Cond: (date_part('year'::text, (('now'::cstring)::date + (((ceil((articleslt.leadtime / '4'::double precision)))::text || ' MONTH'::text))::interval)) = (iva.anio)::double precision)
73. 29.810 2,304.027 ↓ 42.5 42,484 1

HashAggregate (cost=3,549.15..3,559.15 rows=1,000 width=26) (actual time=2,292.538..2,304.027 rows=42,484 loops=1)

  • Group Key: art_1.codigoarticulo, articleslt.leadtime, articleslt.reliabilitylevel, articleslt.securityweeks
74. 23.053 2,274.217 ↓ 42.5 42,484 1

Hash Join (cost=3,265.40..3,539.15 rows=1,000 width=26) (actual time=2,242.835..2,274.217 rows=42,484 loops=1)

  • Hash Cond: (articleslt.article_id = art_1.idarticulo)
75. 2,229.542 2,229.542 ↓ 42.5 42,484 1

Function Scan on internalorderprovidersparametersforarticles articleslt (cost=0.25..10.25 rows=1,000 width=26) (actual time=2,221.023..2,229.542 rows=42,484 loops=1)

76. 9.299 21.622 ↑ 1.0 48,140 1

Hash (cost=2,427.40..2,427.40 rows=48,140 width=16) (actual time=21.622..21.622 rows=48,140 loops=1)

  • Buckets: 65,536 Batches: 2 Memory Usage: 1,815kB
77. 12.323 12.323 ↑ 1.0 48,140 1

Seq Scan on articulo art_1 (cost=0.00..2,427.40 rows=48,140 width=16) (actual time=0.018..12.323 rows=48,140 loops=1)

78. 0.009 0.039 ↑ 1.0 17 1

Hash (cost=1.17..1.17 rows=17 width=10) (actual time=0.039..0.039 rows=17 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
79. 0.030 0.030 ↑ 1.0 17 1

Seq Scan on indiceventaanual iva (cost=0.00..1.17 rows=17 width=10) (actual time=0.028..0.030 rows=17 loops=1)

80. 0.000 0.000 ↓ 0.0 0

Sort (cost=11.87..12.38 rows=204 width=18) (never executed)

  • Sort Key: ivm.indiceventaanual_id, ((ivm.mes)::integer)
81. 0.000 0.000 ↓ 0.0 0

Seq Scan on indiceventamensual ivm (cost=0.00..4.04 rows=204 width=18) (never executed)

Planning time : 8.626 ms