explain.depesz.com

PostgreSQL's explain analyze made readable

Result: FiKi

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 56.395 6,793.326 ↑ 4.1 4,616 1

Merge Left Join (cost=14,550.02..4,775,473.98 rows=19,067 width=1,099) (actual time=57.054..6,793.326 rows=4,616 loops=1)

  • Merge Cond: (pro.pro_id = buf.pro_id)
2. 2.919 89.580 ↓ 1.0 4,616 1

Merge Left Join (cost=14,224.64..14,868.30 rows=4,529 width=945) (actual time=49.166..89.580 rows=4,616 loops=1)

  • Merge Cond: (pro.pro_id = pft.pro_id)
3. 4.123 84.356 ↓ 1.0 4,616 1

Merge Left Join (cost=14,224.36..14,684.64 rows=4,529 width=618) (actual time=49.150..84.356 rows=4,616 loops=1)

  • Merge Cond: (pro.pro_id = pim.pro_id)
4. 5.364 73.460 ↓ 1.0 4,616 1

Merge Left Join (cost=14,224.08..14,504.35 rows=4,529 width=614) (actual time=49.140..73.460 rows=4,616 loops=1)

  • Merge Cond: (pro.pro_id = pro1.pro_id)
5. 6.973 61.239 ↓ 1.0 4,616 1

Merge Left Join (cost=14,223.80..14,247.24 rows=4,529 width=606) (actual time=49.127..61.239 rows=4,616 loops=1)

  • Merge Cond: (pro.pro_id = saldoinv.pro_id)
6. 7.902 15.701 ↓ 1.0 4,616 1

Sort (cost=628.56..639.89 rows=4,529 width=606) (actual time=13.304..15.701 rows=4,616 loops=1)

  • Sort Key: pro.pro_id
  • Sort Method: quicksort Memory: 1419kB
7. 5.837 7.799 ↓ 1.0 4,616 1

Hash Left Join (cost=23.98..353.54 rows=4,529 width=606) (actual time=0.376..7.799 rows=4,616 loops=1)

  • Hash Cond: (pro.cla1_id = cla1.cla2_id)
8. 1.608 1.608 ↓ 1.0 4,616 1

Seq Scan on producto pro (cost=0.00..267.29 rows=4,529 width=606) (actual time=0.013..1.608 rows=4,616 loops=1)

9. 0.122 0.354 ↑ 1.0 421 1

