explain.depesz.com

PostgreSQL's explain analyze made readable

Result: XJRT

Settings
# exclusive inclusive rows x rows loops node
1. 84.400 15,953.276 ↑ 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,830.437..15,953.276 rows=14,123 loops=1)

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

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

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

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

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

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

5. 8.883 18.421 ↑ 1.0 45,858 1

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

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

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

7. 2.032 15,234.899 ↑ 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,203.429..15,234.899 rows=14,123 loops=1)

8. 125.967 15,232.867 ↑ 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,203.426..15,232.867 rows=14,123 loops=1)

  • Sort Key: ((art.codigoarticulo)::bigint)
  • Sort Method: external merge Disk: 11,384kB
9. 79.005 15,106.900 ↑ 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,783.634..15,106.900 rows=14,123 loops=1)

  • Hash Cond: (vd11.artcod = (art_1.codigoarticulo)::integer)
10. 29.215 12,489.498 ↑ 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,244.898..12,489.498 rows=14,123 loops=1)

  • Hash Cond: ((art.codigoarticulo)::integer = (ventasultimasemana.codigoarticulo)::integer)
11. 1,215.641 12,460.215 ↑ 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,244.806..12,460.215 rows=14,123 loops=1)

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

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

13. 0.033 0.074 ↓ 0.0 0 1

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

  • Group Key: venartdia.articulo_id
14. 0.002 0.041 ↓ 0.0 0 1

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

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

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

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

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

  • Buckets: 1,024 Batches: 32,768 Memory Usage: 8kB
17. 16.611 10,705.512 ↑ 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,537.270..10,705.512 rows=14,123 loops=1)

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

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

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

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

20. 0.000 10,340.358 ↓ 0.0 0 1

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

  • Group Key: pvintercambios.codigoarticulo
21.          

Initplan (for HashAggregate)

22. 0.023 0.023 ↑ 1.0 1 1

Seq Scan on tienda t (cost=0.00..2.09 rows=1 width=4) (actual time=0.019..0.023 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.006..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,340.355 10,340.355 ↓ 0.0 0 1

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

26. 42.895 348.538 ↑ 695.6 14,123 1

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

27. 55.436 305.643 ↑ 695.6 14,123 1

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

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

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

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

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

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

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

  • Hash Cond: (art.tipoarticulologistica_id = tipartlog.idtipoarticulologistica)
31. 9.566 9.566 ↑ 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.566 rows=48,140 loops=1)

32. 0.004 0.012 ↑ 1.0 4 1

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

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

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

34. 7.747 41.462 ↓ 18.9 10,939 1

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

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

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

36. 1.553 5.448 ↓ 18.9 10,939 1

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

37. 0.045 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.068 0.068 ↓ 15.0 15 1

Seq Scan on surtido sur (cost=0.00..1.58 rows=1 width=16) (actual time=0.026..0.068 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.557 3.557 ↓ 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.557 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.909 108.618 ↑ 1.0 14,123 1

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

43. 73.507 104.709 ↑ 1.0 14,123 1

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

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

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

45. 0.016 0.016 ↑ 1.0 1 1

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

  • Filter: ((codigodivisalogistica)::text ~~* 'USD'::text)
  • Rows Removed by Filter: 2
46. 4.352 4.352 ↑ 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.352 rows=14,123 loops=1)

47. 0.001 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.000 0.067 ↓ 0.0 0 1

Subquery Scan on ventasultimasemana (cost=272,910.37..272,982.37 rows=3,200 width=556) (actual time=0.067..0.067 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.009 0.058 ↓ 0.0 0 1

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

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

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

  • Group Key: ((fac_1.fechacreacion)::date), elefac.codigoelemento
52. 0.003 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.015 ↓ 0.0 0 1

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

54. 0.001 0.015 ↓ 0.0 0 1

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

55. 0.001 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.013 0.013 ↓ 0.0 0 1

Bitmap Index Scan on factura_fechacreacion_date (cost=0.00..397.57 rows=18,913 width=0) (actual time=0.013..0.013 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.001 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.001 0.029 ↓ 0.0 0 1

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

61. 0.001 0.028 ↓ 0.0 0 1

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

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

Sort (cost=3,365.41..3,365.45 rows=16 width=36) (actual time=0.027..0.027 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.020..0.021 rows=0 loops=1)

64. 0.001 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.000 0.019 ↓ 0.0 0 1

Bitmap Heap Scan on abono abo_1 (cost=28.17..3,253.99 rows=12 width=16) (actual time=0.019..0.019 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.019 0.019 ↓ 0.0 0 1

Bitmap Index Scan on abono_fechacreacion_date (cost=0.00..28.17 rows=1,173 width=0) (actual time=0.019..0.019 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.296 2,538.397 ↓ 42.5 42,484 1

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

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

Merge Left Join (cost=3,651.83..3,703.60 rows=1,000 width=34) (actual time=2,509.807..2,524.101 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. 67.205 2,516.072 ↓ 42.5 42,484 1

Sort (cost=3,639.96..3,642.46 rows=1,000 width=34) (actual time=2,509.803..2,516.072 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. 172.500 2,448.867 ↓ 42.5 42,484 1

Hash Left Join (cost=3,550.53..3,590.13 rows=1,000 width=34) (actual time=2,265.137..2,448.867 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.154 2,276.330 ↓ 42.5 42,484 1

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

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

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

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

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

76. 9.249 21.080 ↑ 1.0 48,140 1

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

  • Buckets: 65,536 Batches: 2 Memory Usage: 1,815kB
77. 11.831 11.831 ↑ 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.019..11.831 rows=48,140 loops=1)

78. 0.009 0.037 ↑ 1.0 17 1

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

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

Seq Scan on indiceventaanual iva (cost=0.00..1.17 rows=17 width=10) (actual time=0.026..0.028 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.486 ms