explain.depesz.com

A tool for finding a real cause for slow queries.

Result: 4Pe

options
Did it help? Consider supporting us - Bitcoin address: 12v2hUztAk2LgzQ9H9LMwuU32urHMjZQnq
# exclusive inclusive rows x rows loops node
1. 6997.615 76658.974 ↓ 149.3 278583 1

Sort (cost=194030.66..194035.33 rows=1866 width=351) (actual time=74029.176..76658.974 rows=278583 loops=1)

  • Sort Key: grupoproduto.cdgrupoproduto, produto.cdproduto
  • Sort Method: external merge Disk: 32160kB
2. 10704.524 69661.359 ↓ 149.3 278583 1

Nested Loop Left Join (cost=116.30..193929.28 rows=1866 width=351) (actual time=176.020..69661.359 rows=278583 loops=1)

3. 4719.080 43008.097 ↓ 149.3 278583 1

Hash Join (cost=116.30..39096.83 rows=1866 width=347) (actual time=175.875..43008.097 rows=278583 loops=1)

  • Hash Cond: (produto.cdgrupoproduto = grupoproduto.cdgrupoproduto)
4. 4941.644 38287.876 ↓ 149.3 278583 1

Hash Join (cost=114.56..39069.43 rows=1866 width=129) (actual time=174.677..38287.876 rows=278583 loops=1)

  • Hash Cond: (lancamento.cdproduto = produto.cdproduto)
5. 9431.025 33283.259 ↓ 149.3 278583 1

Nested Loop (cost=0.00..38924.55 rows=1866 width=96) (actual time=111.645..33283.259 rows=278583 loops=1)

6. 7838.755 16120.244 ↓ 147.3 286370 1

Nested Loop (cost=0.00..26575.40 rows=1944 width=68) (actual time=111.570..16120.244 rows=286370 loops=1)

7. 2192.819 2192.819 ↓ 147.3 173962 1

Seq Scan on lanccaixa (cost=0.00..17796.89 rows=1181 width=16) (actual time=111.476..2192.819 rows=173962 loops=1)

  • Filter: ((cdempresa = 1) AND (cdoperacaocaixa = 1) AND (flcancelado = 0) AND (date(dhlanccaixa) >= '2011-05-01'::date) AND (date(dhlanccaixa) < '2012-04-22'::date))
8. 6088.670 6088.670 ↑ 1.5 2 173962

Index Scan using ixlctocdlanccaixa on lancamento (cost=0.00..7.40 rows=3 width=64) (actual time=0.019..0.035 rows=2 loops=173962)

  • Index Cond: (cdlanccaixa = lanccaixa.cdlanccaixa)
  • Filter: (cdempresa = 1)
9. 7731.990 7731.990 ↑ 1.0 1 286370

Index Scan using pkdocfiscalitem on docfiscalitem (cost=0.00..6.34 rows=1 width=40) (actual time=0.018..0.027 rows=1 loops=286370)

  • Index Cond: (cddocfiscalitem = lancamento.cddocfiscalitem)
  • Filter: (cdempresa = 1)
10. 32.613 62.973 ↑ 1.0 2647 1

Hash (cost=81.47..81.47 rows=2647 width=33) (actual time=62.973..62.973 rows=2647 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 175kB
11. 30.360 30.360 ↑ 1.0 2647 1

Seq Scan on produto (cost=0.00..81.47 rows=2647 width=33) (actual time=0.016..30.360 rows=2647 loops=1)

12. 0.416 1.141 ↑ 1.0 33 1

Hash (cost=1.33..1.33 rows=33 width=222) (actual time=1.141..1.141 rows=33 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 2kB
13. 0.725 0.725 ↑ 1.0 33 1

Seq Scan on grupoproduto (cost=0.00..1.33 rows=33 width=222) (actual time=0.457..0.725 rows=33 loops=1)

14. 8357.490 8357.490 ↑ 1.0 1 278583

Index Scan using ixcustocdempdtcdp on custo (cost=0.00..7.21 rows=1 width=24) (actual time=0.021..0.030 rows=1 loops=278583)

  • Index Cond: ((date(lanccaixa.dhlanccaixa) = dtcusto) AND (lancamento.cdproduto = cdproduto) AND (cdempresa = 1) AND (cdempresa = lancamento.cdempresa))
15.          

SubPlan (forNested Loop Left Join)

16. 783.224 7591.248 ↑ 1.0 1 30124

Aggregate (cost=75.71..75.72 rows=1 width=16) (actual time=0.245..0.252 rows=1 loops=30124)

17. 2999.498 6808.024 ↓ 0.0 0 30124

Nested Loop (cost=0.00..75.68 rows=7 width=16) (actual time=0.226..0.226 rows=0 loops=30124)

18. 1837.564 1837.564 ↑ 1.6 5 30124

Index Scan using ixlanccomposicaocdl on lanccomposicao (cost=0.00..8.41 rows=8 width=12) (actual time=0.018..0.061 rows=5 loops=30124)

  • Index Cond: (cdlancamento = lancamento.cdlancamento)
19. 1970.962 1970.962 ↓ 0.0 0 140783

Index Scan using ixcustocdempdtcdp on custo (cost=0.00..8.40 rows=1 width=12) (actual time=0.014..0.014 rows=0 loops=140783)

  • Index Cond: ((dtcusto = lanccaixa.dhlanccaixa) AND (cdproduto = lanccomposicao.cdproduto) AND (cdempresa = lancamento.cdempresa))