explain.depesz.com

PostgreSQL's explain analyze made readable

Result: xDyI

Settings
# exclusive inclusive rows x rows loops node
1. 106.574 1,993.759 ↓ 1.4 36,489 1

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Seq Scan on notafiscal (cost=0.00..2,697.30 rows=25,504 width=149) (actual time=0.007..37.003 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.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.045 ↑ 1.0 35 1

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

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

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

25. 0.010 0.021 ↑ 1.0 13 1

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

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

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

27. 0.696 1.406 ↑ 1.1 1,344 1

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

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

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

29. 0.119 0.231 ↓ 1.0 168 1

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

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

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

31. 0.008 0.018 ↑ 1.0 8 1

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

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

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

33. 0.022 0.049 ↑ 1.0 38 1

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

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

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

35. 0.027 0.070 ↓ 38.0 38 1

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

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

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

  • Filter: (ididioma = (current_setting('global.ididioma'::text))::integer)
37. 0.009 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.013 0.013 ↓ 9.0 9 1

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

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

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

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

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

41. 20.947 42.612 ↑ 1.0 36,409 1

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

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

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

43. 26.803 51.249 ↑ 1.0 36,488 1

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

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

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

45. 26.601 51.732 ↑ 1.0 36,488 1

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

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

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

47. 0.015 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.019 0.019 ↑ 1.0 4 1

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

49. 0.009 0.032 ↓ 4.0 4 1

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

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

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

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

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

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

Seq Scan on notafiscalcupomfiscal (cost=0.00..40.76 rows=1,076 width=12) (actual time=0.011..0.907 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.016..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)