explain.depesz.com

PostgreSQL's explain analyze made readable

Result: xbFk

Settings
# exclusive inclusive rows x rows loops node
1. 1.019 199.274 ↑ 2.3 110 1

Hash Left Join (cost=5,126.70..138,033.49 rows=256 width=598) (actual time=58.779..199.274 rows=110 loops=1)

  • Hash Cond: ((ec.id_prod_com = ec_1.id_prod_com) AND (tm.id_uf = fo.id_uf))
2. 0.127 67.876 ↑ 2.3 110 1

Hash Left Join (cost=4,999.70..5,743.07 rows=256 width=394) (actual time=57.492..67.876 rows=110 loops=1)

  • Hash Cond: (eq.id_tipo_estoque = tt.id_tipo_estoque)
  • Join Filter: (eq.id_tipo_estoque = 1)
3. 0.106 67.727 ↑ 2.3 110 1

Hash Left Join (cost=4,998.64..5,740.18 rows=256 width=376) (actual time=57.460..67.727 rows=110 loops=1)

  • Hash Cond: (ep.id_pes_for = fr.id_pes)
4. 0.082 67.331 ↑ 2.3 110 1

Hash Left Join (cost=4,961.09..5,701.96 rows=256 width=353) (actual time=57.163..67.331 rows=110 loops=1)

  • Hash Cond: (ep.id_pes_fab = ff.id_pes)
5. 0.088 66.988 ↑ 2.3 110 1

Hash Left Join (cost=4,923.54..5,663.74 rows=256 width=330) (actual time=56.897..66.988 rows=110 loops=1)

  • Hash Cond: (ep.id_pes_lab = fl.id_pes)
6. 0.115 66.602 ↑ 2.3 110 1

Hash Left Join (cost=4,885.99..5,625.52 rows=256 width=307) (actual time=56.594..66.602 rows=110 loops=1)

  • Hash Cond: (ep.id_tipo_prod = tp.id_tipo_prod)
7. 0.116 66.455 ↑ 2.3 110 1

Hash Join (cost=4,884.66..5,623.32 rows=256 width=307) (actual time=56.548..66.455 rows=110 loops=1)

  • Hash Cond: (ep.id_marca = em.id_marca)
8. 0.130 66.287 ↑ 2.3 110 1

Hash Join (cost=4,883.61..5,620.18 rows=256 width=307) (actual time=56.488..66.287 rows=110 loops=1)

  • Hash Cond: (ep.id_dpto_d = ed.id_dpto)
9. 0.335 66.121 ↑ 2.3 110 1

Hash Left Join (cost=4,882.21..5,617.94 rows=256 width=302) (actual time=56.445..66.121 rows=110 loops=1)

  • Hash Cond: (ep.id_ncm = tn.id_ncm)
10. 0.108 57.260 ↑ 2.3 110 1

Hash Join (cost=4,448.19..5,183.26 rows=256 width=298) (actual time=47.706..57.260 rows=110 loops=1)

  • Hash Cond: (ep.id_unid_v = un.id_unid)
11. 0.088 57.118 ↑ 2.3 110 1

Nested Loop (cost=4,446.70..5,180.96 rows=256 width=295) (actual time=47.665..57.118 rows=110 loops=1)

12. 0.004 0.037 ↑ 1.0 1 1

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

13. 0.018 0.018 ↑ 1.0 1 1

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

  • Filter: (id_emp = 1)
  • Rows Removed by Filter: 1
14. 0.015 0.015 ↑ 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.015..0.015 rows=1 loops=1)

  • Index Cond: (id_municipio = cg.id_municipio)
15. 2.829 56.993 ↑ 2.3 110 1

Hash Right Join (cost=4,446.41..5,169.07 rows=256 width=295) (actual time=47.626..56.993 rows=110 loops=1)

  • Hash Cond: ((pq.id_prod = eq.id_prod) AND (pq.id_tipo_estoque = eq.id_tipo_estoque))
16. 20.813 25.992 ↓ 1.0 26,340 1

HashAggregate (cost=762.56..1,025.34 rows=26,278 width=112) (actual time=19.345..25.992 rows=26,340 loops=1)

  • Group Key: pq.id_emp, pq.id_prod, pq.id_tipo_estoque
17. 5.179 5.179 ↑ 1.0 26,340 1

