explain.depesz.com

PostgreSQL's explain analyze made readable

Result: DBM

Settings
# exclusive inclusive rows x rows loops node
1. 1.735 2,091.319 ↑ 2.3 110 1

Nested Loop Left Join (cost=6,671.80..1,257,975.40 rows=256 width=762) (actual time=64.796..2,091.319 rows=110 loops=1)

  • Join Filter: ((ec_1.id_prod_com = ec.id_prod_com) AND (fo.id_uf = tm.id_uf))
2. 0.173 1,979.345 ↑ 2.3 110 1

Hash Join (cost=6,308.83..1,125,113.01 rows=256 width=511) (actual time=64.632..1,979.345 rows=110 loops=1)

  • Hash Cond: (ep.id_unid_v = un.id_unid)
3. 0.159 1,979.127 ↑ 2.3 110 1

Hash Left Join (cost=6,307.34..1,125,110.71 rows=256 width=508) (actual time=64.578..1,979.127 rows=110 loops=1)

  • Hash Cond: (eq.id_tipo_estoque = tt.id_tipo_estoque)
  • Join Filter: (eq.id_tipo_estoque = 1)
4. 0.353 1,978.957 ↑ 2.3 110 1

Nested Loop Left Join (cost=6,306.27..1,125,107.81 rows=256 width=490) (actual time=64.563..1,978.957 rows=110 loops=1)

5. 0.124 1,977.834 ↑ 2.3 110 1

Hash Left Join (cost=6,305.99..1,124,323.61 rows=256 width=486) (actual time=64.545..1,977.834 rows=110 loops=1)

  • Hash Cond: (ep.id_pes_for = fr.id_pes)
6. 0.114 1,977.497 ↑ 2.3 110 1

Hash Left Join (cost=6,268.44..1,124,285.39 rows=256 width=463) (actual time=64.325..1,977.497 rows=110 loops=1)

  • Hash Cond: (ep.id_pes_fab = ff.id_pes)
7. 0.107 1,977.143 ↑ 2.3 110 1

Nested Loop (cost=6,230.89..1,124,247.17 rows=256 width=440) (actual time=64.081..1,977.143 rows=110 loops=1)

8. 0.004 0.033 ↑ 1.0 1 1

Nested Loop (cost=0.28..9.33 rows=1 width=8) (actual time=0.033..0.033 rows=1 loops=1)

9. 0.011 0.011 ↑ 1.0 1 1

Seq Scan on cg_emp cg (cost=0.00..1.02 rows=1 width=8) (actual time=0.011..0.011 rows=1 loops=1)

  • Filter: (id_emp = 1)
  • Rows Removed by Filter: 1
10. 0.018 0.018 ↑ 1.0 1 1

Index Scan using pk_tb_municipio on tb_municipio tm (cost=0.28..8.30 rows=1 width=8) (actual time=0.018..0.018 rows=1 loops=1)

  • Index Cond: (id_municipio = cg.id_municipio)
11. 0.175 1,977.003 ↑ 2.3 110 1

Hash Left Join (cost=6,230.61..1,124,235.28 rows=256 width=440) (actual time=64.044..1,977.003 rows=110 loops=1)

  • Hash Cond: (ep.id_pes_lab = fl.id_pes)
12. 0.147 1,976.584 ↑ 2.3 110 1

Hash Left Join (cost=6,193.06..1,124,197.06 rows=256 width=417) (actual time=63.795..1,976.584 rows=110 loops=1)

  • Hash Cond: (ep.id_tipo_prod = tp.id_tipo_prod)
13. 0.138 1,976.421 ↑ 2.3 110 1

Hash Join (cost=6,191.72..1,124,194.86 rows=256 width=417) (actual time=63.768..1,976.421 rows=110 loops=1)

  • Hash Cond: (ep.id_marca = em.id_marca)
14. 0.247 1,976.268 ↑ 2.3 110 1

Hash Join (cost=6,190.68..1,124,191.72 rows=256 width=417) (actual time=63.747..1,976.268 rows=110 loops=1)

  • Hash Cond: (ep.id_dpto_d = ed.id_dpto)
