explain.depesz.com

PostgreSQL's explain analyze made readable

Result: xUur : Optimization for: plan #39Q

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 198.311 1,642.122 ↑ 1.0 205,639 1

WindowAgg (cost=177,830.57..186,056.13 rows=205,639 width=484) (actual time=1,435.791..1,642.122 rows=205,639 loops=1)

2.          

CTE contas

3. 71.277 795.694 ↑ 1.0 205,639 1

Hash Left Join (cost=25,184.38..43,339.23 rows=205,639 width=329) (actual time=307.821..795.694 rows=205,639 loops=1)

  • Hash Cond: (cr.gruposcontas_codigo = grct.codigo)
4. 58.352 724.402 ↑ 1.0 205,639 1

Hash Left Join (cost=25,164.48..42,548.18 rows=205,639 width=211) (actual time=307.799..724.402 rows=205,639 loops=1)

  • Hash Cond: (cr_sit.situacoesconta_codigo = sc.codigo)
5. 87.382 666.037 ↑ 1.0 205,639 1

Hash Left Join (cost=25,163.35..39,719.51 rows=205,639 width=89) (actual time=307.775..666.037 rows=205,639 loops=1)

  • Hash Cond: (cr.codigo = cr_sit.contasareceber_codigo)
6. 72.482 510.117 ↑ 1.0 205,639 1

Hash Left Join (cost=19,625.47..31,354.09 rows=205,639 width=85) (actual time=237.689..510.117 rows=205,639 loops=1)

  • Hash Cond: (cr.codigo = crav.contasareceber_codigo)
7. 77.835 373.480 ↑ 1.0 205,639 1

Hash Left Join (cost=14,671.16..23,853.38 rows=205,639 width=77) (actual time=172.468..373.480 rows=205,639 loops=1)

  • Hash Cond: (cr.codigo = cr_fat.contasareceber_codigo)
8. 57.750 223.446 ↑ 1.0 205,639 1

Hash Left Join (cost=8,938.66..15,295.74 rows=205,639 width=73) (actual time=98.896..223.446 rows=205,639 loops=1)

  • Hash Cond: (cr.codigo = pvpg_cr.contasareceber_codigo)
9. 46.919 71.927 ↑ 1.0 205,639 1

Hash Left Join (cost=694.78..6,000.08 rows=205,639 width=61) (actual time=4.985..71.927 rows=205,639 loops=1)

  • Hash Cond: (cr.codigo = snfpg_cr.contasareceber_codigo)
10. 20.039 20.039 ↑ 1.0 205,639 1

Seq Scan on contasareceber cr (cost=0.00..4,532.39 rows=205,639 width=53) (actual time=0.007..20.039 rows=205,639 loops=1)

11. 0.046 4.969 ↑ 1.0 176 1