Hash (cost=18.70..18.70 rows=422 width=8) (actual time=0.354..0.354 rows=421 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 25kB
10. 0.232 0.232 ↑ 1.0 422 1

Index Only Scan using idx_vclasificacion_ids on v_clasificacion1tot cla1 (cost=0.27..18.70 rows=422 width=8) (actual time=0.012..0.232 rows=422 loops=1)

  • Heap Fetches: 0
11. 3.581 38.565 ↓ 73.4 3,888 1

Sort (cost=13,595.23..13,595.37 rows=53 width=4) (actual time=35.817..38.565 rows=3,888 loops=1)

  • Sort Key: saldoinv.pro_id
  • Sort Method: quicksort Memory: 279kB
12. 34.984 34.984 ↓ 73.4 3,888 1

Index Only Scan using saldoinv_pkey on saldoinv (cost=0.41..13,593.72 rows=53 width=4) (actual time=27.769..34.984 rows=3,888 loops=1)

  • Index Cond: (bod_id = 1)
  • Filter: ((sal_periodo)::double precision = date_part('year'::text, (('now'::cstring)::date)::timestamp without time zone))
  • Rows Removed by Filter: 7121
  • Heap Fetches: 4452
13. 6.857 6.857 ↓ 1.0 4,616 1

Index Scan using idx_producto1_producto on producto1 pro1 (cost=0.28..189.54 rows=4,500 width=12) (actual time=0.010..6.857 rows=4,616 loops=1)

14. 6.773 6.773 ↑ 1.0 3,968 1

Index Scan using pk_producto_pim on producto_importaciones pim (cost=0.28..118.76 rows=4,017 width=8) (actual time=0.009..6.773 rows=3,968 loops=1)

15. 2.305 2.305 ↑ 1.0 1,058 1

Index Scan using idx_producto_fichatecnica_pro_id on producto_fichatecnica pft (cost=0.28..158.77 rows=1,085 width=331) (actual time=0.013..2.305 rows=1,058 loops=1)

  • Filter: (idi_id = 4)
  • Rows Removed by Filter: 342
16. 12.998 12.998 ↑ 4.7 4,073 1

Index Only Scan using idx_buffer_pro_id on buffer buf (cost=0.29..559.67 rows=19,067 width=4) (actual time=0.008..12.998 rows=4,073 loops=1)

  • Heap Fetches: 7669
17.          

SubPlan (forMerge Left Join)

18. 9.232 55.392 ↑ 1.0 1 4,616

Aggregate (cost=12.20..12.21 rows=1 width=32) (actual time=0.012..0.012 rows=1 loops=4,616)

19. 6.509 46.160 ↑ 3.0 1 4,616

Nested Loop (cost=0.56..12.19 rows=3 width=8) (actual time=0.008..0.010 rows=1 loops=4,616)

20. 27.696 27.696 ↑ 3.0 1 4,616

Index Scan using idx_productos_modelos_hermanos_prod1_id on productos_modelos_hermanos pmh (cost=0.28..4.68 rows=3 width=4) (actual time=0.005..0.006 rows=1 loops=4,616)

  • Index Cond: (pro1.prod1_id = prod1)
  • Filter: (pro1.mdl_id <> mdl_id)
  • Rows Removed by Filter: 0
21. 11.955 11.955 ↑ 1.0 1 3,985

Index Scan using modelo_pk on modelo mdl (cost=0.28..2.50 rows=1 width=12) (actual time=0.003..0.003 rows=1 loops=3,985)

  • Index Cond: (mdl_id = pmh.mdl_id)
22. 0.257 4.329 ↓ 16.1 645 1

HashAggregate (cost=324.20..324.60 rows=40 width=4) (actual time=4.245..4.329 rows=645 loops=1)

  • Group Key: dpromocion_producto.pro_id
23. 0.059 4.072 ↓ 16.1 645 1

Append (cost=21.75..324.10 rows=40 width=4) (actual time=0.461..4.072 rows=645 loops=1)

24. 0.064 0.481 ↓ 10.6 149 1

HashAggregate (cost=21.75..21.89 rows=14 width=4) (actual time=0.461..0.481 rows=149 loops=1)

  • Group Key: dpromocion_producto.pro_id
25. 0.030 0.417 ↓ 10.7 150 1

Nested Loop (cost=20.85..21.71 rows=14 width=4) (actual time=0.294..0.417 rows=150 loops=1)

26. 0.006 0.249 ↓ 11.5 23 1

Unique (cost=20.57..20.58 rows=2 width=4) (actual time=0.239..0.249 rows=23 loops=1)

27. 0.017 0.243 ↓ 11.5 23 1

Sort (cost=20.57..20.57 rows=2 width=4) (actual time=0.238..0.243 rows=23 loops=1)

  • Sort Key: dva.dpv_id
  • Sort Method: quicksort Memory: 26kB
28. 0.018 0.226 ↓ 11.5 23 1

Nested Loop (cost=0.27..20.56 rows=2 width=4) (actual time=0.048..0.226 rows=23 loops=1)

29. 0.139 0.139 ↓ 11.5 23 1

Seq Scan on promocion prom (cost=0.00..15.56 rows=2 width=4) (actual time=0.029..0.139 rows=23 loops=1)

  • Filter: (ppr_activo AND (('now'::cstring)::date <= ppr_fechafinal))
  • Rows Removed by Filter: 467
30. 0.069 0.069 ↑ 1.0 1 23

Index Scan using dpromocion_validacion_llave_cabecera on dpromocion_validacion dva (cost=0.27..2.49 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=23)

  • Index Cond: (ppr_id = prom.ppr_id)
31. 0.138 0.138 ↑ 1.0 7 23

Index Scan using dpromocion_producto_llave_cabecera on dpromocion_producto (cost=0.28..0.50 rows=7 width=8) (actual time=0.003..0.006 rows=7 loops=23)

  • Index Cond: (dpv_id = dva.dpv_id)
  • Filter: (cla1_id IS NULL)
  • Rows Removed by Filter: 1
32. 0.077 3.532 ↓ 19.1 496 1

Unique (cost=301.68..301.81 rows=26 width=4) (actual time=3.396..3.532 rows=496 loops=1)

33. 0.187 3.455 ↓ 19.1 496 1

Sort (cost=301.68..301.75 rows=26 width=4) (actual time=3.395..3.455 rows=496 loops=1)

  • Sort Key: pro_1.pro_id
  • Sort Method: quicksort Memory: 48kB
34. 1.862 3.268 ↓ 19.1 496 1

Hash Semi Join (cost=21.60..301.07 rows=26 width=4) (actual time=0.405..3.268 rows=496 loops=1)

  • Hash Cond: (pro_1.cla1_id = dpromocion_producto_1.cla1_id)
35. 1.081 1.081 ↓ 1.0 4,616 1

Seq Scan on producto pro_1 (cost=0.00..267.29 rows=4,529 width=8) (actual time=0.008..1.081 rows=4,616 loops=1)

36. 0.007 0.325 ↓ 25.0 25 1

Hash (cost=21.59..21.59 rows=1 width=4) (actual time=0.325..0.325 rows=25 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
37. 0.017 0.318 ↓ 25.0 25 1

Nested Loop (cost=20.85..21.59 rows=1 width=4) (actual time=0.230..0.318 rows=25 loops=1)

38. 0.004 0.232 ↓ 11.5 23 1

Unique (cost=20.57..20.58 rows=2 width=4) (actual time=0.225..0.232 rows=23 loops=1)

39. 0.013 0.228 ↓ 11.5 23 1

Sort (cost=20.57..20.57 rows=2 width=4) (actual time=0.223..0.228 rows=23 loops=1)

  • Sort Key: dva_1.dpv_id
  • Sort Method: quicksort Memory: 26kB
40. 0.023 0.215 ↓ 11.5 23 1

Nested Loop (cost=0.27..20.56 rows=2 width=4) (actual time=0.030..0.215 rows=23 loops=1)

41. 0.146 0.146 ↓ 11.5 23 1

Seq Scan on promocion prom_1 (cost=0.00..15.56 rows=2 width=4) (actual time=0.023..0.146 rows=23 loops=1)

  • Filter: (ppr_activo AND (('now'::cstring)::date <= ppr_fechafinal))
  • Rows Removed by Filter: 467
42. 0.046 0.046 ↑ 1.0 1 23

Index Scan using dpromocion_validacion_llave_cabecera on dpromocion_validacion dva_1 (cost=0.27..2.49 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=23)

  • Index Cond: (ppr_id = prom_1.ppr_id)
43. 0.069 0.069 ↑ 1.0 1 23

Index Scan using dpromocion_producto_llave_cabecera on dpromocion_producto dpromocion_producto_1 (cost=0.28..0.50 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=23)

  • Index Cond: (dpv_id = dva_1.dpv_id)
  • Filter: (cla1_id IS NOT NULL)
  • Rows Removed by Filter: 7
44. 60.968 6,573.184 ↑ 1.0 1 4,616

Nested Loop (cost=0.00..211.75 rows=1 width=32) (actual time=0.618..1.424 rows=1 loops=4,616)

  • Join Filter: (pem.emb_id = emb.emb_id)
  • Rows Removed by Join Filter: 31
45. 6,494.712 6,494.712 ↑ 1.0 1 4,616

Seq Scan on producto_embalaje pem (cost=0.00..209.96 rows=1 width=8) (actual time=0.606..1.407 rows=1 loops=4,616)

  • Filter: ((ebp_tipo = 2) AND (prod1_id = pro1.prod1_id))
  • Rows Removed by Filter: 8609
46. 17.504 17.504 ↑ 1.0 34 4,376

Seq Scan on embalaje emb (cost=0.00..1.34 rows=34 width=18) (actual time=0.002..0.004 rows=34 loops=4,376)

47. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on producto_llegado prll (cost=1.40..3.56 rows=1 width=0) (never executed)

  • Recheck Cond: (pro_id = pro.pro_id)
  • Filter: (prll_estado = ANY ('{2,4}'::integer[]))
48. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on idx_producto_llegado_pro_id (cost=0.00..1.40 rows=2 width=0) (never executed)

  • Index Cond: (pro_id = pro.pro_id)
49. 0.418 0.418 ↑ 2.0 1 1

Seq Scan on producto_llegado prll_1 (cost=0.00..50.73 rows=2 width=4) (actual time=0.176..0.418 rows=1 loops=1)

  • Filter: (prll_estado = ANY ('{2,4}'::integer[]))
  • Rows Removed by Filter: 2377
50. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=1.67..15.26 rows=1 width=0) (never executed)

  • Join Filter: (COALESCE(dpv.dpv_prod_mes, 0) = 0)
51. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=1.39..12.49 rows=1 width=8) (never executed)

52. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=1.10..12.17 rows=1 width=12) (never executed)

53. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.83..10.21 rows=6 width=16) (never executed)

54. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.55..7.54 rows=1 width=8) (never executed)

55. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_producto_mes on dpromocion_validacion dpv (cost=0.27..2.51 rows=2 width=12) (never executed)

  • Index Cond: (dpv_prod_mes = 1)
56. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_promocion on promocion prm (cost=0.27..2.51 rows=1 width=4) (never executed)

  • Index Cond: (ppr_id = dpv.ppr_id)
  • Filter: (ppr_activo AND (('now'::cstring)::date >= ppr_fechainicio) AND (('now'::cstring)::date <= ppr_fechafinal))
57. 0.000 0.000 ↓ 0.0 0

Index Scan using dpromocion_cantidad_llave_cabecera on dpromocion_cantidad dpc (cost=0.28..2.62 rows=5 width=12) (never executed)

  • Index Cond: (dpv_id = dpv.dpv_id)
58. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_dpromocion_promocion on dpromocion_producto dpp2 (cost=0.28..0.32 rows=1 width=4) (never executed)

  • Index Cond: (dpp_id = dpc.dpp_id)
  • Filter: (pro_id = pro.pro_id)
59. 0.000 0.000 ↓ 0.0 0

