explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Eeuh

Settings
# exclusive inclusive rows x rows loops node
1. 84.435 16,410.952 ↑ 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=16,288.620..16,410.952 rows=14,123 loops=1)

  • Merge Cond: (((aal.codigo)::bigint) = ((art.codigoarticulo)::bigint))
  • Execution time: 16,419.193 ms(161 filas)
2. 35.401 638.993 ↑ 1.0 45,837 1

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

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

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

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

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

5. 8.909 18.523 ↑ 1.0 45,858 1

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

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

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

7. 1.950 15,687.524 ↑ 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,656.379..15,687.524 rows=14,123 loops=1)

8. 130.447 15,685.574 ↑ 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,656.374..15,685.574 rows=14,123 loops=1)

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

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

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

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

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

13. 0.034 0.082 ↓ 0.0 0 1

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

  • Group Key: venartdia.articulo_id
14. 0.003 0.048 ↓ 0.0 0 1

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

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

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

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

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

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

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

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

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

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

20. 0.000 10,094.986 ↓ 0.0 0 1

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

  • Group Key: pvintercambios.codigoarticulo
21.          

Initplan (for HashAggregate)

22. 0.025 0.025 ↑ 1.0 1 1

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

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

26. 43.486 354.771 ↑ 695.6 14,123 1

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

27. 57.855 311.285 ↑ 695.6 14,123 1

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

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

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

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

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

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

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

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

Seq Scan on articulo art (cost=0.00..2,427.40 rows=48,140 width=27) (actual time=0.013..9.428 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.592 41.503 ↓ 18.9 10,939 1

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

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

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

36. 1.597 5.423 ↓ 18.9 10,939 1

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

37. 0.045 0.357 ↑ 1.0 1 1

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

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

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

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

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

  • Filter: ((('now'::cstring)::date >= fechainicio) AND (('now'::cstring)::date <= fechafin))
  • Rows Removed by Filter: 13
40. 3.469 3.469 ↓ 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.017..3.469 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.926 110.569 ↑ 1.0 14,123 1

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

43. 75.357 106.643 ↑ 1.0 14,123 1

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

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

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

45. 0.018 0.018 ↑ 1.0 1 1

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

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

47. 0.000 0.070 ↓ 0.0 0 1

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

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

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

49. 0.010 0.069 ↓ 0.0 0 1

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

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

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

  • Hash Cond: ((elefac.codigoelemento)::text = (abo.codigoarticulo)::text)
51. 0.001 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.003 0.017 ↓ 0.0 0 1

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

  • Sort Key: ((fac_1.fechacreacion)::date), elefac.codigoelemento
  • Sort Method: quicksort Memory: 25kB
53. 0.001 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.013 ↓ 0.0 0 1

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

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

Hash (cost=3,366.45..3,366.45 rows=16 width=48) (actual time=0.031..0.031 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.001 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.029 ↓ 0.0 0 1

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

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

Nested Loop (cost=29.01..3,365.09 rows=16 width=36) (actual time=0.021..0.022 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.000 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.020 0.020 ↓ 0.0 0 1

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

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

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

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

Sort (cost=3,639.96..3,642.46 rows=1,000 width=34) (actual time=2,534.623..2,540.807 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. 174.535 2,473.381 ↓ 42.5 42,484 1

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

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

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

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

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

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

76. 9.466 21.443 ↑ 1.0 48,140 1

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

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

78. 0.010 0.035 ↑ 1.0 17 1

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

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

Seq Scan on indiceventaanual iva (cost=0.00..1.17 rows=17 width=10) (actual time=0.024..0.025 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 : 16.894 ms