explain.depesz.com

PostgreSQL's explain analyze made readable

Result: JAxo

Settings
# exclusive inclusive rows x rows loops node
1. 93.306 2,180.308 ↓ 2.0 205,443 1

Hash Left Join (cost=192,958.82..204,654.54 rows=102,820 width=559) (actual time=1,814.187..2,180.308 rows=205,443 loops=1)

  • Hash Cond: (vcr.codigo = vcr_pagtos.contasareceber_faturamentos_cr_codigo)
2. 32.986 1,735.030 ↓ 2.0 205,443 1

Subquery Scan on vcr (cost=177,809.08..188,091.03 rows=102,820 width=516) (actual time=1,461.621..1,735.030 rows=205,443 loops=1)

  • Filter: vcr.faturada
  • Rows Removed by Filter: 196
3. 225.408 1,702.044 ↑ 1.0 205,639 1

WindowAgg (cost=177,809.08..186,034.64 rows=205,639 width=484) (actual time=1,461.619..1,702.044 rows=205,639 loops=1)

4.          

CTE contas

5. 73.336 767.206 ↑ 1.0 205,639 1

Hash Left Join (cost=25,163.72..43,317.74 rows=205,639 width=111) (actual time=232.796..767.206 rows=205,639 loops=1)

  • Hash Cond: (cr.gruposcontas_codigo = grct.codigo)
6. 58.945 693.860 ↑ 1.0 205,639 1

Hash Left Join (cost=25,162.63..42,545.50 rows=205,639 width=102) (actual time=232.779..693.860 rows=205,639 loops=1)

  • Hash Cond: (cr_sit.situacoesconta_codigo = sc.codigo)
7. 90.786 634.901 ↑ 1.0 205,639 1

Hash Left Join (cost=25,161.49..39,716.82 rows=205,639 width=89) (actual time=232.757..634.901 rows=205,639 loops=1)

  • Hash Cond: (cr.codigo = cr_sit.contasareceber_codigo)
8. 90.221 491.740 ↑ 1.0 205,639 1

Hash Left Join (cost=19,623.62..31,351.41 rows=205,639 width=85) (actual time=179.294..491.740 rows=205,639 loops=1)

  • Hash Cond: (cr.codigo = crav.contasareceber_codigo)
9. 82.850 349.334 ↑ 1.0 205,639 1

Hash Left Join (cost=14,672.14..23,854.80 rows=205,639 width=77) (actual time=126.046..349.334 rows=205,639 loops=1)

  • Hash Cond: (cr.codigo = cr_fat.contasareceber_codigo)
10. 61.251 215.926 ↑ 1.0 205,639 1

Hash Left Join (cost=8,938.67..15,295.75 rows=205,639 width=73) (actual time=74.392..215.926 rows=205,639 loops=1)

  • Hash Cond: (cr.codigo = pvpg_cr.contasareceber_codigo)
11. 62.193 83.807 ↑ 1.0 205,639 1

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

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

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

13. 0.040 3.323 ↑ 1.0 176 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 16kB
14. 0.117 3.283 ↑ 1.0 176 1

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

15. 1.886 2.990 ↑ 1.0 176 1

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

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

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

17. 0.025 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
18. 0.017 0.017 ↑ 1.0 176 1

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

19. 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)
20. 5.287 70.868 ↑ 1.0 28,064 1

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

  • Buckets: 32768 Batches: 1 Memory Usage: 1572kB
21. 20.127 65.581 ↑ 1.0 28,064 1

Hash Right Join (cost=3,859.05..7,893.09 rows=28,064 width=16) (actual time=40.193..65.581 rows=28,064 loops=1)

  • Hash Cond: (pv.codigo = pvpg.codprevenda)
22. 5.451 5.451 ↑ 1.0 91,560 1

Seq Scan on prevendas pv (cost=0.00..3,295.60 rows=91,560 width=8) (actual time=0.002..5.451 rows=91,560 loops=1)

23. 4.659 40.003 ↑ 1.0 28,064 1

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

  • Buckets: 32768 Batches: 1 Memory Usage: 1462kB
24. 9.553 35.344 ↑ 1.0 28,064 1

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

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

26. 15.087 24.349 ↑ 1.0 93,499 1

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

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

