explain.depesz.com

PostgreSQL's explain analyze made readable

Result: NYcU

Settings
# exclusive inclusive rows x rows loops node
1. 1.588 5,913.442 ↓ 40.0 40 1

Subquery Scan on r (cost=404,717.64..409,712.26 rows=1 width=1,326) (actual time=5,093.125..5,913.442 rows=40 loops=1)

2. 0.183 5,651.094 ↓ 40.0 40 1

Limit (cost=404,717.64..408,933.06 rows=1 width=1,226) (actual time=5,086.011..5,651.094 rows=40 loops=1)

3. 24.378 5,650.911 ↓ 3.8 360 1

WindowAgg (cost=4,252.89..404,717.64 rows=95 width=1,226) (actual time=433.284..5,650.911 rows=360 loops=1)

4. 15.738 400.053 ↓ 70.3 6,679 1

Group (cost=4,252.89..4,256.93 rows=95 width=990) (actual time=376.432..400.053 rows=6,679 loops=1)

  • Group Key: trp."trpID", tpe."tpeID", tcl."tclID", tos."tosID", tpc."tpcID", tcb."tcbID", tbc."tbcID", tba."tbaID", tpe_empresa."tpeID", trec."trecID", ttb."ttbID", trem."tremID", tfu."tfuID", tpe_funcionario."tpeID", tct."tctID", tlsos."tlsosSituacao
5. 45.343 384.315 ↓ 140.2 13,317 1

Sort (cost=4,252.89..4,253.13 rows=95 width=990) (actual time=376.425..384.315 rows=13,317 loops=1)

  • Sort Key: trp."trpID", tpe."tpeID", tcl."tclID", tos."tosID", tpc."tpcID", tcb."tcbID", tbc."tbcID", tba."tbaID", tpe_empresa."tpeID", trec."trecID", ttb."ttbID", trem."tremID", tfu."tfuID", tpe_funcionario."tpeID", tct."tctID", tlsos."tlsosSituacao
  • Sort Method: external merge Disk: 10016kB
6. 48.567 338.972 ↓ 140.2 13,317 1

Hash Right Join (cost=2,274.86..4,249.77 rows=95 width=990) (actual time=269.750..338.972 rows=13,317 loops=1)

  • Hash Cond: (trpc."trpctrpID" = trp."trpID")
7. 22.012 22.012 ↑ 1.0 89,210 1

Seq Scan on "TabReceitaParcelaContabil" trpc (cost=0.00..1,638.79 rows=89,379 width=4) (actual time=0.010..22.012 rows=89,210 loops=1)

8. 14.750 268.393 ↓ 109.5 6,679 1

Hash (cost=2,274.10..2,274.10 rows=61 width=990) (actual time=268.392..268.393 rows=6,679 loops=1)

  • Buckets: 8192 (originally 1024) Batches: 2 (originally 1) Memory Usage: 4033kB
9. 5.070 253.643 ↓ 109.5 6,679 1

Hash Left Join (cost=249.21..2,274.10 rows=61 width=990) (actual time=3.853..253.643 rows=6,679 loops=1)

  • Hash Cond: (tcfos."tcfosID" = tct."tcttcfosID")
10. 4.477 248.306 ↓ 109.5 6,679 1

Hash Left Join (cost=223.35..2,247.32 rows=61 width=972) (actual time=3.580..248.306 rows=6,679 loops=1)

  • Hash Cond: (tos."tosID" = tcfos."tcfostosID")
11. 8.047 243.617 ↓ 109.5 6,679 1

Nested Loop Left Join (cost=212.48..2,236.19 rows=61 width=968) (actual time=3.361..243.617 rows=6,679 loops=1)

12. 7.865 235.570 ↓ 109.5 6,679 1

Nested Loop Left Join (cost=212.20..2,216.49 rows=61 width=959) (actual time=3.359..235.570 rows=6,679 loops=1)

13. 12.731 227.705 ↓ 109.5 6,679 1

Nested Loop Left Join (cost=212.07..2,206.32 rows=61 width=927) (actual time=3.358..227.705 rows=6,679 loops=1)

  • Join Filter: (tba."tbaID" = tbc."tbctbaID")
  • Rows Removed by Join Filter: 20494
