explain.depesz.com

PostgreSQL's explain analyze made readable

Result: AhF6

Settings
# exclusive inclusive rows x rows loops node
1. 73.963 1,786.121 ↓ 1.4 36,489 1

Hash Left Join (cost=5,607.51..455,274.75 rows=26,187 width=983) (actual time=191.650..1,786.121 rows=36,489 loops=1)

  • Hash Cond: (notafiscal.id = notafiscalcupomfiscal.idnotafiscal)
2. 44.094 980.586 ↓ 1.4 36,489 1

Hash Left Join (cost=5,553.30..10,566.25 rows=26,187 width=927) (actual time=189.707..980.586 rows=36,489 loops=1)

  • Hash Cond: (notafiscalfinalidade.id = notafiscalfinalidadeidioma.idnotafiscalfinalidade)
3. 44.833 936.459 ↓ 1.4 36,489 1

Hash Left Join (cost=5,552.20..10,423.58 rows=26,187 width=713) (actual time=189.654..936.459 rows=36,489 loops=1)

  • Hash Cond: (notafiscaleletronica.idnotafiscalfinalidade = notafiscalfinalidade.id)
4. 58.049 891.592 ↓ 1.4 36,489 1

Hash Left Join (cost=5,551.11..10,280.92 rows=26,187 width=713) (actual time=189.582..891.592 rows=36,489 loops=1)

  • Hash Cond: (notafiscal.id = notafiscaltotalicms.idnotafiscal)
5. 57.262 781.990 ↓ 1.4 36,489 1

Hash Left Join (cost=4,207.25..8,583.07 rows=25,744 width=701) (actual time=137.696..781.990 rows=36,489 loops=1)

  • Hash Cond: (notafiscal.id = notafiscaltotalissqn.idnotafiscal)
6. 56.905 677.874 ↓ 1.4 36,489 1

Hash Left Join (cost=3,065.14..7,089.28 rows=25,577 width=689) (actual time=90.509..677.874 rows=36,489 loops=1)

  • Hash Cond: (notafiscal.id = notafiscalimpostoretido.idnotafiscal)
7. 57.235 578.771 ↓ 1.4 36,489 1

Hash Left Join (cost=1,666.08..5,339.54 rows=25,504 width=680) (actual time=47.972..578.771 rows=36,489 loops=1)

  • Hash Cond: (notafiscal.id = notafiscaleletronica.idnotafiscal)
8. 42.974 475.801 ↓ 1.4 36,489 1

Hash Left Join (cost=61.89..3,668.39 rows=25,504 width=618) (actual time=1.922..475.801 rows=36,489 loops=1)

  • Hash Cond: (notafiscalsituacao.id = notafiscalsituacaoidioma.idnotafiscalsituacao)
9. 41.530 432.805 ↓ 1.4 36,489 1

Hash Left Join (cost=60.70..3,568.72 rows=25,504 width=500) (actual time=1.884..432.805 rows=36,489 loops=1)

  • Hash Cond: (modelodocumento.id = modelodocumentoidioma.idmodelodocumento)
10. 41.723 391.210 ↓ 1.4 36,489 1

Hash Join (cost=58.93..3,492.54 rows=25,504 width=366) (actual time=1.806..391.210 rows=36,489 loops=1)

  • Hash Cond: (notafiscal.idmodelodocumento = modelodocumento.id)
11. 41.496 349.439 ↓ 1.4 36,489 1

Hash Join (cost=57.07..3,416.27 rows=25,504 width=366) (actual time=1.742..349.439 rows=36,489 loops=1)

  • Hash Cond: (notafiscal.idempresa = empresa.id)
12. 42.421 307.926 ↓ 1.4 36,489 1

Hash Join (cost=55.89..3,312.68 rows=25,504 width=366) (actual time=1.712..307.926 rows=36,489 loops=1)

  • Hash Cond: (naturezaoperacao.idbase = naturezaoperacaobase.id)
13. 45.085 265.309 ↓ 1.4 36,489 1

Hash Join (cost=50.13..3,238.41 rows=25,504 width=333) (actual time=1.501..265.309 rows=36,489 loops=1)

  • Hash Cond: (notafiscal.idnaturezaoperacao = naturezaoperacao.id)
14. 42.752 218.895 ↓ 1.4 36,489 1

Hash Join (cost=5.35..3,126.48 rows=25,504 width=333) (actual time=0.151..218.895 rows=36,489 loops=1)

  • Hash Cond: (notafiscal.idnotafiscaltipo = notafiscaltipo.id)
15. 40.876 176.122 ↓ 1.4 36,489 1

Hash Join (cost=4.06..3,036.41 rows=25,504 width=219) (actual time=0.115..176.122 rows=36,489 loops=1)

  • Hash Cond: (notafiscal.idespeciedocumento = especiedocumento.id)
16. 42.068 135.202 ↓ 1.4 36,489 1

Hash Join (cost=2.27..2,959.57 rows=25,504 width=145) (actual time=0.059..135.202 rows=36,489 loops=1)

  • Hash Cond: (notafiscal.idtributacaofederalforma = tributacaofederalforma.id)
