explain.depesz.com

PostgreSQL's explain analyze made readable

Result: vwk3

Settings
# exclusive inclusive rows x rows loops node
1. 0.896 158.393 ↑ 2.3 110 1

Nested Loop Left Join (cost=3,929.97..137,113.84 rows=256 width=698) (actual time=39.481..158.393 rows=110 loops=1)

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

Hash Join (cost=3,567.00..4,254.02 rows=256 width=411) (actual time=39.252..45.608 rows=110 loops=1)

  • Hash Cond: (ep.id_unid_v = un.id_unid)
3. 0.123 45.460 ↑ 2.3 110 1

Hash Left Join (cost=3,565.51..4,251.71 rows=256 width=408) (actual time=39.203..45.460 rows=110 loops=1)

  • Hash Cond: (eq.id_tipo_estoque = tt.id_tipo_estoque)
  • Join Filter: (eq.id_tipo_estoque = 1)
4. 0.252 45.301 ↑ 2.3 110 1

Hash Left Join (cost=3,564.44..4,248.82 rows=256 width=390) (actual time=39.149..45.301 rows=110 loops=1)

  • Hash Cond: (ep.id_ncm = tn.id_ncm)
5. 0.150 31.661 ↑ 2.3 110 1

Hash Left Join (cost=3,130.43..3,814.13 rows=256 width=386) (actual time=25.611..31.661 rows=110 loops=1)

  • Hash Cond: (ep.id_pes_for = fr.id_pes)
6. 0.061 30.892 ↑ 2.3 110 1

Nested Loop (cost=3,092.88..3,775.91 rows=256 width=363) (actual time=24.978..30.892 rows=110 loops=1)

7. 0.002 0.022 ↑ 1.0 1 1

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

8. 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
9. 0.009 0.009 ↑ 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.009..0.009 rows=1 loops=1)

  • Index Cond: (id_municipio = cg.id_municipio)
10. 0.079 30.809 ↑ 2.3 110 1

Hash Left Join (cost=3,092.60..3,764.02 rows=256 width=363) (actual time=24.954..30.809 rows=110 loops=1)

  • Hash Cond: (ep.id_pes_fab = ff.id_pes)
11. 0.092 30.206 ↑ 2.3 110 1

Hash Left Join (cost=3,055.05..3,725.80 rows=256 width=340) (actual time=24.414..30.206 rows=110 loops=1)

  • Hash Cond: (ep.id_pes_lab = fl.id_pes)
12. 0.098 29.364 ↑ 2.3 110 1

Hash Left Join (cost=3,017.50..3,687.58 rows=256 width=317) (actual time=23.647..29.364 rows=110 loops=1)

  • Hash Cond: (ep.id_tipo_prod = tp.id_tipo_prod)
13. 0.093 29.142 ↑ 2.3 110 1

Hash Join (cost=3,016.16..3,685.39 rows=256 width=317) (actual time=23.505..29.142 rows=110 loops=1)

  • Hash Cond: (ep.id_marca = em.id_marca)
14. 0.111 29.035 ↑ 2.3 110 1

Hash Join (cost=3,015.12..3,682.24 rows=256 width=317) (actual time=23.485..29.035 rows=110 loops=1)

  • Hash Cond: (ep.id_dpto_d = ed.id_dpto)
15. 2.366 28.894 ↑ 2.3 110 1

Hash Right Join (cost=3,013.71..3,680.01 rows=256 width=312) (actual time=23.446..28.894 rows=110 loops=1)

  • Hash Cond: (eq.id_prod = ec.id_prod)
16. 3.356 3.356 ↑ 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.045..3.356 rows=26,340 loops=1)

  • Filter: (id_emp = 1)
  • Rows Removed by Filter: 61
17. 0.083 23.172 ↑ 2.3 110 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 29kB
18. 1.788 23.089 ↑ 2.3 110 1

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

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

  • Filter: ((id_emp = 1) AND (id_tipo_situacao = 4))
  • Rows Removed by Filter: 26813
20. 0.141 12.275 ↑ 2.3 110 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 24kB
21. 12.134 12.134 ↑ 2.3 110 1

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

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

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
23. 0.012 0.012 ↑ 1.0 18 1

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

24. 0.004 0.014 ↑ 1.0 2 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
25. 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.009..0.010 rows=2 loops=1)

26. 0.014 0.124 ↑ 1.0 15 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
27. 0.110 0.110 ↑ 1.0 15 1

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

28. 0.280 0.750 ↑ 1.0 691 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 52kB
29. 0.470 0.470 ↑ 1.0 691 1

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

30. 0.236 0.524 ↑ 1.0 691 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 52kB
31. 0.288 0.288 ↑ 1.0 691 1

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

32. 0.276 0.619 ↑ 1.0 691 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 52kB
33. 0.343 0.343 ↑ 1.0 691 1

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

34. 2.895 13.388 ↑ 1.0 12,534 1

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

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

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

36. 0.011 0.036 ↑ 1.0 3 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
37. 0.025 0.025 ↑ 1.0 3 1

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

38. 0.011 0.043 ↑ 1.0 22 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
39. 0.032 0.032 ↑ 1.0 22 1

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

40. 0.066 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)

41. 0.001 0.044 ↓ 0.0 0 1

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

42. 0.004 0.043 ↓ 0.0 0 1

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

  • Hash Cond: (fd.id_grade_trib_aliq = gd.id_grade_trib_aliq)
43. 0.014 0.014 ↑ 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.014..0.014 rows=1 loops=1)

  • Filter: (id_uf = 26)
44. 0.001 0.025 ↓ 0.0 0 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
45. 0.003 0.024 ↓ 0.0 0 1

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

  • Hash Cond: (fo.id_grade_trib_aliq = gd.id_grade_trib_aliq)
46. 0.012 0.012 ↑ 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.012..0.012 rows=1 loops=1)

47. 0.001 0.009 ↓ 0.0 0 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
48. 0.000 0.008 ↓ 0.0 0 1

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

  • Join Filter: (ga.id_grade_trib = ec_1.id_grade_trib)
49. 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)
50. 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)

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.          

SubPlan (forNested Loop Left Join)

61. 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)
62. 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)

63. 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)
64. 0.008 0.008 ↓ 0.0 0 1

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

65. 0.220 2.200 ↑ 1.0 1 110

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

66. 1.190 1.980 ↓ 0.0 0 110

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

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

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=110)

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

Seq Scan on eq_promo eo (cost=0.00..1.64 rows=3 width=4) (actual time=0.018..0.020 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
69. 0.770 109.560 ↑ 1.0 1 110

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

70. 108.790 108.790 ↑ 1.0 1 110

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

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