explain.depesz.com

PostgreSQL's explain analyze made readable

Result: HKqe

Settings
# exclusive inclusive rows x rows loops node
1. 97.812 157,733.476 ↓ 2.0 2,911 1

Merge Left Join (cost=506.36..394,705.53 rows=1,420 width=804) (actual time=134.151..157,733.476 rows=2,911 loops=1)

  • Merge Cond: (pro.pro_id = pim.pro_id)
2. 9.901 153,234.897 ↓ 2.0 2,911 1

Nested Loop Left Join (cost=180.99..36,219.92 rows=1,420 width=614) (actual time=125.473..153,234.897 rows=2,911 loops=1)

3. 18.889 153,204.619 ↓ 2.0 2,911 1

Merge Join (cost=180.71..35,773.38 rows=1,420 width=614) (actual time=125.457..153,204.619 rows=2,911 loops=1)

  • Merge Cond: (pro.pro_id = pro1.pro_id)
4. 153,059.528 153,174.888 ↓ 1.7 2,996 1

Index Scan using producto_pkey on producto pro (cost=180.43..35,862.13 rows=1,749 width=606) (actual time=125.444..153,174.888 rows=2,996 loops=1)

  • Filter: (pro_activo AND ((obtenersaldoinvbodega_tb((('now'::cstring)::date)::timestamp without time zone, (pro_id)::numeric, '1'::numeric) > '0'::numeric) OR (hashed SubPlan 11) OR (cla1_id = 509) OR ((SubPlan 12) > '0'::numeric) OR (pro_nuevo = 1)) AND (((SubPlan 13) > '0'::numeric) OR ((SubPlan 14) > '0'::numeric)))
  • Rows Removed by Filter: 1593
5.          

SubPlan (forIndex Scan)

6. 0.821 3.594 ↓ 2.5 6,218 1

Nested Loop (cost=0.28..174.00 rows=2,459 width=4) (actual time=0.111..3.594 rows=6,218 loops=1)

7. 0.293 0.293 ↓ 2.4 80 1

Seq Scan on cordcom cor_2 (cost=0.00..5.86 rows=34 width=4) (actual time=0.050..0.293 rows=80 loops=1)

  • Filter: ((cor_estado <> 9) AND (date_part('day'::text, (cor_fecha_disponibilidad - (('now'::cstring)::date)::timestamp without time zone)) <= '21'::double precision))
  • Rows Removed by Filter: 26
8. 2.480 2.480 ↓ 1.1 78 80

Index Only Scan using idx_dordcom_corpro on dordcom dor_2 (cost=0.28..4.23 rows=72 width=8) (actual time=0.007..0.031 rows=78 loops=80)

  • Index Cond: (cor_id = cor_2.cor_id)
  • Heap Fetches: 2702
9. 18.634 18.634 ↑ 1.0 1 847

Index Scan using idx_buffer_pro_id on buffer (cost=0.29..2.51 rows=1 width=4) (actual time=0.019..0.022 rows=1 loops=847)

  • Index Cond: (pro_id = pro.pro_id)
10. 64.134 64.134 ↑ 1.0 1 3,563

Index Scan using idx_dlistapre_aux_pro_id_lpr_id on dlistapre_aux dp (cost=0.29..2.51 rows=1 width=3) (actual time=0.018..0.018 rows=1 loops=3,563)

  • Index Cond: ((lpr_id = 1) AND (pro_id = pro.pro_id))
11. 28.998 28.998 ↑ 1.0 1 3,222

Index Scan using idx_dlistapre_pro_id_lpr_id on dlistapre dp_1 (cost=0.29..2.51 rows=1 width=6) (actual time=0.009..0.009 rows=1 loops=3,222)

  • Index Cond: ((lpr_id = 1) AND (pro_id = pro.pro_id))
12. 10.842 10.842 ↓ 1.0 3,711 1

Index Scan using idx_producto1_producto on producto1 pro1 (cost=0.28..189.54 rows=3,677 width=12) (actual time=0.008..10.842 rows=3,711 loops=1)

  • Filter: prod1_muestraapp
  • Rows Removed by Filter: 823
13. 20.377 20.377 ↑ 1.0 1 2,911

Index Scan using idx_vclasificacion1tot_cla2_id on v_clasificacion1tot cla1 (cost=0.27..0.30 rows=1 width=8) (actual time=0.006..0.007 rows=1 loops=2,911)

  • Index Cond: (pro.cla1_id = cla2_id)
14. 10.293 10.293 ↑ 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..10.293 rows=3,968 loops=1)

15.          

SubPlan (forMerge Left Join)

16. 11.644 55.309 ↑ 1.0 1 2,911

Aggregate (cost=12.20..12.21 rows=1 width=32) (actual time=0.019..0.019 rows=1 loops=2,911)

