explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 39Q

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 211.882 1,658.618 ↑ 1.0 205,639 1

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

2.          

CTE contas

3. 72.043 783.178 ↑ 1.0 205,639 1

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

11. 0.035 3.328 ↑ 1.0 176 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 16kB
12. 0.119 3.293 ↑ 1.0 176 1

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

13. 1.625 2.998 ↑ 1.0 176 1

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

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

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

15. 0.029 0.049 ↑ 1.0 176 1

Hash (cost=2.76..2.76 rows=176 width=8) (actual time=0.049..0.049 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.176 0.176 ↑ 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.001..0.001 rows=1 loops=176)

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

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

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

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

  • Hash Cond: (pv.codigo = pvpg.codprevenda)
20. 7.815 7.815 ↓ 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..7.815 rows=91,560 loops=1)

21. 5.180 83.950 ↑ 1.0 28,064 1

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

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

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

  • Hash Cond: (pvpg_cr.prevendas_pagtos_codigo = pvpg.codigo)
23. 1.850 1.850 ↑ 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.006..1.850 rows=28,064 loops=1)

24. 15.290 25.083 ↑ 1.0 93,499 1

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

  • Buckets: 131072 Batches: 1 Memory Usage: 4677kB
25. 9.793 9.793 ↑ 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.004..9.793 rows=93,499 loops=1)

26. 35.306 55.978 ↓ 1.0 205,443 1

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

  • Buckets: 262144 Batches: 1 Memory Usage: 9271kB
27. 20.672 20.672 ↓ 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.010..20.672 rows=205,443 loops=1)

28. 36.425 55.599 ↑ 1.0 177,399 1

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

  • Buckets: 262144 Batches: 1 Memory Usage: 9671kB
29. 19.174 19.174 ↑ 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.007..19.174 rows=177,399 loops=1)

30. 38.218 51.839 ↑ 1.0 205,639 1

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

  • Buckets: 262144 Batches: 1 Memory Usage: 10081kB
31. 13.621 13.621 ↑ 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.010..13.621 rows=205,639 loops=1)

32. 0.004 0.007 ↑ 1.0 6 1

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

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

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

34. 0.010 0.012 ↑ 110.0 4 1

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

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

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

36. 140.875 1,446.736 ↑ 1.0 205,639 1

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

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

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

38. 150.759 1,123.671 ↑ 1.0 205,639 1

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

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

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