Index Only Scan using dpromocion_despacho_llave_cabecera on dpromocion_despacho dpd (cost=0.28..0.31 rows=1 width=4) (never executed)

  • Index Cond: (dpct_id = dpc.dpct_id)
  • Heap Fetches: 0
60. 0.000 0.000 ↓ 0.0 0

Index Only Scan using dpromocion_producto_llave_cabecera on dpromocion_producto dpp (cost=0.28..2.68 rows=7 width=4) (never executed)

  • Index Cond: (dpv_id = dpv.dpv_id)
  • Heap Fetches: 0
61. 0.078 0.943 ↓ 23.0 138 1

Nested Loop Left Join (cost=1.67..16.54 rows=6 width=4) (actual time=0.114..0.943 rows=138 loops=1)

  • Join Filter: (dpv_1.dpv_prod_mes = 1)
62. 0.023 0.589 ↓ 23.0 138 1

Nested Loop Left Join (cost=1.39..14.58 rows=6 width=8) (actual time=0.101..0.589 rows=138 loops=1)

63. 0.014 0.115 ↑ 1.0 1 1

Nested Loop Left Join (cost=0.83..10.31 rows=1 width=8) (actual time=0.077..0.115 rows=1 loops=1)

  • Join Filter: (COALESCE(dpv_1.dpv_prod_mes, 0) = 0)
  • Rows Removed by Join Filter: 138
