explain.depesz.com

A tool for finding a real cause for slow queries.

Result: DNJ

options
Did it help? Consider supporting us - Bitcoin address: 12v2hUztAk2LgzQ9H9LMwuU32urHMjZQnq
# exclusive inclusive rows x rows loops node
1. 2.327 4,118.704 ↑ 6.3 855 1

Sort (cost=19,425,518.82..19,425,532.34 rows=5,410 width=45) (actual time=4,118.128..4,118.704 rows=855 loops=1)

  • Sort Key: grupoproduto.cdgrupoproduto, produto.cdproduto
  • Sort Method: quicksort Memory: 136kB
  • Buffers: shared hit=1842666
2. 42.140 4,116.377 ↑ 6.3 855 1

HashAggregate (cost=45,382.95..19,425,183.36 rows=5,410 width=45) (actual time=949.502..4,116.377 rows=855 loops=1)

  • Buffers: shared hit=1842666
3. 39.251 911.592 ↑ 1.0 24,914 1

Hash Join (cost=12,362.50..45,065.27 rows=25,415 width=45) (actual time=571.162..911.592 rows=24,914 loops=1)

  • Hash Cond: (dah.lancamento.cdproduto = produto.cdproduto)
  • Buffers: shared hit=21325
4. 375.691 860.304 ↑ 1.0 24,914 1

Hash Join (cost=12,208.80..44,498.58 rows=25,415 width=16) (actual time=559.112..860.304 rows=24,914 loops=1)

  • Hash Cond: (dah.lancamento.cdlanccaixa = dah.lanccaixa.cdlanccaixa)
  • Buffers: shared hit=21268
5. 436.386 436.386 ↓ 1.0 411,158 1

Seq Scan on lancamento (cost=0.00..26,905.56 rows=410,405 width=20) (actual time=0.005..436.386 rows=411,158 loops=1)

  • Filter: ((cdempresa = 1) AND (flestornado = 0))
  • Buffers: shared hit=20474
6. 18.401 48.227 ↑ 1.0 15,966 1

Hash (cost=12,007.15..12,007.15 rows=16,132 width=8) (actual time=48.227..48.227 rows=15,966 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 624kB
  • Buffers: shared hit=794
7. 26.620 29.826 ↑ 1.0 15,966 1

Bitmap Heap Scan on lanccaixa (cost=493.65..12,007.15 rows=16,132 width=8) (actual time=3.364..29.826 rows=15,966 loops=1)

  • Recheck Cond: ((dhlanccaixa >= '2011-10-01 00:00:00'::timestamp without time zone) AND (dhlanccaixa <= '2011-11-01 00:00:00'::timestamp without time zone) AND (flcancelado = 0))
  • Filter: (cdempresa = 1)
  • Buffers: shared hit=794
8. 3.206 3.206 ↑ 1.0 15,966 1

Bitmap Index Scan on ixlanccxadhcanc (cost=0.00..489.62 rows=16,132 width=0) (actual time=3.206..3.206 rows=15,966 loops=1)

  • Index Cond: ((dhlanccaixa >= '2011-10-01 00:00:00'::timestamp without time zone) AND (dhlanccaixa <= '2011-11-01 00:00:00'::timestamp without time zone) AND (flcancelado = 0))
  • Buffers: shared hit=68
9. 4.186 12.037 ↑ 1.0 2,647 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 175kB
  • Buffers: shared hit=57
10. 5.403 7.851 ↑ 1.0 2,647 1

Hash Left Join (cost=1.74..120.61 rows=2,647 width=33) (actual time=0.093..7.851 rows=2,647 loops=1)

  • Hash Cond: (produto.cdgrupoproduto = grupoproduto.cdgrupoproduto)
  • Buffers: shared hit=57
11. 2.376 2.376 ↑ 1.0 2,647 1

Seq Scan on produto (cost=0.00..82.47 rows=2,647 width=33) (actual time=0.007..2.376 rows=2,647 loops=1)

  • Buffers: shared hit=56
12. 0.037 0.072 ↑ 1.0 33 1

Hash (cost=1.33..1.33 rows=33 width=4) (actual time=0.072..0.072 rows=33 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 2kB
  • Buffers: shared hit=1
13. 0.035 0.035 ↑ 1.0 33 1

Seq Scan on grupoproduto (cost=0.00..1.33 rows=33 width=4) (actual time=0.004..0.035 rows=33 loops=1)

  • Buffers: shared hit=1
14.          

SubPlan (forHashAggregate)

15. 23.085 3,162.645 ↑ 1.0 1 855

Aggregate (cost=3,582.20..3,582.21 rows=1 width=8) (actual time=3.699..3.699 rows=1 loops=855)

  • Buffers: shared hit=1821341
16. 35.910 3,139.560 ↓ 1.3 26 855

Nested Loop (cost=0.00..3,582.15 rows=20 width=8) (actual time=2.927..3.672 rows=26 loops=855)

  • Buffers: shared hit=1821341
17. 4.275 4.275 ↑ 1.0 1 855

Index Scan using pkproduto on produto prod (cost=0.00..8.27 rows=1 width=8) (actual time=0.004..0.005 rows=1 loops=855)

  • Index Cond: (cdproduto = produto.cdproduto)
  • Buffers: shared hit=2569
18. 1,348.521 3,099.375 ↓ 1.3 26 855

Nested Loop (cost=0.00..3,573.68 rows=20 width=12) (actual time=2.918..3.625 rows=26 loops=855)

  • Join Filter: (dah.lanccaixa.cdempresa = dah.lancamento.cdempresa)
  • Buffers: shared hit=1818772
19. 566.865 566.865 ↓ 1.2 462 855

Index Scan using ixlancamentoflecdpla on lancamento (cost=0.00..798.81 rows=373 width=20) (actual time=0.007..0.663 rows=462 loops=855)

  • Index Cond: ((flestornado = 0) AND (cdproduto = produto.cdproduto))
  • Buffers: shared hit=237818
20. 1,183.989 1,183.989 ↓ 0.0 0 394,663

Index Scan using pklanccaixa on lanccaixa (cost=0.00..7.42 rows=1 width=8) (actual time=0.003..0.003 rows=0 loops=394,663)

  • Index Cond: (cdlanccaixa = dah.lancamento.cdlanccaixa)
  • Filter: ((dhlanccaixa >= '2012-01-01 00:00:00'::timestamp without time zone) AND (dhlanccaixa <= '2012-02-01 00:00:00'::timestamp without time zone) AND (flcancelado = 0))
  • Buffers: shared hit=1580954