17. 6.713 43.665 ↑ 3.0 1 2,911

Nested Loop (cost=0.56..12.19 rows=3 width=8) (actual time=0.012..0.015 rows=1 loops=2,911)

18. 23.288 23.288 ↑ 3.0 1 2,911

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.007..0.008 rows=1 loops=2,911)

  • Index Cond: (pro1.prod1_id = prod1)
  • Filter: (pro1.mdl_id <> mdl_id)
  • Rows Removed by Filter: 1
19. 13.664 13.664 ↑ 1.0 1 3,416

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

  • Index Cond: (mdl_id = pmh.mdl_id)
20. 2.911 23.288 ↓ 0.0 0 2,911

Limit (cost=0.28..2.50 rows=1 width=327) (actual time=0.008..0.008 rows=0 loops=2,911)

21. 20.377 20.377 ↓ 0.0 0 2,911

Index Scan using idx_producto_fichatecnica_pro_id on producto_fichatecnica ps (cost=0.28..2.50 rows=1 width=327) (actual time=0.007..0.007 rows=0 loops=2,911)

  • Index Cond: (pro_id = pro.pro_id)
  • Filter: (idi_id = 4)
  • Rows Removed by Filter: 0
22. 0.290 5.049 ↓ 16.1 645 1

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

  • Group Key: dpromocion_producto.pro_id
23. 0.057 4.759 ↓ 16.1 645 1

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

24. 0.065 0.533 ↓ 10.6 149 1

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

  • Group Key: dpromocion_producto.pro_id
25. 0.025 0.468 ↓ 10.7 150 1

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

26. 0.007 0.282 ↓ 11.5 23 1

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

27. 0.020 0.275 ↓ 11.5 23 1

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

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

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

29. 0.177 0.177 ↓ 11.5 23 1

Seq Scan on promocion prom (cost=0.00..15.56 rows=2 width=4) (actual time=0.044..0.177 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.002..0.003 rows=1 loops=23)

  • Index Cond: (ppr_id = prom.ppr_id)
31. 0.161 0.161 ↑ 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.005..0.007 rows=7 loops=23)

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

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

33. 0.206 4.077 ↓ 19.1 496 1

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

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

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

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

Seq Scan on producto pro_1 (cost=0.00..267.29 rows=4,529 width=8) (actual time=0.019..1.616 rows=4,589 loops=1)

36. 0.013 0.317 ↓ 25.0 25 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
37. 0.016 0.304 ↓ 25.0 25 1

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

38. 0.006 0.219 ↓ 11.5 23 1

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

39. 0.040 0.213 ↓ 11.5 23 1

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

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

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

41. 0.111 0.111 ↓ 11.5 23 1

Seq Scan on promocion prom_1 (cost=0.00..15.56 rows=2 width=4) (actual time=0.029..0.111 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. 61.851 4,305.369 ↑ 1.0 1 2,911

Nested Loop (cost=0.00..211.75 rows=1 width=32) (actual time=0.651..1.479 rows=1 loops=2,911)

  • Join Filter: (pem.emb_id = emb.emb_id)
  • Rows Removed by Join Filter: 31
45. 4,229.683 4,229.683 ↑ 1.0 1 2,911

Seq Scan on producto_embalaje pem (cost=0.00..209.96 rows=1 width=8) (actual time=0.631..1.453 rows=1 loops=2,911)

  • Filter: ((ebp_tipo = 2) AND (prod1_id = pro1.prod1_id))
  • Rows Removed by Filter: 8555
46. 13.835 13.835 ↑ 1.0 34 2,767

Seq Scan on embalaje emb (cost=0.00..1.34 rows=34 width=18) (actual time=0.003..0.005 rows=34 loops=2,767)

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.489 0.489 ↑ 2.0 1 1

Seq Scan on producto_llegado prll_1 (cost=0.00..50.73 rows=2 width=4) (actual time=0.179..0.489 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.048 0.911 ↓ 23.0 138 1

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

  • Join Filter: (dpv_1.dpv_prod_mes = 1)
62. 0.022 0.587 ↓ 23.0 138 1

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

63. 0.022 0.171 ↑ 1.0 1 1

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

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

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

65. 0.021 0.021 ↓ 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.019..0.021 rows=6 loops=1)

  • Index Cond: (dpv_prod_mes = 1)
66. 0.030 0.030 ↓ 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.005..0.005 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.091 0.091 ↓ 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.031..0.091 rows=138 loops=1)

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

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

69. 0.038 0.038 ↓ 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.010..0.038 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.059 ↓ 0.0 0 1

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

76. 0.058 0.058 ↓ 0.0 0 1

Seq Scan on cordcom cor_1 (cost=0.00..4.30 rows=1 width=4) (actual time=0.058..0.058 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