Seq Scan on eq_prod_qtde pq (cost=0.00..565.01 rows=26,340 width=12) (actual time=0.014..5.179 rows=26,340 loops=1)

  • Filter: (id_emp = 1)
  • Rows Removed by Filter: 61
18. 0.109 28.172 ↑ 2.3 110 1

Hash (cost=3,680.01..3,680.01 rows=256 width=299) (actual time=28.172..28.172 rows=110 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 29kB
19. 1.690 28.063 ↑ 2.3 110 1

Hash Right Join (cost=3,013.71..3,680.01 rows=256 width=299) (actual time=23.680..28.063 rows=110 loops=1)

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

Seq Scan on eq_prod_qtde eq (cost=0.00..565.01 rows=26,340 width=55) (actual time=0.030..2.787 rows=26,340 loops=1)

  • Filter: (id_emp = 1)
  • Rows Removed by Filter: 61
21. 0.166 23.586 ↑ 2.3 110 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 28kB
22. 2.125 23.420 ↑ 2.3 110 1

Hash Join (cost=1,128.37..3,010.51 rows=256 width=248) (actual time=13.294..23.420 rows=110 loops=1)

  • Hash Cond: (ec.id_prod = ep.id_prod)
23. 8.094 8.094 ↑ 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.015..8.094 rows=26,811 loops=1)

  • Filter: ((id_emp = 1) AND (id_tipo_situacao = 4))
  • Rows Removed by Filter: 26813
24. 0.142 13.201 ↑ 2.3 110 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 24kB
25. 13.059 13.059 ↑ 2.3 110 1

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

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

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
27. 0.016 0.016 ↑ 1.0 22 1

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

28. 5.006 8.526 ↑ 1.0 12,534 1

Hash (cost=277.34..277.34 rows=12,534 width=12) (actual time=8.526..8.526 rows=12,534 loops=1)

  • Buckets: 16384 Batches: 1 Memory Usage: 716kB
29. 3.520 3.520 ↑ 1.0 12,534 1

Seq Scan on tb_ncm tn (cost=0.00..277.34 rows=12,534 width=12) (actual time=0.034..3.520 rows=12,534 loops=1)

30. 0.017 0.036 ↑ 1.0 18 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
31. 0.019 0.019 ↑ 1.0 18 1

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

32. 0.015 0.052 ↑ 1.0 2 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
33. 0.037 0.037 ↑ 1.0 2 1

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

34. 0.013 0.032 ↑ 1.0 15 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
35. 0.019 0.019 ↑ 1.0 15 1

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

36. 0.136 0.298 ↑ 1.0 691 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 52kB
37. 0.162 0.162 ↑ 1.0 691 1

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

38. 0.125 0.261 ↑ 1.0 691 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 52kB
39. 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.009..0.136 rows=691 loops=1)

40. 0.143 0.290 ↑ 1.0 691 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 52kB
41. 0.147 0.147 ↑ 1.0 691 1

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

42. 0.011 0.022 ↑ 1.0 3 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
43. 0.011 0.011 ↑ 1.0 3 1

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

44. 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
45. 0.000 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)
46. 0.001 0.011 ↓ 0.0 0 1

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

  • Join Filter: (gd.id_grade_trib_aliq = fo.id_grade_trib_aliq)
47. 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)

48. 0.001 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)
49. 0.000 0.009 ↓ 0.0 0 1

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

  • Hash Cond: (el.id_simbologia = ga.id_simbologia)
50. 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)

51. 0.000 0.000 ↓ 0.0 0

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

52. 0.000 0.000 ↓ 0.0 0

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

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

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

56. 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)
57. 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)
58. 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)
59. 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
60. 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)
61. 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)
62.          

SubPlan (forHash Left Join)

63. 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)
64. 0.011 0.011 ↓ 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.011..0.011 rows=0 loops=1)

65. 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)
66. 0.007 0.007 ↓ 0.0 0 1

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

67. 0.110 2.200 ↑ 1.0 1 110

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

68. 1.189 2.090 ↓ 0.0 0 110

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

  • Join Filter: (od.id_promo = eo.id_promo)
  • Rows Removed by Join Filter: 0
69. 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
70. 0.021 0.021 ↑ 1.0 3 1

Seq Scan on eq_promo eo (cost=0.00..1.64 rows=3 width=4) (actual time=0.019..0.021 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
71. 0.880 128.150 ↑ 1.0 1 110

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

72. 127.270 127.270 ↑ 1.0 1 110

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

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