Hash (cost=692.58..692.58 rows=176 width=12) (actual time=4.969..4.969 rows=176 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 16kB
12. 0.109 4.923 ↑ 1.0 176 1

Nested Loop Left Join (cost=5.25..692.58 rows=176 width=12) (actual time=3.083..4.923 rows=176 loops=1)

13. 1.556 4.110 ↑ 1.0 176 1

Hash Right Join (cost=4.96..605.16 rows=176 width=8) (actual time=3.069..4.110 rows=176 loops=1)

  • Hash Cond: (snfpg.codigo = snfpg_cr.saidasnf_pagtos_codigo)
14. 2.512 2.512 ↑ 1.0 22,122 1

Seq Scan on saidasnf_pagto snfpg (cost=0.00..377.22 rows=22,122 width=8) (actual time=0.036..2.512 rows=22,122 loops=1)

15. 0.022 0.042 ↑ 1.0 176 1

Hash (cost=2.76..2.76 rows=176 width=8) (actual time=0.042..0.042 rows=176 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 15kB
16. 0.020 0.020 ↑ 1.0 176 1

Seq Scan on saidasnf_pagtos_contasareceber snfpg_cr (cost=0.00..2.76 rows=176 width=8) (actual time=0.005..0.020 rows=176 loops=1)

17. 0.704 0.704 ↑ 1.0 1 176

Index Scan using saidasnf_codigo_index on saidasnf snf (cost=0.29..0.49 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=176)

  • Index Cond: (snfpg.codsaidasnf = codigo)
18. 6.003 93.769 ↑ 1.0 28,064 1

Hash (cost=7,893.07..7,893.07 rows=28,064 width=16) (actual time=93.769..93.769 rows=28,064 loops=1)

  • Buckets: 32768 Batches: 1 Memory Usage: 1572kB
19. 18.152 87.766 ↑ 1.0 28,064 1

Hash Right Join (cost=3,859.05..7,893.07 rows=28,064 width=16) (actual time=46.509..87.766 rows=28,064 loops=1)

  • Hash Cond: (pv.codigo = pvpg.codprevenda)
20. 23.246 23.246 ↓ 1.0 91,560 1

Seq Scan on prevendas pv (cost=0.00..3,295.59 rows=91,559 width=8) (actual time=0.003..23.246 rows=91,560 loops=1)

21. 4.850 46.368 ↑ 1.0 28,064 1

Hash (cost=3,508.25..3,508.25 rows=28,064 width=12) (actual time=46.368..46.368 rows=28,064 loops=1)

  • Buckets: 32768 Batches: 1 Memory Usage: 1462kB
22. 9.878 41.518 ↑ 1.0 28,064 1

Hash Left Join (cost=2,716.73..3,508.25 rows=28,064 width=12) (actual time=29.553..41.518 rows=28,064 loops=1)

  • Hash Cond: (pvpg_cr.prevendas_pagtos_codigo = pvpg.codigo)
23. 2.621 2.621 ↑ 1.0 28,064 1

Seq Scan on prevendas_pagtos_contasareceber pvpg_cr (cost=0.00..405.64 rows=28,064 width=8) (actual time=0.005..2.621 rows=28,064 loops=1)

24. 15.453 29.019 ↑ 1.0 93,499 1

Hash (cost=1,547.99..1,547.99 rows=93,499 width=8) (actual time=29.019..29.019 rows=93,499 loops=1)

  • Buckets: 131072 Batches: 1 Memory Usage: 4677kB
25. 13.566 13.566 ↑ 1.0 93,499 1

Seq Scan on prevenda_pagto pvpg (cost=0.00..1,547.99 rows=93,499 width=8) (actual time=0.025..13.566 rows=93,499 loops=1)

26. 33.529 72.199 ↓ 1.0 205,443 1

Hash (cost=3,165.00..3,165.00 rows=205,400 width=4) (actual time=72.199..72.199 rows=205,443 loops=1)

  • Buckets: 262144 Batches: 1 Memory Usage: 9271kB
27. 38.670 38.670 ↓ 1.0 205,443 1

Seq Scan on contasareceber_faturamentos cr_fat (cost=0.00..3,165.00 rows=205,400 width=4) (actual time=0.023..38.670 rows=205,443 loops=1)

28. 35.765 64.155 ↑ 1.0 177,399 1

Hash (cost=2,735.25..2,735.25 rows=177,525 width=12) (actual time=64.155..64.155 rows=177,399 loops=1)

  • Buckets: 262144 Batches: 1 Memory Usage: 9671kB
29. 28.390 28.390 ↑ 1.0 177,399 1

Seq Scan on contasareceber_avulsas crav (cost=0.00..2,735.25 rows=177,525 width=12) (actual time=0.005..28.390 rows=177,399 loops=1)

30. 40.513 68.538 ↑ 1.0 205,639 1

Hash (cost=2,967.39..2,967.39 rows=205,639 width=8) (actual time=68.538..68.538 rows=205,639 loops=1)

  • Buckets: 262144 Batches: 1 Memory Usage: 10081kB
31. 28.025 28.025 ↑ 1.0 205,639 1

Seq Scan on contasareceber_situacao cr_sit (cost=0.00..2,967.39 rows=205,639 width=8) (actual time=0.086..28.025 rows=205,639 loops=1)

32. 0.009 0.013 ↑ 1.0 6 1

Hash (cost=1.06..1.06 rows=6 width=126) (actual time=0.013..0.013 rows=6 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
33. 0.004 0.004 ↑ 1.0 6 1

Seq Scan on situacoescontas sc (cost=0.00..1.06 rows=6 width=126) (actual time=0.002..0.004 rows=6 loops=1)

34. 0.009 0.015 ↑ 110.0 4 1

Hash (cost=14.40..14.40 rows=440 width=122) (actual time=0.015..0.015 rows=4 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
35. 0.006 0.006 ↑ 110.0 4 1

Seq Scan on gruposcontas grct (cost=0.00..14.40 rows=440 width=122) (actual time=0.005..0.006 rows=4 loops=1)

36. 139.046 1,443.811 ↑ 1.0 205,639 1

Sort (cost=134,491.34..135,005.44 rows=205,639 width=484) (actual time=1,435.759..1,443.811 rows=205,639 loops=1)

  • Sort Key: contas.entidade_codigo, contas.entidade, contas.datavencimento, contas.codigo
  • Sort Method: quicksort Memory: 56673kB
37. 172.039 1,304.765 ↑ 1.0 205,639 1

WindowAgg (cost=67,245.67..71,358.45 rows=205,639 width=484) (actual time=1,123.844..1,304.765 rows=205,639 loops=1)

38. 149.169 1,132.726 ↑ 1.0 205,639 1

Sort (cost=67,245.67..67,759.77 rows=205,639 width=484) (actual time=1,123.825..1,132.726 rows=205,639 loops=1)

  • Sort Key: contas.entidade_codigo, contas.entidade
  • Sort Method: quicksort Memory: 50245kB
39. 983.557 983.557 ↑ 1.0 205,639 1

CTE Scan on contas (cost=0.00..4,112.78 rows=205,639 width=484) (actual time=307.825..983.557 rows=205,639 loops=1)