17. 64.182 93.125 ↓ 1.4 36,489 1

Hash Join (cost=1.20..2,796.98 rows=25,504 width=149) (actual time=0.037..93.125 rows=36,489 loops=1)

  • Hash Cond: (notafiscal.idnotafiscalsituacao = notafiscalsituacao.id)
18. 28.928 28.928 ↓ 1.4 36,489 1

Seq Scan on notafiscal (cost=0.00..2,697.30 rows=25,504 width=149) (actual time=0.007..28.928 rows=36,489 loops=1)

  • Filter: (idempresa = ANY ('{1,2,4,3,5,6,7,8}'::integer[]))
19. 0.008 0.015 ↑ 1.0 9 1

Hash (cost=1.09..1.09 rows=9 width=4) (actual time=0.015..0.015 rows=9 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
20. 0.007 0.007 ↑ 1.0 9 1

Seq Scan on notafiscalsituacao (cost=0.00..1.09 rows=9 width=4) (actual time=0.003..0.007 rows=9 loops=1)

21. 0.004 0.009 ↑ 1.0 3 1

Hash (cost=1.03..1.03 rows=3 width=4) (actual time=0.009..0.009 rows=3 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
22. 0.005 0.005 ↑ 1.0 3 1

Seq Scan on tributacaofederalforma (cost=0.00..1.03 rows=3 width=4) (actual time=0.003..0.005 rows=3 loops=1)

23. 0.023 0.044 ↑ 1.0 35 1

Hash (cost=1.35..1.35 rows=35 width=82) (actual time=0.044..0.044 rows=35 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
24. 0.021 0.021 ↑ 1.0 35 1

Seq Scan on especiedocumento (cost=0.00..1.35 rows=35 width=82) (actual time=0.004..0.021 rows=35 loops=1)

25. 0.011 0.021 ↑ 1.0 13 1

Hash (cost=1.13..1.13 rows=13 width=122) (actual time=0.020..0.021 rows=13 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
26. 0.010 0.010 ↑ 1.0 13 1

Seq Scan on notafiscaltipo (cost=0.00..1.13 rows=13 width=122) (actual time=0.004..0.010 rows=13 loops=1)

27. 0.671 1.329 ↑ 1.1 1,344 1

Hash (cost=26.57..26.57 rows=1,457 width=8) (actual time=1.328..1.329 rows=1,344 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 69kB
28. 0.658 0.658 ↑ 1.1 1,344 1

Seq Scan on naturezaoperacao (cost=0.00..26.57 rows=1,457 width=8) (actual time=0.007..0.658 rows=1,344 loops=1)

29. 0.108 0.196 ↓ 1.0 168 1

Hash (cost=3.67..3.67 rows=167 width=41) (actual time=0.196..0.196 rows=168 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 21kB
30. 0.088 0.088 ↓ 1.0 168 1

Seq Scan on naturezaoperacaobase (cost=0.00..3.67 rows=167 width=41) (actual time=0.008..0.088 rows=168 loops=1)

31. 0.008 0.017 ↑ 1.0 8 1

Hash (cost=1.08..1.08 rows=8 width=8) (actual time=0.016..0.017 rows=8 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
32. 0.009 0.009 ↑ 1.0 8 1

Seq Scan on empresa (cost=0.00..1.08 rows=8 width=8) (actual time=0.004..0.009 rows=8 loops=1)

33. 0.023 0.048 ↑ 1.0 38 1

Hash (cost=1.38..1.38 rows=38 width=4) (actual time=0.047..0.048 rows=38 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
34. 0.025 0.025 ↑ 1.0 38 1

Seq Scan on modelodocumento (cost=0.00..1.38 rows=38 width=4) (actual time=0.009..0.025 rows=38 loops=1)

35. 0.026 0.065 ↓ 38.0 38 1

Hash (cost=1.76..1.76 rows=1 width=142) (actual time=0.064..0.065 rows=38 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 11kB
36. 0.039 0.039 ↓ 38.0 38 1

Seq Scan on modelodocumentoidioma (cost=0.00..1.76 rows=1 width=142) (actual time=0.011..0.039 rows=38 loops=1)

  • Filter: (ididioma = (current_setting('global.ididioma'::text))::integer)
37. 0.008 0.022 ↓ 9.0 9 1

Hash (cost=1.18..1.18 rows=1 width=126) (actual time=0.021..0.022 rows=9 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
38. 0.014 0.014 ↓ 9.0 9 1

Seq Scan on notafiscalsituacaoidioma (cost=0.00..1.18 rows=1 width=126) (actual time=0.007..0.014 rows=9 loops=1)

  • Filter: (ididioma = (current_setting('global.ididioma'::text))::integer)
39. 21.103 45.735 ↑ 1.0 34,075 1

Hash (cost=1,173.53..1,173.53 rows=34,453 width=66) (actual time=45.735..45.735 rows=34,075 loops=1)

  • Buckets: 65536 Batches: 1 Memory Usage: 3398kB
40. 24.632 24.632 ↑ 1.0 34,075 1

Seq Scan on notafiscaleletronica (cost=0.00..1,173.53 rows=34,453 width=66) (actual time=0.007..24.632 rows=34,075 loops=1)

41. 20.891 42.198 ↑ 1.0 36,409 1

Hash (cost=940.69..940.69 rows=36,669 width=13) (actual time=42.198..42.198 rows=36,409 loops=1)

  • Buckets: 65536 Batches: 1 Memory Usage: 2234kB
42. 21.307 21.307 ↑ 1.0 36,409 1

Seq Scan on notafiscalimpostoretido (cost=0.00..940.69 rows=36,669 width=13) (actual time=0.015..21.307 rows=36,409 loops=1)

43. 24.769 46.854 ↑ 1.0 36,488 1

Hash (cost=682.05..682.05 rows=36,805 width=16) (actual time=46.853..46.854 rows=36,488 loops=1)

  • Buckets: 65536 Batches: 1 Memory Usage: 2286kB
44. 22.085 22.085 ↑ 1.0 36,488 1

Seq Scan on notafiscaltotalissqn (cost=0.00..682.05 rows=36,805 width=16) (actual time=0.015..22.085 rows=36,488 loops=1)

45. 26.839 51.553 ↑ 1.0 36,488 1

Hash (cost=878.94..878.94 rows=37,194 width=16) (actual time=51.552..51.553 rows=36,488 loops=1)

  • Buckets: 65536 Batches: 1 Memory Usage: 2303kB
46. 24.714 24.714 ↑ 1.0 36,488 1

Seq Scan on notafiscaltotalicms (cost=0.00..878.94 rows=37,194 width=16) (actual time=0.013..24.714 rows=36,488 loops=1)

47. 0.016 0.034 ↑ 1.0 4 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
48. 0.018 0.018 ↑ 1.0 4 1

Seq Scan on notafiscalfinalidade (cost=0.00..1.04 rows=4 width=4) (actual time=0.015..0.018 rows=4 loops=1)

49. 0.008 0.033 ↓ 4.0 4 1

Hash (cost=1.08..1.08 rows=1 width=222) (actual time=0.033..0.033 rows=4 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
50. 0.025 0.025 ↓ 4.0 4 1

Seq Scan on notafiscalfinalidadeidioma (cost=0.00..1.08 rows=1 width=222) (actual time=0.019..0.025 rows=4 loops=1)

  • Filter: (ididioma = (current_setting('global.ididioma'::text))::integer)
51. 0.828 1.792 ↑ 1.0 1,076 1

Hash (cost=40.76..40.76 rows=1,076 width=12) (actual time=1.792..1.792 rows=1,076 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 63kB
52. 0.964 0.964 ↑ 1.0 1,076 1

Seq Scan on notafiscalcupomfiscal (cost=0.00..40.76 rows=1,076 width=12) (actual time=0.009..0.964 rows=1,076 loops=1)

53.          

SubPlan (forHash Left Join)

54. 182.445 729.780 ↑ 1.0 1 36,489

Limit (cost=16.97..16.98 rows=1 width=7) (actual time=0.016..0.020 rows=1 loops=36,489)

55. 109.467 547.335 ↑ 1.0 1 36,489

Sort (cost=16.97..16.98 rows=1 width=7) (actual time=0.014..0.015 rows=1 loops=36,489)

  • Sort Key: contareceber.documento
  • Sort Method: quicksort Memory: 25kB
56. 77.464 437.868 ↑ 1.0 1 36,489

Nested Loop Left Join (cost=0.87..16.96 rows=1 width=7) (actual time=0.009..0.012 rows=1 loops=36,489)

57. 79.707 291.912 ↑ 1.0 1 36,489

Nested Loop Left Join (cost=0.58..16.62 rows=1 width=4) (actual time=0.006..0.008 rows=1 loops=36,489)

58. 109.467 109.467 ↑ 1.0 1 36,489

Index Scan using contareceberparceladocumentofiscalorigem_002_idx on contareceberparceladocumentofiscalorigem (cost=0.29..8.31 rows=1 width=4) (actual time=0.002..0.003 rows=1 loops=36,489)

  • Index Cond: (idnotafiscal = notafiscal.id)
59. 102.738 102.738 ↑ 1.0 1 34,246

Index Scan using contareceberparcela_pkey on contareceberparcela (cost=0.29..8.31 rows=1 width=8) (actual time=0.002..0.003 rows=1 loops=34,246)

  • Index Cond: (id = contareceberparceladocumentofiscalorigem.idcontareceberparcela)
60. 68.492 68.492 ↑ 1.0 1 34,246

Index Scan using contareceber_pkey on contareceber (cost=0.29..0.35 rows=1 width=11) (actual time=0.002..0.002 rows=1 loops=34,246)

  • Index Cond: (id = contareceberparcela.idcontareceber)
Planning time : 11.722 ms
Execution time : 1,802.824 ms