explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ywIA

Settings
# exclusive inclusive rows x rows loops node
1. 0.648 154.915 ↑ 2.3 109 1

Hash Left Join (cost=3,949.42..135,452.20 rows=251 width=598) (actual time=37.816..154.915 rows=109 loops=1)

  • Hash Cond: ((ec.id_prod_com = ec_1.id_prod_com) AND (cg.id_municipio = fo.id_uf))
2. 0.070 46.873 ↑ 2.3 109 1

Hash Left Join (cost=3,822.42..5,743.10 rows=251 width=394) (actual time=37.625..46.873 rows=109 loops=1)

  • Hash Cond: (ep.id_pes_for = fr.id_pes)
3. 0.059 46.518 ↑ 2.3 109 1

Hash Left Join (cost=3,784.87..5,704.89 rows=251 width=371) (actual time=37.334..46.518 rows=109 loops=1)

  • Hash Cond: (ep.id_pes_fab = ff.id_pes)
4. 0.064 46.166 ↑ 2.3 109 1

Hash Left Join (cost=3,747.32..5,666.68 rows=251 width=348) (actual time=37.036..46.166 rows=109 loops=1)

  • Hash Cond: (ep.id_pes_lab = fl.id_pes)
5. 0.072 45.801 ↑ 2.3 109 1

Hash Left Join (cost=3,709.78..5,628.48 rows=251 width=325) (actual time=36.729..45.801 rows=109 loops=1)

  • Hash Cond: (ep.id_tipo_prod = tp.id_tipo_prod)
6. 0.074 45.685 ↑ 2.3 109 1

Hash Join (cost=3,708.44..5,626.29 rows=251 width=325) (actual time=36.672..45.685 rows=109 loops=1)

  • Hash Cond: (ep.id_marca = em.id_marca)
7. 0.163 45.575 ↑ 2.3 109 1

Hash Join (cost=3,707.39..5,623.19 rows=251 width=325) (actual time=36.628..45.575 rows=109 loops=1)

  • Hash Cond: (ep.id_dpto_d = ed.id_dpto)
8. 1.883 45.394 ↑ 2.3 109 1

Hash Join (cost=3,705.99..5,620.97 rows=251 width=320) (actual time=36.515..45.394 rows=109 loops=1)

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

Seq Scan on eq_prod_com ec (cost=0.00..1,811.36 rows=26,962 width=28) (actual time=0.012..7.079 rows=26,811 loops=1)

  • Filter: ((id_emp = 1) AND (id_tipo_situacao = 4))
  • Rows Removed by Filter: 26813
10. 0.076 36.432 ↑ 2.3 109 1