15. 6.104 1,976.000 ↑ 2.3 110 1

Merge Right Join (cost=6,189.27..1,124,189.49 rows=256 width=412) (actual time=63.719..1,976.000 rows=110 loops=1)

  • Merge Cond: ((pq.id_prod = eq.id_prod) AND (pq.id_tipo_estoque = eq.id_tipo_estoque))
16. 69.525 1,941.336 ↑ 1.0 25,736 1

GroupAggregate (cost=2,499.02..1,120,103.14 rows=26,278 width=112) (actual time=15.031..1,941.336 rows=25,736 loops=1)

  • Group Key: pq.id_emp, pq.id_prod, pq.id_tipo_estoque
17. 14.193 18.819 ↑ 1.0 25,737 1

Sort (cost=2,499.02..2,564.87 rows=26,340 width=16) (actual time=14.543..18.819 rows=25,737 loops=1)

  • Sort Key: pq.id_prod, pq.id_tipo_estoque
  • Sort Method: quicksort Memory: 2474kB
18. 4.626 4.626 ↑ 1.0 26,340 1

Seq Scan on eq_prod_qtde pq (cost=0.00..565.01 rows=26,340 width=16) (actual time=0.012..4.626 rows=26,340 loops=1)

  • Filter: (id_emp = 1)
  • Rows Removed by Filter: 61
19.          

SubPlan (forGroupAggregate)

20. 180.152 1,672.840 ↑ 1.0 1 25,736

Aggregate (cost=17.82..17.83 rows=1 width=32) (actual time=0.065..0.065 rows=1 loops=25,736)

21. 0.000 1,492.688 ↓ 0.0 0 25,736

Nested Loop (cost=0.27..17.81 rows=1 width=5) (actual time=0.058..0.058 rows=0 loops=25,736)

22. 1,492.688 1,492.688 ↓ 0.0 0 25,736

Seq Scan on vnd_pedido vp (cost=0.00..9.50 rows=1 width=45) (actual time=0.058..0.058 rows=0 loops=25,736)

  • Filter: (((tipo)::text <> 'orc'::text) AND ((status)::text = 'aberto'::text) AND ((cnc)::text = 'nao'::text))
  • Rows Removed by Filter: 143
23. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_vnd_pedido_prod on vnd_pedido_prod pp (cost=0.27..8.30 rows=1 width=50) (never executed)

  • Index Cond: ((id_pdv = vp.id_pdv) AND (id_emp = vp.id_emp) AND ((id_pedido)::text = (vp.id_pedido)::text))
  • Filter: ((id_tipo_estoque = pq.id_tipo_estoque) AND ((cnc)::text = 'nao'::text) AND (id_prod = pq.id_prod))
24. 0.000 180.152 ↑ 1.0 1 25,736

Aggregate (cost=24.67..24.68 rows=1 width=32) (actual time=0.007..0.007 rows=1 loops=25,736)

25. 180.152 180.152 ↓ 0.0 0 25,736

Nested Loop (cost=0.00..24.66 rows=1 width=32) (actual time=0.007..0.007 rows=0 loops=25,736)

  • Join Filter: (mo.id_os = moi.id_os)
26. 0.000 0.000 ↓ 0.0 0 25,736

Seq Scan on mv_os mo (cost=0.00..11.05 rows=1 width=4) (actual time=0.000..0.000 rows=0 loops=25,736)

  • Filter: (((status)::text = 'aberto'::text) AND (id_emp = pq.id_emp))
27. 0.000 0.000 ↓ 0.0 0

Seq Scan on mv_os_item moi (cost=0.00..13.60 rows=1 width=36) (never executed)

  • Filter: ((id_tipo_estoque = pq.id_tipo_estoque) AND (id_prod = pq.id_prod))
28. 0.156 28.560 ↑ 2.3 110 1

Sort (cost=3,690.25..3,690.89 rows=256 width=316) (actual time=28.515..28.560 rows=110 loops=1)

  • Sort Key: eq.id_prod, eq.id_tipo_estoque
  • Sort Method: quicksort Memory: 54kB
29. 1.646 28.404 ↑ 2.3 110 1

