explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 0bqd

Settings
# exclusive inclusive rows x rows loops node
1. 0.811 170.921 ↑ 2.3 110 1

Hash Left Join (cost=4,999.70..137,904.57 rows=256 width=598) (actual time=52.369..170.921 rows=110 loops=1)

  • Hash Cond: (eq.id_tipo_estoque = tt.id_tipo_estoque)
  • Join Filter: (eq.id_tipo_estoque = 1)
2. 0.108 60.835 ↑ 2.3 110 1

Hash Left Join (cost=4,998.64..5,740.18 rows=256 width=368) (actual time=51.077..60.835 rows=110 loops=1)

  • Hash Cond: (ep.id_pes_for = fr.id_pes)
3. 0.092 60.275 ↑ 2.3 110 1

Hash Left Join (cost=4,961.09..5,701.96 rows=256 width=345) (actual time=50.598..60.275 rows=110 loops=1)

  • Hash Cond: (ep.id_pes_fab = ff.id_pes)
4. 0.084 59.800 ↑ 2.3 110 1

Hash Left Join (cost=4,923.54..5,663.74 rows=256 width=322) (actual time=50.194..59.800 rows=110 loops=1)

  • Hash Cond: (ep.id_pes_lab = fl.id_pes)
5. 0.105 59.120 ↑ 2.3 110 1

Hash Left Join (cost=4,885.99..5,625.52 rows=256 width=299) (actual time=49.577..59.120 rows=110 loops=1)

  • Hash Cond: (ep.id_tipo_prod = tp.id_tipo_prod)
6. 0.089 58.966 ↑ 2.3 110 1

Hash Join (cost=4,884.66..5,623.32 rows=256 width=299) (actual time=49.503..58.966 rows=110 loops=1)

  • Hash Cond: (ep.id_marca = em.id_marca)
7. 0.109 58.802 ↑ 2.3 110 1

Hash Join (cost=4,883.61..5,620.18 rows=256 width=299) (actual time=49.411..58.802 rows=110 loops=1)

  • Hash Cond: (ep.id_dpto_d = ed.id_dpto)
8. 0.339 58.649 ↑ 2.3 110 1

Hash Left Join (cost=4,882.21..5,617.94 rows=256 width=294) (actual time=49.345..58.649 rows=110 loops=1)

  • Hash Cond: (ep.id_ncm = tn.id_ncm)
9. 0.106 54.101 ↑ 2.3 110 1

Hash Join (cost=4,448.19..5,183.26 rows=256 width=290) (actual time=44.916..54.101 rows=110 loops=1)

  • Hash Cond: (ep.id_unid_v = un.id_unid)
10. 0.070 53.961 ↑ 2.3 110 1

Nested Loop (cost=4,446.70..5,180.96 rows=256 width=287) (actual time=44.867..53.961 rows=110 loops=1)

11. 0.008 0.058 ↑ 1.0 1 1

Nested Loop (cost=0.28..9.33 rows=1 width=4) (actual time=0.057..0.058 rows=1 loops=1)

12. 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
13. 0.032 0.032 ↑ 1.0 1 1

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

  • Index Cond: (id_municipio = cg.id_municipio)
  • Heap Fetches: 1
14. 2.850 53.833 ↑ 2.3 110 1

Hash Right Join (cost=4,446.41..5,169.07 rows=256 width=291) (actual time=44.807..53.833 rows=110 loops=1)

  • Hash Cond: ((pq.id_prod = eq.id_prod) AND (pq.id_tipo_estoque = eq.id_tipo_estoque))
15. 16.722 21.001 ↓ 1.0 26,340 1

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

  • Group Key: pq.id_emp, pq.id_prod, pq.id_tipo_estoque
16. 4.279 4.279 ↑ 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.035..4.279 rows=26,340 loops=1)

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

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

  • Buckets: 1024 Batches: 1 Memory Usage: 29kB
18. 2.472 29.852 ↑ 2.3 110 1

Hash Right Join (cost=3,013.71..3,680.01 rows=256 width=295) (actual time=23.595..29.852 rows=110 loops=1)

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

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

Hash (cost=3,010.51..3,010.51 rows=256 width=244) (actual time=23.493..23.494 rows=110 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 27kB
21. 1.825 23.385 ↑ 2.3 110 1

Hash Join (cost=1,128.37..3,010.51 rows=256 width=244) (actual time=13.971..23.385 rows=110 loops=1)

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

Seq Scan on eq_prod_com ec (cost=0.00..1,811.36 rows=26,962 width=24) (actual time=0.025..7.705 rows=26,811 loops=1)

  • Filter: ((id_emp = 1) AND (id_tipo_situacao = 4))
  • Rows Removed by Filter: 26813
23. 0.175 13.855 ↑ 2.3 110 1

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

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

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

  • Filter: (((descricaor)::text ~~ '%ARROZ%'::text) AND ((especial)::text = 'NAO'::text))
  • Rows Removed by Filter: 26702
25. 0.010 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
26. 0.024 0.024 ↑ 1.0 22 1

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

27. 2.338 4.209 ↑ 1.0 12,534 1

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

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

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

29. 0.020 0.044 ↑ 1.0 18 1

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

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

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

31. 0.016 0.075 ↑ 1.0 2 1

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

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

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

33. 0.018 0.049 ↑ 1.0 15 1

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

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

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

35. 0.200 0.596 ↑ 1.0 691 1

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

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

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

37. 0.165 0.383 ↑ 1.0 691 1

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

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

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

39. 0.222 0.452 ↑ 1.0 691 1

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

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

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

41. 0.011 0.028 ↑ 1.0 3 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
42. 0.017 0.017 ↑ 1.0 3 1

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

43.          

SubPlan (forHash Left Join)

44. 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)
45. 0.010 0.010 ↓ 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.010..0.010 rows=0 loops=1)

46. 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)
47. 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)

48. 0.220 2.310 ↑ 1.0 1 110

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

49. 1.190 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
50. 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
51. 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
52. 0.770 106.920 ↑ 1.0 1 110

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

53. 106.150 106.150 ↑ 1.0 1 110

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

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