14. 7.061 208.295 ↓ 109.5 6,679 1

Nested Loop Left Join (cost=212.07..2,201.61 rows=61 width=923) (actual time=3.346..208.295 rows=6,679 loops=1)

  • Join Filter: (tbc."tbcID" = tcb."tcbtbcID")
  • Rows Removed by Join Filter: 7136
15. 8.153 194.555 ↓ 109.5 6,679 1

Nested Loop (cost=212.07..2,198.76 rows=61 width=887) (actual time=3.339..194.555 rows=6,679 loops=1)

16. 32.319 173.044 ↓ 109.5 6,679 1

Nested Loop Left Join (cost=211.78..2,145.66 rows=61 width=849) (actual time=3.334..173.044 rows=6,679 loops=1)

  • Join Filter: (tcb."tcbID" = trp."trptcbID")
  • Rows Removed by Join Filter: 93548
17. 5.235 120.688 ↓ 109.5 6,679 1

Nested Loop (cost=210.25..2,083.28 rows=61 width=437) (actual time=3.230..120.688 rows=6,679 loops=1)

18. 3.220 84.673 ↓ 60.0 3,420 1

Nested Loop (cost=209.96..1,966.83 rows=57 width=143) (actual time=3.181..84.673 rows=3,420 loops=1)

19. 2.892 74.613 ↓ 60.0 3,420 1

Nested Loop Left Join (cost=209.68..1,946.86 rows=57 width=139) (actual time=3.176..74.613 rows=3,420 loops=1)

20. 2.377 64.881 ↓ 60.0 3,420 1

Nested Loop Left Join (cost=209.39..1,719.24 rows=57 width=119) (actual time=3.172..64.881 rows=3,420 loops=1)

21. 4.633 55.664 ↓ 60.0 3,420 1

Nested Loop Left Join (cost=209.12..1,701.63 rows=57 width=115) (actual time=3.169..55.664 rows=3,420 loops=1)

22. 4.093 44.191 ↓ 60.0 3,420 1

Nested Loop Left Join (cost=208.83..1,642.41 rows=57 width=81) (actual time=3.164..44.191 rows=3,420 loops=1)

23. 3.759 33.258 ↓ 60.0 3,420 1

Hash Join (cost=208.55..1,613.52 rows=57 width=58) (actual time=3.156..33.258 rows=3,420 loops=1)

  • Hash Cond: (tlsos."tlsostosID" = trec."trectosID")
24. 5.075 26.399 ↓ 60.9 4,993 1

Subquery Scan on tlsos (cost=0.29..1,403.97 rows=82 width=8) (actual time=0.020..26.399 rows=4,993 loops=1)

  • Filter: (tlsos.rr = 1)
  • Rows Removed by Filter: 11374
25. 13.592 21.324 ↑ 1.0 16,367 1

WindowAgg (cost=0.29..1,198.93 rows=16,403 width=20) (actual time=0.015..21.324 rows=16,367 loops=1)

26. 7.732 7.732 ↑ 1.0 16,367 1

Index Scan using idx_tlsos_tlsostosdesc on "TabLogSituacaoOrdemServico" (cost=0.29..911.88 rows=16,403 width=12) (actual time=0.010..7.732 rows=16,367 loops=1)

27. 1.339 3.100 ↑ 1.0 3,420 1