Hash Right Join (cost=3,013.71..3,680.01 rows=256 width=316) (actual time=24.177..28.404 rows=110 loops=1)

  • Hash Cond: (eq.id_prod = ec.id_prod)
30. 2.674 2.674 ↑ 1.0 26,340 1

Seq Scan on eq_prod_qtde eq (cost=0.00..565.01 rows=26,340 width=59) (actual time=0.028..2.674 rows=26,340 loops=1)

  • Filter: (id_emp = 1)
  • Rows Removed by Filter: 61
31. 0.100 24.084 ↑ 2.3 110 1

Hash (cost=3,010.51..3,010.51 rows=256 width=261) (actual time=24.084..24.084 rows=110 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 29kB
32. 1.801 23.984 ↑ 2.3 110 1

Hash Join (cost=1,128.37..3,010.51 rows=256 width=261) (actual time=13.336..23.984 rows=110 loops=1)

  • Hash Cond: (ec.id_prod = ep.id_prod)
33. 9.155 9.155 ↑ 1.0 26,811 1

Seq Scan on eq_prod_com ec (cost=0.00..1,811.36 rows=26,962 width=41) (actual time=0.188..9.155 rows=26,811 loops=1)

  • Filter: ((id_emp = 1) AND (id_tipo_situacao = 4))
  • Rows Removed by Filter: 26813
34. 0.114 13.028 ↑ 2.3 110 1

Hash (cost=1,125.18..1,125.18 rows=255 width=220) (actual time=13.028..13.028 rows=110 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 24kB
35. 12.914 12.914 ↑ 2.3 110 1

Seq Scan on eq_prod ep (cost=0.00..1,125.18 rows=255 width=220) (actual time=0.393..12.914 rows=110 loops=1)

  • Filter: (((descricaor)::text ~~ '%ARROZ%'::text) AND ((especial)::text = 'NAO'::text))
  • Rows Removed by Filter: 26702
36. 0.010 0.021 ↑ 1.0 18 1

Hash (cost=1.18..1.18 rows=18 width=13) (actual time=0.021..0.021 rows=18 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
37. 0.011 0.011 ↑ 1.0 18 1

Seq Scan on eq_dpto ed (cost=0.00..1.18 rows=18 width=13) (actual time=0.010..0.011 rows=18 loops=1)

38. 0.005 0.015 ↑ 1.0 2 1

Hash (cost=1.02..1.02 rows=2 width=8) (actual time=0.015..0.015 rows=2 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
39. 0.010 0.010 ↑ 1.0 2 1

Seq Scan on eq_marca em (cost=0.00..1.02 rows=2 width=8) (actual time=0.010..0.010 rows=2 loops=1)

40. 0.005 0.016 ↑ 1.0 15 1

Hash (cost=1.15..1.15 rows=15 width=4) (actual time=0.016..0.016 rows=15 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
41. 0.011 0.011 ↑ 1.0 15 1

Seq Scan on tb_tipo_prod tp (cost=0.00..1.15 rows=15 width=4) (actual time=0.010..0.011 rows=15 loops=1)

42. 0.089 0.244 ↑ 1.0 691 1

Hash (cost=28.91..28.91 rows=691 width=31) (actual time=0.244..0.244 rows=691 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 52kB
43. 0.155 0.155 ↑ 1.0 691 1

Seq Scan on fn_pes fl (cost=0.00..28.91 rows=691 width=31) (actual time=0.010..0.155 rows=691 loops=1)

44. 0.104 0.240 ↑ 1.0 691 1

Hash (cost=28.91..28.91 rows=691 width=31) (actual time=0.240..0.240 rows=691 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 52kB
45. 0.136 0.136 ↑ 1.0 691 1

Seq Scan on fn_pes ff (cost=0.00..28.91 rows=691 width=31) (actual time=0.008..0.136 rows=691 loops=1)

46. 0.091 0.213 ↑ 1.0 691 1

Hash (cost=28.91..28.91 rows=691 width=31) (actual time=0.213..0.213 rows=691 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 52kB
47. 0.122 0.122 ↑ 1.0 691 1

Seq Scan on fn_pes fr (cost=0.00..28.91 rows=691 width=31) (actual time=0.009..0.122 rows=691 loops=1)

48. 0.770 0.770 ↑ 1.0 1 110

Index Scan using pk_tb_ncm on tb_ncm tn (cost=0.29..3.06 rows=1 width=12) (actual time=0.007..0.007 rows=1 loops=110)

  • Index Cond: (id_ncm = ep.id_ncm)
49. 0.001 0.011 ↑ 1.0 3 1

Hash (cost=1.03..1.03 rows=3 width=22) (actual time=0.011..0.011 rows=3 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
50. 0.010 0.010 ↑ 1.0 3 1

Seq Scan on tb_tipo_estoque tt (cost=0.00..1.03 rows=3 width=22) (actual time=0.009..0.010 rows=3 loops=1)

51. 0.011 0.045 ↑ 1.0 22 1

Hash (cost=1.22..1.22 rows=22 width=7) (actual time=0.045..0.045 rows=22 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
52. 0.034 0.034 ↑ 1.0 22 1

Seq Scan on tb_unid un (cost=0.00..1.22 rows=22 width=7) (actual time=0.030..0.034 rows=22 loops=1)

53. 0.049 0.110 ↓ 0.0 0 110

Materialize (cost=362.97..691.30 rows=1 width=72) (actual time=0.001..0.001 rows=0 loops=110)

54. 0.000 0.061 ↓ 0.0 0 1

Nested Loop (cost=362.97..691.29 rows=1 width=72) (actual time=0.061..0.061 rows=0 loops=1)

55. 0.005 0.061 ↓ 0.0 0 1

Hash Join (cost=362.83..691.13 rows=1 width=80) (actual time=0.061..0.061 rows=0 loops=1)

  • Hash Cond: (fd.id_grade_trib_aliq = gd.id_grade_trib_aliq)
56. 0.011 0.011 ↑ 1,286.0 1 1

Seq Scan on fs_grade_trib_ufd fd (cost=0.00..323.48 rows=1,286 width=4) (actual time=0.011..0.011 rows=1 loops=1)

  • Filter: (id_uf = 26)
57. 0.000 0.045 ↓ 0.0 0 1

Hash (cost=362.81..362.81 rows=1 width=96) (actual time=0.045..0.045 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
58. 0.025 0.045 ↓ 0.0 0 1

Hash Join (cost=125.37..362.81 rows=1 width=96) (actual time=0.045..0.045 rows=0 loops=1)

  • Hash Cond: (fo.id_grade_trib_aliq = gd.id_grade_trib_aliq)
59. 0.010 0.010 ↑ 12,389.0 1 1

Seq Scan on fs_grade_trib_ufo fo (cost=0.00..190.89 rows=12,389 width=8) (actual time=0.010..0.010 rows=1 loops=1)

60. 0.001 0.010 ↓ 0.0 0 1

Hash (cost=125.36..125.36 rows=1 width=88) (actual time=0.009..0.010 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
61. 0.001 0.009 ↓ 0.0 0 1

Nested Loop (cost=102.97..125.36 rows=1 width=88) (actual time=0.009..0.009 rows=0 loops=1)

  • Join Filter: (ga.id_grade_trib = ec_1.id_grade_trib)
62. 0.000 0.008 ↓ 0.0 0 1

Hash Join (cost=102.68..120.96 rows=1 width=84) (actual time=0.008..0.008 rows=0 loops=1)

  • Hash Cond: (el.id_simbologia = ga.id_simbologia)
63. 0.008 0.008 ↓ 0.0 0 1

Seq Scan on eq_prod_com_lista_preco el (cost=0.00..16.00 rows=600 width=72) (actual time=0.008..0.008 rows=0 loops=1)

64. 0.000 0.000 ↓ 0.0 0

Hash (cost=102.67..102.67 rows=1 width=20) (never executed)

65. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=75.70..102.67 rows=1 width=20) (never executed)

66. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=75.42..101.67 rows=1 width=8) (never executed)

  • Hash Cond: (gd.id_grade_trib_aliq = ge.id_grade_trib_aliq)
67. 0.000 0.000 ↓ 0.0 0

Seq Scan on fs_grade_trib_dcto gd (cost=0.00..25.43 rows=215 width=4) (never executed)

  • Filter: (id_tipo_dcto = 41)
68. 0.000 0.000 ↓ 0.0 0

Hash (cost=75.41..75.41 rows=1 width=4) (never executed)

69. 0.000 0.000 ↓ 0.0 0

Seq Scan on fs_grade_trib_entidade ge (cost=0.00..75.41 rows=1 width=4) (never executed)

  • Filter: (id_tipo_entidade = 3)
70. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_fs_grade_trib_aliq on fs_grade_trib_aliq ga (cost=0.28..1.00 rows=1 width=12) (never executed)

  • Index Cond: (id_grade_trib_aliq = gd.id_grade_trib_aliq)
71. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_eq_prod_com on eq_prod_com ec_1 (cost=0.29..4.39 rows=1 width=8) (never executed)

  • Index Cond: (id_prod_com = el.id_prod_com)
72. 0.000 0.000 ↓ 0.0 0

Index Only Scan using pk_fs_grade_trib on fs_grade_trib gt (cost=0.14..0.16 rows=1 width=4) (never executed)

  • Index Cond: (id_grade_trib = ec_1.id_grade_trib)
  • Heap Fetches: 0
73.          

SubPlan (forNested Loop Left Join)

74. 0.000 0.000 ↓ 0.0 0

Seq Scan on eq_prod_pdc pd (cost=0.00..35.50 rows=10 width=0) (never executed)

  • Filter: (id_prod = ep.id_prod)
75. 0.009 0.009 ↓ 0.0 0 1

Seq Scan on eq_prod_pdc pd_1 (cost=0.00..30.40 rows=2,040 width=4) (actual time=0.008..0.009 rows=0 loops=1)

76. 0.000 0.000 ↓ 0.0 0

Seq Scan on eq_prod_apr pa (cost=0.00..17.50 rows=3 width=0) (never executed)

  • Filter: (id_prod = ep.id_prod)
77. 0.010 0.010 ↓ 0.0 0 1

Seq Scan on eq_prod_apr pa_1 (cost=0.00..16.00 rows=600 width=4) (actual time=0.010..0.010 rows=0 loops=1)

78. 0.110 1.980 ↑ 1.0 1 110

Aggregate (cost=3.63..3.64 rows=1 width=8) (actual time=0.018..0.018 rows=1 loops=110)

79. 0.957 1.870 ↓ 0.0 0 110

Nested Loop (cost=0.00..3.63 rows=1 width=4) (actual time=0.017..0.017 rows=0 loops=110)

  • Join Filter: (od.id_promo = eo.id_promo)
  • Rows Removed by Join Filter: 0
80. 0.880 0.880 ↓ 0.0 0 110

Seq Scan on eq_promo_prod od (cost=0.00..1.95 rows=1 width=8) (actual time=0.008..0.008 rows=0 loops=110)

  • Filter: (id_prod = ep.id_prod)
  • Rows Removed by Filter: 76
81. 0.033 0.033 ↑ 1.0 3 1

Seq Scan on eq_promo eo (cost=0.00..1.64 rows=3 width=4) (actual time=0.023..0.033 rows=3 loops=1)

  • Filter: (((LOCALTIMESTAMP)::date >= (dt_inicial)::date) AND ((LOCALTIMESTAMP)::date <= (dt_final)::date) AND ((LOCALTIMESTAMP)::time without time zone >= hr_inicial) AND ((LOCALTIMESTAMP)::time without time zone <= hr_final))
  • Rows Removed by Filter: 13
82. 0.880 108.130 ↑ 1.0 1 110

Limit (cost=0.00..503.23 rows=1 width=13) (actual time=0.983..0.983 rows=1 loops=110)

83. 107.250 107.250 ↑ 1.0 1 110

Seq Scan on eq_prod_ean pe (cost=0.00..503.23 rows=1 width=13) (actual time=0.975..0.975 rows=1 loops=110)

  • Filter: (id_prod = ep.id_prod)
  • Rows Removed by Filter: 13478