explain.depesz.com

A tool for finding a real cause for slow queries.

Result: raK

options
Did it help? Consider supporting us - Bitcoin address: 12v2hUztAk2LgzQ9H9LMwuU32urHMjZQnq
# exclusive inclusive rows x rows loops node
1. 11,997.638 83,369.948 ↓ 143.6 267,868 1

Nested Loop Left Join (cost=116.30..193,897.70 rows=1,865 width=351) (actual time=162.641..83,369.948 rows=267,868 loops=1)

2. 5,330.901 48,389.062 ↓ 143.6 267,868 1

Hash Join (cost=116.30..39,104.80 rows=1,865 width=347) (actual time=162.549..48,389.062 rows=267,868 loops=1)

  • Hash Cond: (produto.cdgrupoproduto = grupoproduto.cdgrupoproduto)
3. 5,505.025 43,057.485 ↓ 143.6 267,868 1

Hash Join (cost=114.56..39,077.42 rows=1,865 width=129) (actual time=161.779..43,057.485 rows=267,868 loops=1)

  • Hash Cond: (lancamento.cdproduto = produto.cdproduto)
4. 10,575.619 37,486.179 ↓ 143.6 267,868 1

Nested Loop (cost=0.00..38,932.55 rows=1,865 width=96) (actual time=95.415..37,486.179 rows=267,868 loops=1)

5. 9,001.453 18,096.864 ↓ 141.6 275,428 1

Nested Loop (cost=0.00..26,579.45 rows=1,945 width=68) (actual time=95.360..18,096.864 rows=275,428 loops=1)

6. 2,413.571 2,413.571 ↓ 141.3 167,046 1

Seq Scan on lanccaixa (cost=0.00..17,796.89 rows=1,182 width=16) (actual time=95.288..2,413.571 rows=167,046 loops=1)

  • Filter: ((cdempresa = 1) AND (cdoperacaocaixa = 1) AND (flcancelado = 0) AND (date(dhlanccaixa) >= '2011-05-01'::date) AND (date(dhlanccaixa) < '2012-03-21'::date))
7. 6,681.840 6,681.840 ↑ 1.5 2 167,046

Index Scan using ixlctocdlanccaixa on lancamento (cost=0.00..7.39 rows=3 width=64) (actual time=0.021..0.040 rows=2 loops=167,046)

  • Index Cond: (cdlanccaixa = lanccaixa.cdlanccaixa)
  • Filter: (cdempresa = 1)
8. 8,813.696 8,813.696 ↑ 1.0 1 275,428

Index Scan using pkdocfiscalitem on docfiscalitem (cost=0.00..6.34 rows=1 width=40) (actual time=0.021..0.032 rows=1 loops=275,428)

  • Index Cond: (cddocfiscalitem = lancamento.cddocfiscalitem)
  • Filter: (cdempresa = 1)
9. 34.936 66.281 ↑ 1.0 2,647 1

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

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

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

11. 0.337 0.676 ↑ 1.0 33 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 2kB
12. 0.339 0.339 ↑ 1.0 33 1

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

13. 9,643.248 9,643.248 ↑ 1.0 1 267,868

Index Scan using ixcustocdempdtcdp on custo (cost=0.00..7.21 rows=1 width=24) (actual time=0.025..0.036 rows=1 loops=267,868)

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

SubPlan (forNested Loop Left Join)

15. 1,972.000 13,340.000 ↑ 1.0 1 29,000

Aggregate (cost=75.74..75.75 rows=1 width=16) (actual time=0.451..0.460 rows=1 loops=29,000)

16. 5,377.035 11,368.000 ↑ 2.3 3 29,000

Nested Loop (cost=0.00..75.71 rows=7 width=16) (actual time=0.080..0.392 rows=3 loops=29,000)

17. 2,059.000 2,059.000 ↑ 1.6 5 29,000

Index Scan using ixlanccomposicaocdl on lanccomposicao (cost=0.00..8.41 rows=8 width=12) (actual time=0.019..0.071 rows=5 loops=29,000)

  • Index Cond: (cdlancamento = lancamento.cdlancamento)
18. 3,931.965 3,931.965 ↑ 1.0 1 135,585

Index Scan using ixcustocdempdtcdp on custo (cost=0.00..8.40 rows=1 width=12) (actual time=0.021..0.029 rows=1 loops=135,585)

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