Hash (cost=3,702.86..3,702.86 rows=250 width=308) (actual time=36.432..36.432 rows=109 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 29kB
11. 0.040 36.356 ↑ 2.3 109 1

Hash Join (cost=2,965.23..3,702.86 rows=250 width=308) (actual time=31.172..36.356 rows=109 loops=1)

  • Hash Cond: (ep.id_unid_v = un.id_unid)
12. 0.025 36.301 ↑ 2.3 109 1

Nested Loop (cost=2,963.74..3,700.59 rows=250 width=305) (actual time=31.153..36.301 rows=109 loops=1)

13. 0.002 0.022 ↑ 1.0 1 1

Nested Loop (cost=0.00..2.07 rows=1 width=30) (actual time=0.021..0.022 rows=1 loops=1)

14. 0.010 0.010 ↑ 1.0 1 1

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

  • Filter: (id_emp = 1)
  • Rows Removed by Filter: 1
15. 0.010 0.010 ↑ 1.0 1 1

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

  • Filter: (id_tipo_estoque = 1)
  • Rows Removed by Filter: 2
16. 1.619 36.254 ↑ 2.3 109 1

Hash Join (cost=2,963.74..3,696.02 rows=250 width=279) (actual time=31.130..36.254 rows=109 loops=1)

  • Hash Cond: (eq.id_prod = ep.id_prod)
17. 3.593 3.593 ↑ 1.0 26,338 1

Seq Scan on eq_prod_qtde eq (cost=0.00..631.01 rows=26,338 width=55) (actual time=0.014..3.593 rows=26,338 loops=1)

  • Filter: ((id_emp = 1) AND (id_tipo_estoque = 1))
  • Rows Removed by Filter: 63
18. 0.070 31.042 ↑ 2.3 110 1

Hash (cost=2,960.55..2,960.55 rows=255 width=224) (actual time=31.042..31.042 rows=110 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 25kB
19. 0.634 30.972 ↑ 2.3 110 1

Merge Right Join (cost=2,561.90..2,960.55 rows=255 width=224) (actual time=28.919..30.972 rows=110 loops=1)

  • Merge Cond: (tn.id_ncm = ep.id_ncm)
20. 1.432 1.432 ↑ 1.3 9,439 1

Index Scan using idx_tb_ncm_id_ncm on tb_ncm tn (cost=0.29..491.90 rows=12,534 width=12) (actual time=0.012..1.432 rows=9,439 loops=1)

21. 0.086 28.906 ↑ 2.3 110 1

Sort (cost=2,561.62..2,562.25 rows=255 width=220) (actual time=28.901..28.906 rows=110 loops=1)

  • Sort Key: ep.id_ncm
  • Sort Method: quicksort Memory: 48kB
22. 1.738 28.820 ↑ 2.3 110 1

Hash Right Join (cost=1,956.92..2,551.42 rows=255 width=220) (actual time=21.826..28.820 rows=110 loops=1)

  • Hash Cond: (pq.id_prod = ep.id_prod)
23. 13.090 17.291 ↓ 1.0 26,338 1

HashAggregate (cost=828.55..1,091.31 rows=26,276 width=112) (actual time=11.971..17.291 rows=26,338 loops=1)

  • Group Key: pq.id_emp, pq.id_prod, pq.id_tipo_estoque
24. 4.201 4.201 ↑ 1.0 26,338 1

Seq Scan on eq_prod_qtde pq (cost=0.00..631.01 rows=26,338 width=12) (actual time=0.027..4.201 rows=26,338 loops=1)

  • Filter: ((id_emp = 1) AND (id_tipo_estoque = 1))
  • Rows Removed by Filter: 63
25. 0.097 9.791 ↑ 2.3 110 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 24kB
26. 9.694 9.694 ↑ 2.3 110 1

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

  • Filter: (((descricaor)::text ~~ '%ARROZ%'::text) AND ((especial)::text = 'NAO'::text))
  • Rows Removed by Filter: 26702
27. 0.003 0.015 ↑ 1.0 22 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
28. 0.012 0.012 ↑ 1.0 22 1

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

29. 0.004 0.018 ↑ 1.0 18 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
30. 0.014 0.014 ↑ 1.0 18 1

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

31. 0.004 0.036 ↑ 1.0 2 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
32. 0.032 0.032 ↑ 1.0 2 1

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

33. 0.015 0.044 ↑ 1.0 15 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
34. 0.029 0.029 ↑ 1.0 15 1

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

35. 0.128 0.301 ↑ 1.0 691 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 52kB
36. 0.173 0.173 ↑ 1.0 691 1

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

37. 0.153 0.293 ↑ 1.0 691 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 52kB
38. 0.140 0.140 ↑ 1.0 691 1

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

39. 0.147 0.285 ↑ 1.0 691 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 52kB
40. 0.138 0.138 ↑ 1.0 691 1

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

41. 0.000 0.011 ↓ 0.0 0 1

Hash (cost=126.98..126.98 rows=1 width=8) (actual time=0.011..0.011 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
42. 0.001 0.011 ↓ 0.0 0 1

Nested Loop (cost=103.69..126.98 rows=1 width=8) (actual time=0.011..0.011 rows=0 loops=1)

  • Join Filter: (gd.id_grade_trib_aliq = fd.id_grade_trib_aliq)
43. 0.000 0.010 ↓ 0.0 0 1

Nested Loop (cost=103.40..126.37 rows=1 width=24) (actual time=0.010..0.010 rows=0 loops=1)

  • Join Filter: (gd.id_grade_trib_aliq = fo.id_grade_trib_aliq)
44. 0.000 0.010 ↓ 0.0 0 1

Nested Loop (cost=103.11..125.52 rows=1 width=16) (actual time=0.010..0.010 rows=0 loops=1)

45. 0.000 0.010 ↓ 0.0 0 1

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

  • Join Filter: (ga.id_grade_trib = ec_1.id_grade_trib)
46. 0.001 0.010 ↓ 0.0 0 1

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

  • Hash Cond: (el.id_simbologia = ga.id_simbologia)
47. 0.009 0.009 ↓ 0.0 0 1

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

48. 0.000 0.000 ↓ 0.0 0

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

49. 0.000 0.000 ↓ 0.0 0

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

50. 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)
51. 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)
52. 0.000 0.000 ↓ 0.0 0

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

53. 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)
54. 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)
55. 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)
56. 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
57. 0.000 0.000 ↓ 0.0 0

Index Scan using fs_grade_trib_ufo_id_aliq on fs_grade_trib_ufo fo (cost=0.29..0.74 rows=9 width=8) (never executed)

  • Index Cond: (id_grade_trib_aliq = ga.id_grade_trib_aliq)
58. 0.000 0.000 ↓ 0.0 0

Index Scan using fs_grade_trib_ufd_id_aliq on fs_grade_trib_ufd fd (cost=0.29..0.60 rows=1 width=4) (never executed)

  • Index Cond: (id_grade_trib_aliq = fo.id_grade_trib_aliq)
  • Filter: (id_uf = 26)
59.          

SubPlan (forHash Left Join)

60. 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)
61. 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.009..0.009 rows=0 loops=1)

62. 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)
63. 0.009 0.009 ↓ 0.0 0 1

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

64. 0.109 1.853 ↑ 1.0 1 109

Aggregate (cost=3.63..3.64 rows=1 width=8) (actual time=0.017..0.017 rows=1 loops=109)

65. 0.949 1.744 ↓ 0.0 0 109

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

  • Join Filter: (od.id_promo = eo.id_promo)
  • Rows Removed by Join Filter: 0
66. 0.763 0.763 ↓ 0.0 0 109

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

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

Seq Scan on eq_promo eo (cost=0.00..1.64 rows=3 width=4) (actual time=0.027..0.032 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
68. 0.763 105.512 ↑ 1.0 1 109

Limit (cost=0.00..503.23 rows=1 width=13) (actual time=0.968..0.968 rows=1 loops=109)

69. 104.749 104.749 ↑ 1.0 1 109

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

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