64. 0.009 0.062 ↑ 1.0 1 1

Nested Loop (cost=0.55..7.54 rows=1 width=8) (actual time=0.025..0.062 rows=1 loops=1)

65. 0.011 0.011 ↓ 3.0 6 1

Index Scan using idx_producto_mes on dpromocion_validacion dpv_1 (cost=0.27..2.51 rows=2 width=12) (actual time=0.008..0.011 rows=6 loops=1)

  • Index Cond: (dpv_prod_mes = 1)
66. 0.042 0.042 ↓ 0.0 0 6

Index Scan using pk_promocion on promocion prm_1 (cost=0.27..2.51 rows=1 width=4) (actual time=0.007..0.007 rows=0 loops=6)

  • Index Cond: (ppr_id = dpv_1.ppr_id)
  • Filter: (ppr_activo AND (('now'::cstring)::date >= ppr_fechainicio) AND (('now'::cstring)::date <= ppr_fechafinal))
  • Rows Removed by Filter: 1
67. 0.039 0.039 ↓ 19.7 138 1

Index Only Scan using dpromocion_producto_llave_cabecera on dpromocion_producto dpp_1 (cost=0.28..2.68 rows=7 width=4) (actual time=0.010..0.039 rows=138 loops=1)

  • Index Cond: (dpv_id = dpv_1.dpv_id)
  • Heap Fetches: 138
68. 0.129 0.451 ↓ 27.6 138 1

Nested Loop Left Join (cost=0.56..4.22 rows=5 width=8) (actual time=0.022..0.451 rows=138 loops=1)

69. 0.046 0.046 ↓ 27.6 138 1

Index Scan using dpromocion_cantidad_llave_cabecera on dpromocion_cantidad dpc_1 (cost=0.28..2.62 rows=5 width=12) (actual time=0.009..0.046 rows=138 loops=1)

  • Index Cond: (dpv_id = dpv_1.dpv_id)
70. 0.276 0.276 ↑ 1.0 1 138

Index Only Scan using dpromocion_despacho_llave_cabecera on dpromocion_despacho dpd_1 (cost=0.28..0.31 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=138)

  • Index Cond: (dpct_id = dpc_1.dpct_id)
  • Heap Fetches: 138
71. 0.276 0.276 ↑ 1.0 1 138

Index Scan using pk_dpromocion_promocion on dpromocion_producto dpp2_1 (cost=0.28..0.31 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=138)

  • Index Cond: (dpp_id = dpc_1.dpp_id)
72. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.28..6.81 rows=1 width=0) (never executed)

73. 0.000 0.000 ↓ 0.0 0

Seq Scan on cordcom cor (cost=0.00..4.30 rows=1 width=4) (never executed)

  • Filter: (cor_estado = 5)
74. 0.000 0.000 ↓ 0.0 0

Index Only Scan using idx_dordcom_corpro on dordcom dor (cost=0.28..2.50 rows=1 width=4) (never executed)

  • Index Cond: ((cor_id = cor.cor_id) AND (pro_id = pro.pro_id))
  • Heap Fetches: 0
75. 0.001 0.087 ↓ 0.0 0 1

Nested Loop (cost=0.28..33.92 rows=72 width=4) (actual time=0.087..0.087 rows=0 loops=1)

76. 0.086 0.086 ↓ 0.0 0 1

Seq Scan on cordcom cor_1 (cost=0.00..4.30 rows=1 width=4) (actual time=0.086..0.086 rows=0 loops=1)

  • Filter: (cor_estado = 5)
  • Rows Removed by Filter: 106
77. 0.000 0.000 ↓ 0.0 0

Index Only Scan using idx_dordcom_corpro on dordcom dor_1 (cost=0.28..28.90 rows=72 width=8) (never executed)

  • Index Cond: (cor_id = cor_1.cor_id)
  • Heap Fetches: 0
Planning time : 7.713 ms
Execution time : 6,795.164 ms