28. 32.632 50.558 ↑ 1.0 205,443 1

Hash (cost=3,165.43..3,165.43 rows=205,443 width=4) (actual time=50.558..50.558 rows=205,443 loops=1)

  • Buckets: 262144 Batches: 1 Memory Usage: 9271kB
29. 17.926 17.926 ↑ 1.0 205,443 1

Seq Scan on contasareceber_faturamentos cr_fat (cost=0.00..3,165.43 rows=205,443 width=4) (actual time=0.006..17.926 rows=205,443 loops=1)

30. 33.878 52.185 ↑ 1.0 177,399 1

Hash (cost=2,733.99..2,733.99 rows=177,399 width=12) (actual time=52.185..52.185 rows=177,399 loops=1)

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

Seq Scan on contasareceber_avulsas crav (cost=0.00..2,733.99 rows=177,399 width=12) (actual time=0.003..18.307 rows=177,399 loops=1)

32. 40.194 52.375 ↑ 1.0 205,639 1

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

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

34. 0.009 0.014 ↑ 1.0 6 1

Hash (cost=1.06..1.06 rows=6 width=17) (actual time=0.014..0.014 rows=6 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
35. 0.005 0.005 ↑ 1.0 6 1

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

36. 0.008 0.010 ↑ 1.0 4 1

Hash (cost=1.04..1.04 rows=4 width=13) (actual time=0.010..0.010 rows=4 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
37. 0.002 0.002 ↑ 1.0 4 1

Seq Scan on gruposcontas grct (cost=0.00..1.04 rows=4 width=13) (actual time=0.002..0.002 rows=4 loops=1)

38. 150.433 1,476.636 ↑ 1.0 205,639 1

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

  • Sort Key: contas.entidade_codigo, contas.entidade, contas.datavencimento, contas.codigo
  • Sort Method: quicksort Memory: 56673kB
39. 192.038 1,326.203 ↑ 1.0 205,639 1

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

40. 166.279 1,134.165 ↑ 1.0 205,639 1

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

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

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

42. 47.083 351.972 ↓ 3.0 204,168 1

Hash (cost=14,299.04..14,299.04 rows=68,056 width=43) (actual time=351.972..351.972 rows=204,168 loops=1)

  • Buckets: 262144 (originally 131072) Batches: 1 (originally 1) Memory Usage: 11419kB
43. 20.059 304.889 ↓ 3.0 204,168 1

Subquery Scan on vcr_pagtos (cost=13,278.20..14,299.04 rows=68,056 width=43) (actual time=250.095..304.889 rows=204,168 loops=1)

44. 22.713 284.830 ↓ 3.0 204,168 1

Unique (cost=13,278.20..13,618.48 rows=68,056 width=21) (actual time=250.093..284.830 rows=204,168 loops=1)

45. 123.555 262.117 ↓ 3.0 204,170 1

Sort (cost=13,278.20..13,448.34 rows=68,056 width=21) (actual time=250.091..262.117 rows=204,170 loops=1)

  • Sort Key: crpg.contasareceber_faturamentos_cr_codigo, crpg.dhpagamento DESC
  • Sort Method: quicksort Memory: 22095kB
46. 75.875 138.562 ↓ 3.0 204,170 1

Hash Anti Join (cost=5.76..7,815.19 rows=68,056 width=21) (actual time=0.057..138.562 rows=204,170 loops=1)

  • Hash Cond: (crpg.codigo = crpg_e.contasareceber_pagtos_codigo)
47. 62.654 62.654 ↓ 3.0 204,337 1

Seq Scan on contasareceber_pagtos crpg (cost=0.00..6,609.74 rows=68,112 width=25) (actual time=0.010..62.654 rows=204,337 loops=1)

  • Filter: ((dhpagamento)::date <= (now())::date)
48. 0.019 0.033 ↑ 1.0 167 1

Hash (cost=3.67..3.67 rows=167 width=4) (actual time=0.033..0.033 rows=167 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 14kB
49. 0.014 0.014 ↑ 1.0 167 1

Seq Scan on contasareceber_pagtos_estornos crpg_e (cost=0.00..3.67 rows=167 width=4) (actual time=0.002..0.014 rows=167 loops=1)