explain.depesz.com

PostgreSQL's explain analyze made readable

Result: QbR0

Settings
# exclusive inclusive rows x rows loops node
1. 116.016 1,998.891 ↓ 1.4 36,489 1

Hash Left Join (cost=5,607.95..455,275.34 rows=26,187 width=983) (actual time=201.184..1,998.891 rows=36,489 loops=1)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

21. 0.005 0.010 ↑ 1.0 3 1

Hash (cost=1.03..1.03 rows=3 width=4) (actual time=0.009..0.010 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.046 ↑ 1.0 35 1

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

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

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

25. 0.014 0.026 ↑ 1.0 13 1

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

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

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

27. 0.725 1.441 ↑ 1.1 1,344 1

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

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

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

29. 0.128 0.220 ↓ 1.0 168 1

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

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

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

31. 0.012 0.024 ↑ 1.0 8 1

Hash (cost=1.08..1.08 rows=8 width=8) (actual time=0.023..0.024 rows=8 loops=1)

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

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

33. 0.031 0.065 ↑ 1.0 38 1

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

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

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

35. 0.036 0.105 ↓ 38.0 38 1

Hash (cost=1.76..1.76 rows=1 width=142) (actual time=0.104..0.105 rows=38 loops=1)

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

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

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

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

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

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

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

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

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

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

41. 23.937 48.330 ↑ 1.0 36,409 1

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

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

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

43. 24.576 47.190 ↑ 1.0 36,488 1

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

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

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

45. 23.458 45.876 ↑ 1.0 36,488 1

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

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

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

47. 0.006 0.017 ↑ 1.0 4 1

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

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

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

49. 0.007 0.025 ↓ 4.0 4 1

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

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

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

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

Hash (cost=40.96..40.96 rows=1,096 width=12) (actual time=1.216..1.217 rows=1,076 loops=1)

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

Seq Scan on notafiscalcupomfiscal (cost=0.00..40.96 rows=1,096 width=12) (actual time=0.007..0.668 rows=1,076 loops=1)

53.          

SubPlan (forHash Left Join)

54. 182.445 802.758 ↑ 1.0 1 36,489

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

55. 109.467 620.313 ↑ 1.0 1 36,489

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

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

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

57. 79.707 328.401 ↑ 1.0 1 36,489

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

58. 145.956 145.956 ↑ 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.003..0.004 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.003..0.003 rows=1 loops=34,246)

  • Index Cond: (id = contareceberparceladocumentofiscalorigem.idcontareceberparcela)
60. 102.738 102.738 ↑ 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.003 rows=1 loops=34,246)

  • Index Cond: (id = contareceberparcela.idcontareceber)
Planning time : 12.501 ms
Execution time : 2,016.996 ms