explain.depesz.com

PostgreSQL's explain analyze made readable

Result: l4Ne

Settings
# exclusive inclusive rows x rows loops node
1. 0.605 158.962 ↑ 2.3 109 1

Hash Left Join (cost=4,056.43..135,562.66 rows=251 width=598) (actual time=40.547..158.962 rows=109 loops=1)

  • Hash Cond: ((ec.id_prod_com = ec_1.id_prod_com) AND (tm.id_uf = fo.id_uf))
2. 0.115 50.418 ↑ 2.3 109 1

Hash Left Join (cost=3,929.43..5,853.56 rows=251 width=394) (actual time=40.372..50.418 rows=109 loops=1)

  • Hash Cond: (eq.id_tipo_estoque = tt.id_tipo_estoque)
3. 0.163 50.282 ↑ 2.3 109 1

Hash Left Join (cost=3,928.38..5,849.06 rows=251 width=376) (actual time=40.301..50.282 rows=109 loops=1)

  • Hash Cond: (ep.id_pes_for = fr.id_pes)
4. 0.056 49.850 ↑ 2.3 109 1

Hash Left Join (cost=3,890.83..5,810.85 rows=251 width=353) (actual time=39.937..49.850 rows=109 loops=1)

  • Hash Cond: (ep.id_pes_fab = ff.id_pes)
5. 0.065 49.524 ↑ 2.3 109 1

Hash Left Join (cost=3,853.29..5,772.65 rows=251 width=330) (actual time=39.659..49.524 rows=109 loops=1)

  • Hash Cond: (ep.id_pes_lab = fl.id_pes)
6. 0.078 49.129 ↑ 2.3 109 1

Hash Left Join (cost=3,815.74..5,734.44 rows=251 width=307) (actual time=39.324..49.129 rows=109 loops=1)

  • Hash Cond: (ep.id_tipo_prod = tp.id_tipo_prod)
7. 0.081 49.014 ↑ 2.3 109 1

Hash Join (cost=3,814.40..5,732.25 rows=251 width=307) (actual time=39.272..49.014 rows=109 loops=1)

  • Hash Cond: (ep.id_marca = em.id_marca)
8. 0.077 48.900 ↑ 2.3 109 1

Hash Join (cost=3,813.36..5,729.15 rows=251 width=307) (actual time=39.232..48.900 rows=109 loops=1)

  • Hash Cond: (ep.id_dpto_d = ed.id_dpto)
9. 1.954 48.802 ↑ 2.3 109 1

Hash Join (cost=3,811.95..5,726.93 rows=251 width=302) (actual time=39.205..48.802 rows=109 loops=1)

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

  • Filter: ((id_tipo_situacao = 4) AND (id_emp = 1))
  • Rows Removed by Filter: 26813
11. 0.114 39.114 ↑ 2.3 109 1

Hash (cost=3,808.83..3,808.83 rows=250 width=290) (actual time=39.114..39.114 rows=109 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 28kB
12. 0.052 39.000 ↑ 2.3 109 1

Hash Join (cost=3,071.42..3,808.83 rows=250 width=290) (actual time=32.055..39.000 rows=109 loops=1)

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

Nested Loop (cost=3,069.93..3,806.55 rows=250 width=287) (actual time=32.032..38.930 rows=109 loops=1)

14. 0.004 0.033 ↑ 1.0 1 1

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

15. 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.009..0.011 rows=1 loops=1)

  • Filter: (id_emp = 1)
  • Rows Removed by Filter: 1
16. 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)
17. 2.078 38.872 ↑ 2.3 109 1

Hash Right Join (cost=3,069.64..3,794.72 rows=250 width=279) (actual time=31.998..38.872 rows=109 loops=1)

  • Hash Cond: ((pq.id_tipo_estoque = eq.id_tipo_estoque) AND (pq.id_prod = eq.id_prod))
18. 13.348 17.633 ↓ 1.0 26,338 1

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

  • Group Key: pq.id_emp, pq.id_prod, pq.id_tipo_estoque
19. 4.285 4.285 ↑ 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.018..4.285 rows=26,338 loops=1)

  • Filter: ((id_emp = 1) AND (id_tipo_estoque = 1))
  • Rows Removed by Filter: 63
20. 0.073 19.161 ↑ 2.3 109 1

Hash (cost=2,237.34..2,237.34 rows=250 width=279) (actual time=19.161..19.161 rows=109 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 27kB
21. 0.760 19.088 ↑ 2.3 109 1

Merge Right Join (cost=1,838.77..2,237.34 rows=250 width=279) (actual time=16.182..19.088 rows=109 loops=1)

  • Merge Cond: (tn.id_ncm = ep.id_ncm)
22. 2.146 2.146 ↑ 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.006..2.146 rows=9,439 loops=1)

23. 0.163 16.182 ↑ 2.3 109 1

Sort (cost=1,838.49..1,839.11 rows=250 width=275) (actual time=16.170..16.182 rows=109 loops=1)

  • Sort Key: ep.id_ncm
  • Sort Method: quicksort Memory: 51kB
24. 2.161 16.019 ↑ 2.3 109 1

Hash Join (cost=1,128.37..1,828.53 rows=250 width=275) (actual time=9.241..16.019 rows=109 loops=1)

  • Hash Cond: (eq.id_prod = ep.id_prod)
25. 4.732 4.732 ↑ 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.012..4.732 rows=26,338 loops=1)

  • Filter: ((id_tipo_estoque = 1) AND (id_emp = 1))
  • Rows Removed by Filter: 63
26. 0.090 9.126 ↑ 2.3 110 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 24kB
27. 9.036 9.036 ↑ 2.3 110 1

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

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

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
29. 0.011 0.011 ↑ 1.0 22 1

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

30. 0.007 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
31. 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.010..0.014 rows=18 loops=1)

32. 0.004 0.033 ↑ 1.0 2 1

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

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

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

34. 0.010 0.037 ↑ 1.0 15 1

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

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

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

36. 0.155 0.330 ↑ 1.0 691 1

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

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

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

38. 0.137 0.270 ↑ 1.0 691 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 52kB
39. 0.133 0.133 ↑ 1.0 691 1

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

40. 0.139 0.269 ↑ 1.0 691 1

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

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

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

42. 0.010 0.021 ↑ 1.0 1 1

Hash (cost=1.04..1.04 rows=1 width=22) (actual time=0.021..0.021 rows=1 loops=1)

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

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

  • Filter: (id_tipo_estoque = 1)
  • Rows Removed by Filter: 2
44. 0.000 0.014 ↓ 0.0 0 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
45. 0.001 0.014 ↓ 0.0 0 1

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

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

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

  • Join Filter: (gd.id_grade_trib_aliq = fo.id_grade_trib_aliq)
47. 0.001 0.013 ↓ 0.0 0 1

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

48. 0.000 0.012 ↓ 0.0 0 1

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

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

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

  • Hash Cond: (el.id_simbologia = ga.id_simbologia)
50. 0.012 0.012 ↓ 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.012..0.012 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.008 0.008 ↓ 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.008 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.109 1.962 ↑ 1.0 1 109

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

68. 1.058 1.853 ↓ 0.0 0 109

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

  • Join Filter: (od.id_promo = eo.id_promo)
  • Rows Removed by Join Filter: 0
69. 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.006..0.007 rows=0 loops=109)

  • Filter: (id_prod = ep.id_prod)
  • Rows Removed by Filter: 76
70. 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
71. 0.763 105.948 ↑ 1.0 1 109

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

72. 105.185 105.185 ↑ 1.0 1 109

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

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