explain.depesz.com

A tool for finding a real cause for slow queries.

Result: Uap1

options
Did it help? Consider supporting us - Bitcoin address: 12v2hUztAk2LgzQ9H9LMwuU32urHMjZQnq
# exclusive inclusive rows x rows loops node
1. 6,717.266 84,642.319 ↓ 149.3 278,583 1

Sort (cost=194,105.30..194,109.97 rows=1,866 width=351) (actual time=82,336.801..84,642.319 rows=278,583 loops=1)

  • Sort Key: grupoproduto.cdgrupoproduto, produto.cdproduto
  • Sort Method: external merge Disk: 32160kB
2. 11,199.179 77,925.053 ↓ 149.3 278,583 1

Nested Loop Left Join (cost=116.30..194,003.92 rows=1,866 width=351) (actual time=161.980..77,925.053 rows=278,583 loops=1)

3. 5,018.420 45,400.130 ↓ 149.3 278,583 1

Hash Join (cost=116.30..39,096.83 rows=1,866 width=347) (actual time=161.867..45,400.130 rows=278,583 loops=1)

  • Hash Cond: (produto.cdgrupoproduto = grupoproduto.cdgrupoproduto)
4. 5,257.884 40,380.722 ↓ 149.3 278,583 1

Hash Join (cost=114.56..39,069.43 rows=1,866 width=129) (actual time=160.820..40,380.722 rows=278,583 loops=1)

  • Hash Cond: (lancamento.cdproduto = produto.cdproduto)
5. 9,792.404 35,058.302 ↓ 149.3 278,583 1

Nested Loop (cost=0.00..38,924.55 rows=1,866 width=96) (actual time=96.189..35,058.302 rows=278,583 loops=1)

6. 8,263.318 16,961.168 ↓ 147.3 286,370 1

Nested Loop (cost=0.00..26,575.40 rows=1,944 width=68) (actual time=95.982..16,961.168 rows=286,370 loops=1)

7. 2,261.256 2,261.256 ↓ 147.3 173,962 1

Seq Scan on lanccaixa (cost=0.00..17,796.89 rows=1,181 width=16) (actual time=95.813..2,261.256 rows=173,962 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. 6,436.594 6,436.594 ↑ 1.5 2 173,962

Index Scan using ixlctocdlanccaixa on lancamento (cost=0.00..7.40 rows=3 width=64) (actual time=0.020..0.037 rows=2 loops=173,962)

  • Index Cond: (cdlanccaixa = lanccaixa.cdlanccaixa)
  • Filter: (cdempresa = 1)
9. 8,304.730 8,304.730 ↑ 1.0 1 286,370

Index Scan using pkdocfiscalitem on docfiscalitem (cost=0.00..6.34 rows=1 width=40) (actual time=0.019..0.029 rows=1 loops=286,370)

  • Index Cond: (cddocfiscalitem = lancamento.cddocfiscalitem)
  • Filter: (cdempresa = 1)
10. 32.646 64.536 ↑ 1.0 2,647 1

Hash (cost=81.47..81.47 rows=2,647 width=33) (actual time=64.536..64.536 rows=2,647 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 175kB
11. 31.890 31.890 ↑ 1.0 2,647 1

Seq Scan on produto (cost=0.00..81.47 rows=2,647 width=33) (actual time=0.019..31.890 rows=2,647 loops=1)

12. 0.380 0.988 ↑ 1.0 33 1

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

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

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

14. 8,914.656 8,914.656 ↑ 1.0 1 278,583

Index Scan using ixcustocdempdtcdp on custo (cost=0.00..7.21 rows=1 width=24) (actual time=0.022..0.032 rows=1 loops=278,583)

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

SubPlan (forNested Loop Left Join)

16. 1,807.440 12,411.088 ↑ 1.0 1 30,124

Aggregate (cost=75.75..75.76 rows=1 width=16) (actual time=0.404..0.412 rows=1 loops=30,124)

17. 4,985.230 10,603.648 ↑ 2.3 3 30,124

Nested Loop (cost=0.00..75.72 rows=7 width=16) (actual time=0.077..0.352 rows=3 loops=30,124)

18. 1,958.060 1,958.060 ↑ 1.6 5 30,124

Index Scan using ixlanccomposicaocdl on lanccomposicao (cost=0.00..8.41 rows=8 width=12) (actual time=0.018..0.065 rows=5 loops=30,124)

  • Index Cond: (cdlancamento = lancamento.cdlancamento)
19. 3,660.358 3,660.358 ↑ 1.0 1 140,783

Index Scan using ixcustocdempdtcdp on custo (cost=0.00..8.40 rows=1 width=12) (actual time=0.019..0.026 rows=1 loops=140,783)

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