Hash (cost=165.10..165.10 rows=3,453 width=54) (actual time=3.100..3.100 rows=3,420 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 317kB
28. 1.761 1.761 ↑ 1.0 3,437 1

Seq Scan on "TabReceita" trec (cost=0.00..165.10 rows=3,453 width=54) (actual time=0.009..1.761 rows=3,437 loops=1)

  • Filter: ("trectemID" = 1)
  • Rows Removed by Filter: 2909
29. 6.840 6.840 ↑ 1.0 1 3,420

Index Scan using "TabOrdemServico_tosID" on "TabOrdemServico" tos (cost=0.28..0.50 rows=1 width=27) (actual time=0.002..0.002 rows=1 loops=3,420)

  • Index Cond: ("tosID" = trec."trectosID")
30. 6.840 6.840 ↑ 1.0 1 3,420

Index Scan using "TabPropostaComercial_tpcID" on "TabPropostaComercial" tpc (cost=0.28..1.03 rows=1 width=38) (actual time=0.002..0.002 rows=1 loops=3,420)

  • Index Cond: ("tpcID" = tos."tostpcID")
31. 6.840 6.840 ↑ 1.0 1 3,420

Index Scan using "TabFuncionario_tfuID" on "TabFuncionario" tfu (cost=0.27..0.30 rows=1 width=8) (actual time=0.001..0.002 rows=1 loops=3,420)

  • Index Cond: ("tfuID" = tpc."tpctfuID")
32. 6.840 6.840 ↑ 1.0 1 3,420

Index Scan using "TabPessoaID" on "TabPessoa" tpe_funcionario (cost=0.29..3.98 rows=1 width=24) (actual time=0.001..0.002 rows=1 loops=3,420)

  • Index Cond: ("tpeID" = tfu."tfutpeID")
33. 6.840 6.840 ↑ 1.0 1 3,420

Index Scan using "TabCliente_tclID" on "TabCliente" tcl (cost=0.28..0.34 rows=1 width=8) (actual time=0.001..0.002 rows=1 loops=3,420)

  • Index Cond: ("tclID" = trec."trectclID")
34. 30.780 30.780 ↓ 2.0 2 3,420

Index Scan using idx_trp_trecid_trpsubstituida on "TabReceitaParcela" trp (cost=0.29..2.03 rows=1 width=294) (actual time=0.006..0.009 rows=2 loops=3,420)

  • Index Cond: (("trptrecID" = trec."trecID") AND ("trpSubstituida" = false))
  • Filter: ((NOT "trpBaixada") AND (NOT "trpSubstituida") AND (NOT "trpPago") AND (NOT "trpEmitidoRemessa") AND ("trpIsExcluido" IS FALSE))
  • Rows Removed by Filter: 9
35. 19.943 20.037 ↓ 1.4 15 6,679

Materialize (cost=1.53..52.34 rows=11 width=416) (actual time=0.000..0.003 rows=15 loops=6,679)

36. 0.023 0.094 ↓ 1.4 15 1

Hash Right Join (cost=1.53..52.28 rows=11 width=416) (actual time=0.055..0.094 rows=15 loops=1)

  • Hash Cond: (tem."temID" = tcb."tcbtemID")
37. 0.009 0.036 ↑ 1.0 6 1

Nested Loop Left Join (cost=0.29..50.95 rows=6 width=44) (actual time=0.008..0.036 rows=6 loops=1)

38. 0.003 0.003 ↑ 1.0 6 1

Seq Scan on "TabEmpresa" tem (cost=0.00..1.06 rows=6 width=8) (actual time=0.003..0.003 rows=6 loops=1)

39. 0.024 0.024 ↑ 1.0 1 6

Index Scan using "TabPessoaID" on "TabPessoa" tpe_empresa (cost=0.29..8.30 rows=1 width=40) (actual time=0.003..0.004 rows=1 loops=6)

  • Index Cond: ("tpeID" = tem."temtpeID")
40. 0.020 0.035 ↓ 1.4 15 1

Hash (cost=1.11..1.11 rows=11 width=380) (actual time=0.035..0.035 rows=15 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 12kB
41. 0.015 0.015 ↓ 1.4 15 1

Seq Scan on "TabContaBancaria" tcb (cost=0.00..1.11 rows=11 width=380) (actual time=0.006..0.015 rows=15 loops=1)

42. 13.358 13.358 ↑ 1.0 1 6,679

Index Scan using "TabPessoaID" on "TabPessoa" tpe (cost=0.29..0.86 rows=1 width=42) (actual time=0.002..0.002 rows=1 loops=6,679)

  • Index Cond: ("tpeID" = tcl."tcltpeID")
43. 6.675 6.679 ↑ 1.0 2 6,679

Materialize (cost=0.00..1.03 rows=2 width=40) (actual time=0.000..0.001 rows=2 loops=6,679)

44. 0.004 0.004 ↑ 1.0 2 1

Seq Scan on "TabBancoCarteira" tbc (cost=0.00..1.02 rows=2 width=40) (actual time=0.002..0.004 rows=2 loops=1)

45. 6.674 6.679 ↑ 1.0 4 6,679

Materialize (cost=0.00..1.06 rows=4 width=8) (actual time=0.000..0.001 rows=4 loops=6,679)

46. 0.005 0.005 ↑ 1.0 4 1

Seq Scan on "TabBanco" tba (cost=0.00..1.04 rows=4 width=8) (actual time=0.003..0.005 rows=4 loops=1)

47. 0.000 0.000 ↓ 0.0 0 6,679

Index Scan using "TabTipoBaixa_ttbID" on "TabTipoBaixa" ttb (cost=0.14..0.16 rows=1 width=36) (actual time=0.000..0.000 rows=0 loops=6,679)

  • Index Cond: ("ttbID" = trp."trpTipoBaixa")
48. 0.000 0.000 ↓ 0.0 0 6,679

Index Scan using "TabRemessa_tremID" on "TabRemessa" trem (cost=0.28..0.31 rows=1 width=13) (actual time=0.000..0.000 rows=0 loops=6,679)

  • Index Cond: ("tremID" = trp."trptremID")
49. 0.102 0.212 ↓ 1.1 324 1

Hash (cost=7.05..7.05 rows=305 width=8) (actual time=0.212..0.212 rows=324 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 21kB
50. 0.110 0.110 ↓ 1.1 324 1

Seq Scan on "TabCicloFaturamentoOS" tcfos (cost=0.00..7.05 rows=305 width=8) (actual time=0.004..0.110 rows=324 loops=1)

51. 0.118 0.267 ↓ 1.0 313 1

Hash (cost=22.05..22.05 rows=305 width=26) (actual time=0.267..0.267 rows=313 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 26kB
52. 0.149 0.149 ↓ 1.0 313 1

Seq Scan on "TabCycleTransaction" tct (cost=0.00..22.05 rows=305 width=26) (actual time=0.003..0.149 rows=313 loops=1)

53.          

SubPlan (forWindowAgg)

54. 0.720 2.520 ↑ 1.0 1 360

Aggregate (cost=13.65..13.66 rows=1 width=8) (actual time=0.007..0.007 rows=1 loops=360)

55. 1.800 1.800 ↓ 0.0 0 360

Index Scan using idx_tcdcli_tcdclitrpid on "TabClienteDocumento" (cost=0.29..13.64 rows=3 width=4) (actual time=0.005..0.005 rows=0 loops=360)

  • Index Cond: ("tcdclitrpID" = trp."trpID")
56. 1.080 20.160 ↓ 0.0 0 360

Limit (cost=0.29..15.15 rows=1 width=4) (actual time=0.056..0.056 rows=0 loops=360)

57. 0.720 19.080 ↓ 0.0 0 360

Nested Loop (cost=0.29..15.15 rows=1 width=4) (actual time=0.053..0.053 rows=0 loops=360)

  • Join Filter: (tcd."tcdDocumento" = tdc."tdcdocID")
58. 17.640 17.640 ↓ 2.0 2 360

Seq Scan on "TabDocumentoCliente" tdc (cost=0.00..1.48 rows=1 width=4) (actual time=0.011..0.049 rows=2 loops=360)

  • Filter: ("tdcdocValor" ~~* 'comprovante_pagamento%'::text)
  • Rows Removed by Filter: 36
59. 0.720 0.720 ↓ 0.0 0 720

Index Scan using idx_tcdcli_tcdclitrpid on "TabClienteDocumento" tcd (cost=0.29..13.64 rows=3 width=8) (actual time=0.001..0.001 rows=0 loops=720)

  • Index Cond: ("tcdclitrpID" = trp."trpID")
60. 0.720 14.040 ↓ 0.0 0 360

Limit (cost=0.29..15.15 rows=1 width=4) (actual time=0.039..0.039 rows=0 loops=360)

61. 0.720 13.320 ↓ 0.0 0 360

Nested Loop (cost=0.29..15.15 rows=1 width=4) (actual time=0.037..0.037 rows=0 loops=360)

  • Join Filter: (tcd_1."tcdDocumento" = tdc_1."tdcdocID")
62. 11.880 11.880 ↓ 2.0 2 360

Seq Scan on "TabDocumentoCliente" tdc_1 (cost=0.00..1.48 rows=1 width=4) (actual time=0.029..0.033 rows=2 loops=360)

  • Filter: ("tdcdocValor" ~~* 'nfse%'::text)
  • Rows Removed by Filter: 36
63. 0.720 0.720 ↓ 0.0 0 720

Index Scan using idx_tcdcli_tcdclitrpid on "TabClienteDocumento" tcd_1 (cost=0.29..13.64 rows=3 width=8) (actual time=0.001..0.001 rows=0 loops=720)

  • Index Cond: ("tcdclitrpID" = trp."trpID")
64. 1.440 2,674.440 ↑ 1.0 1 360

Aggregate (cost=2,085.69..2,085.70 rows=1 width=8) (actual time=7.429..7.429 rows=1 loops=360)

65. 2,673.000 2,673.000 ↑ 1.0 2 360

Seq Scan on "TabReceitaParcelaContabil" (cost=0.00..2,085.68 rows=2 width=4) (actual time=1.913..7.425 rows=2 loops=360)

  • Filter: (("trpctrpID" = trp."trpID") AND ("trpcTipo" = 1))
  • Rows Removed by Filter: 89208
66. 1.440 2,515.320 ↑ 1.0 1 360

Aggregate (cost=2,085.69..2,085.70 rows=1 width=8) (actual time=6.986..6.987 rows=1 loops=360)

67. 2,513.880 2,513.880 ↓ 0.0 0 360

Seq Scan on "TabReceitaParcelaContabil" "TabReceitaParcelaContabil_1" (cost=0.00..2,085.68 rows=2 width=4) (actual time=6.983..6.983 rows=0 loops=360)

  • Filter: (("trpctrpID" = trp."trpID") AND ("trpcTipo" = 2))
  • Rows Removed by Filter: 89210
68.          

SubPlan (forSubquery Scan)

69. 0.400 0.400 ↑ 1.0 1 40

Result (cost=0.00..0.01 rows=1 width=32) (actual time=0.009..0.010 rows=1 loops=40)

70. 0.040 0.040 ↑ 1.0 1 40

Result (cost=0.00..0.01 rows=1 width=32) (actual time=0.001..0.001 rows=1 loops=40)

71. 0.040 0.040 ↑ 1.0 1 40

Result (cost=0.00..0.01 rows=1 width=32) (actual time=0.001..0.001 rows=1 loops=40)

72. 0.280 1.200 ↑ 1.0 1 40

Aggregate (cost=30.30..30.31 rows=1 width=8) (actual time=0.030..0.030 rows=1 loops=40)

73. 0.920 0.920 ↓ 1.2 12 40

Index Scan using idx_trp_trecid_trpsubstituida on "TabReceitaParcela" (cost=0.29..30.27 rows=10 width=4) (actual time=0.009..0.023 rows=12 loops=40)

  • Index Cond: (("trptrecID" = r."trecID") AND ("trpSubstituida" = false))
  • Filter: (("trpSubstituida" IS FALSE) AND ("trptrpOriundaID" IS NULL) AND (NOT "trpIsExcluido"))
  • Rows Removed by Filter: 0
74. 0.040 0.040 ↑ 1.0 1 40

Result (cost=0.00..0.01 rows=1 width=32) (actual time=0.001..0.001 rows=1 loops=40)

75. 0.200 97.600 ↑ 1.0 1 40

Aggregate (cost=256.98..256.99 rows=1 width=8) (actual time=2.440..2.440 rows=1 loops=40)

76. 97.400 97.400 ↑ 1.0 1 40

Seq Scan on "TabClienteContato" tcc (cost=0.00..256.98 rows=1 width=4) (actual time=1.048..2.435 rows=1 loops=40)

  • Filter: (("tccTipoContato" @> '{8}'::integer[]) AND ("tcctclID" = r."tclID"))
  • Rows Removed by Filter: 10719
77. 0.040 0.040 ↑ 1.0 1 40

Result (cost=0.00..0.01 rows=1 width=32) (actual time=0.001..0.001 rows=1 loops=40)

78. 0.360 0.360 ↑ 1.0 1 40

Result (cost=0.00..0.02 rows=1 width=32) (actual time=0.009..0.009 rows=1 loops=40)

79. 0.160 0.160 ↑ 1.0 1 40

Result (cost=0.00..0.02 rows=1 width=32) (actual time=0.004..0.004 rows=1 loops=40)

80. 2.200 2.200 ↑ 1,000.0 1 40

Function Scan on proc_comercial_gettipospagamento (cost=0.25..10.25 rows=1,000 width=32) (actual time=0.054..0.055 rows=1 loops=40)

81. 2.400 2.400 ↑ 1.0 1 40

Function Scan on proc_common_countbusinessdays (cost=0.25..0.26 rows=1 width=8) (actual time=0.060..0.060 rows=1 loops=40)

82. 0.200 96.960 ↑ 1.0 1 40

Aggregate (cost=256.96..256.97 rows=1 width=8) (actual time=2.424..2.424 rows=1 loops=40)

83. 96.760 96.760 ↑ 1.0 1 40

Seq Scan on "TabEndereco" (cost=0.00..256.96 rows=1 width=4) (actual time=0.830..2.419 rows=1 loops=40)

  • Filter: (("tenTipoEndereco" @> '{1}'::integer[]) AND ("tentpeID" = r."tpeID"))
  • Rows Removed by Filter: 8253
84. 23.920 23.920 ↑ 1,000.0 1 40

Function Scan on proc_common_getnetxbusinessdays (cost=0.25..10.25 rows=1,000 width=32) (actual time=0.597..0.598 rows=1 loops=40)

85. 0.120 32.720 ↑ 1.0 1 40

Aggregate (cost=203.78..203.79 rows=1 width=8) (actual time=0.818..0.818 rows=1 loops=40)

86. 0.208 32.600 ↑ 1.0 2 40

Nested Loop (cost=0.57..203.78 rows=2 width=4) (actual time=0.498..0.815 rows=2 loops=40)

87. 0.248 31.240 ↓ 2.0 2 40

Nested Loop (cost=0.28..173.41 rows=1 width=4) (actual time=0.326..0.781 rows=2 loops=40)

88. 30.560 30.560 ↓ 2.0 2 40

Seq Scan on "TabReceita" trec_1 (cost=0.00..165.10 rows=1 width=8) (actual time=0.314..0.764 rows=2 loops=40)

  • Filter: ("trectosID" = r."tosID")
  • Rows Removed by Filter: 6344
89. 0.432 0.432 ↑ 1.0 1 72

Index Only Scan using "TabOrdemServico_tosID" on "TabOrdemServico" tos_1 (cost=0.28..8.30 rows=1 width=4) (actual time=0.005..0.006 rows=1 loops=72)

  • Index Cond: ("tosID" = r."tosID")
  • Heap Fetches: 56
90. 1.152 1.152 ↑ 2.0 1 72

Index Scan using idx_trp_trecid_trpsubstituida on "TabReceitaParcela" trp_1 (cost=0.29..30.35 rows=2 width=8) (actual time=0.012..0.016 rows=1 loops=72)

  • Index Cond: (("trptrecID" = trec_1."trecID") AND ("trpSubstituida" = false))
  • Filter: (("trpPago" IS FALSE) AND ("trpBaixada" IS FALSE) AND ("trpSubstituida" IS FALSE) AND (('now'::cstring)::date > "trpDataVencimento"))
  • Rows Removed by Filter: 11
91. 2.680 2.680 ↑ 1,000.0 1 40

Function Scan on proc_comercial_getsituacoesordensservico (cost=0.25..10.25 rows=1,000 width=32) (actual time=0.066..0.067 rows=1 loops=40)