explain.depesz.com

PostgreSQL's explain analyze made readable

Result: y1s

Settings
# exclusive inclusive rows x rows loops node
1. 0.952 492.075 ↑ 1.0 40 1

Subquery Scan on r (cost=10,098.83..42,617.49 rows=40 width=1,290) (actual time=259.317..492.075 rows=40 loops=1)

2. 0.077 256.763 ↑ 1.0 40 1

Limit (cost=10,098.83..11,859.47 rows=40 width=1,206) (actual time=252.455..256.763 rows=40 loops=1)

3. 15.570 256.686 ↑ 143.5 40 1

WindowAgg (cost=10,098.83..262,749.89 rows=5,740 width=1,206) (actual time=252.453..256.686 rows=40 loops=1)

4. 11.035 237.076 ↓ 1.2 6,679 1

Group (cost=10,098.83..10,328.43 rows=5,740 width=986) (actual time=218.351..237.076 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
5. 46.317 226.041 ↓ 2.3 13,317 1

Sort (cost=10,098.83..10,113.18 rows=5,740 width=986) (actual time=218.346..226.041 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
  • Sort Method: external merge Disk: 9808kB
6. 8.679 179.724 ↓ 2.3 13,317 1

Hash Left Join (cost=5,192.03..7,248.46 rows=5,740 width=986) (actual time=102.297..179.724 rows=13,317 loops=1)

  • Hash Cond: (tos."tosID" = tcfos."tcfostosID")
7. 47.956 170.364 ↓ 2.3 13,317 1

Hash Right Join (cost=5,151.11..7,182.47 rows=5,740 width=964) (actual time=101.600..170.364 rows=13,317 loops=1)

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

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

9. 12.925 100.361 ↓ 1.8 6,679 1

Hash (cost=5,104.94..5,104.94 rows=3,694 width=964) (actual time=100.361..100.361 rows=6,679 loops=1)

  • Buckets: 8192 (originally 4096) Batches: 2 (originally 1) Memory Usage: 4033kB
10. 7.869 87.436 ↓ 1.8 6,679 1

Hash Left Join (cost=3,523.99..5,104.94 rows=3,694 width=964) (actual time=46.168..87.436 rows=6,679 loops=1)

  • Hash Cond: (trp."trptremID" = trem."tremID")
11. 4.355 78.195 ↓ 1.8 6,679 1

Hash Left Join (cost=3,457.72..5,008.01 rows=3,694 width=955) (actual time=44.772..78.195 rows=6,679 loops=1)

  • Hash Cond: (trp."trpTipoBaixa" = ttb."ttbID")
12. 5.571 73.818 ↓ 1.8 6,679 1

Hash Left Join (cost=3,456.22..4,988.42 rows=3,694 width=923) (actual time=44.740..73.818 rows=6,679 loops=1)

  • Hash Cond: (trp."trptcbID" = tcb."tcbID")
13. 4.494 68.063 ↓ 1.8 6,679 1

Hash Left Join (cost=3,401.60..4,886.58 rows=3,694 width=471) (actual time=44.543..68.063 rows=6,679 loops=1)

  • Hash Cond: (tpc."tpctfuID" = tfu."tfuID")
14. 7.287 52.440 ↓ 1.8 6,679 1

Hash Join (cost=2,714.43..4,148.61 rows=3,694 width=447) (actual time=33.392..52.440 rows=6,679 loops=1)

  • Hash Cond: (trec."trectclID" = tcl."tclID")
15. 5.644 30.155 ↓ 1.8 6,776 1

Hash Join (cost=1,916.88..3,300.37 rows=3,694 width=405) (actual time=18.370..30.155 rows=6,776 loops=1)

  • Hash Cond: (trp."trptrecID" = trec."trecID")
16. 6.320 7.330 ↓ 1.1 7,552 1

Bitmap Heap Scan on "TabReceitaParcela" trp (cost=353.94..1,675.11 rows=6,769 width=294) (actual time=1.144..7.330 rows=7,552 loops=1)

  • Filter: ((NOT "trpBaixada") AND (NOT "trpSubstituida") AND (NOT "trpPago") AND (NOT "trpEmitidoRemessa") AND ("trpIsExcluido" IS FALSE))
  • Rows Removed by Filter: 2212
  • Heap Blocks: exact=986
17. 1.010 1.010 ↑ 1.4 10,420 1

Bitmap Index Scan on idx_trp_trppago_trpsubstituida_trpbaixada_trpdatavencimento (cost=0.00..352.25 rows=14,717 width=0) (actual time=1.009..1.010 rows=10,420 loops=1)

  • Index Cond: (("trpPago" = false) AND ("trpSubstituida" = false) AND ("trpBaixada" = false))
18. 1.750 17.181 ↑ 1.0 3,437 1

Hash (cost=1,519.77..1,519.77 rows=3,453 width=111) (actual time=17.181..17.181 rows=3,437 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 491kB
19. 4.007 15.431 ↑ 1.0 3,437 1

Hash Right Join (cost=513.91..1,519.77 rows=3,453 width=111) (actual time=8.970..15.431 rows=3,437 loops=1)

  • Hash Cond: (tpc."tpcID" = tos."tostpcID")
20. 2.495 2.495 ↓ 1.0 6,667 1

Seq Scan on "TabPropostaComercial" tpc (cost=0.00..946.42 rows=6,642 width=38) (actual time=0.004..2.495 rows=6,667 loops=1)

21. 1.467 8.929 ↑ 1.0 3,437 1

Hash (cost=470.75..470.75 rows=3,453 width=77) (actual time=8.929..8.929 rows=3,437 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 372kB
22. 2.066 7.462 ↑ 1.0 3,437 1

Hash Left Join (cost=258.26..470.75 rows=3,453 width=77) (actual time=3.820..7.462 rows=3,437 loops=1)

  • Hash Cond: (trec."trectosID" = tos."tosID")
23. 1.631 1.631 ↑ 1.0 3,437 1

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

  • Filter: ("trectemID" = 1)
  • Rows Removed by Filter: 2909
24. 1.584 3.765 ↓ 1.0 4,993 1

Hash (cost=196.45..196.45 rows=4,945 width=27) (actual time=3.765..3.765 rows=4,993 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 288kB
25. 2.181 2.181 ↓ 1.0 4,993 1

Seq Scan on "TabOrdemServico" tos (cost=0.00..196.45 rows=4,945 width=27) (actual time=0.007..2.181 rows=4,993 loops=1)

26. 1.323 14.998 ↑ 1.0 2,879 1

Hash (cost=760.74..760.74 rows=2,945 width=46) (actual time=14.998..14.998 rows=2,879 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 291kB
27. 6.379 13.675 ↑ 1.0 2,879 1

Hash Join (cost=93.26..760.74 rows=2,945 width=46) (actual time=1.833..13.675 rows=2,879 loops=1)

  • Hash Cond: (tpe."tpeID" = tcl."tcltpeID")
28. 5.514 5.514 ↑ 1.0 20,482 1

Seq Scan on "TabPessoa" tpe (cost=0.00..559.20 rows=21,020 width=42) (actual time=0.010..5.514 rows=20,482 loops=1)

29. 0.908 1.782 ↑ 1.0 2,879 1

Hash (cost=56.45..56.45 rows=2,945 width=8) (actual time=1.782..1.782 rows=2,879 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 145kB
30. 0.874 0.874 ↑ 1.0 2,879 1

Seq Scan on "TabCliente" tcl (cost=0.00..56.45 rows=2,945 width=8) (actual time=0.006..0.874 rows=2,879 loops=1)

31. 0.111 11.129 ↑ 1.0 286 1

Hash (cost=683.59..683.59 rows=286 width=28) (actual time=11.128..11.129 rows=286 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 28kB
32. 4.924 11.018 ↑ 1.0 286 1

Hash Right Join (cost=16.43..683.59 rows=286 width=28) (actual time=0.208..11.018 rows=286 loops=1)

  • Hash Cond: (tpe_funcionario."tpeID" = tfu."tfutpeID")
33. 5.911 5.911 ↑ 1.0 20,482 1

Seq Scan on "TabPessoa" tpe_funcionario (cost=0.00..559.20 rows=21,020 width=24) (actual time=0.005..5.911 rows=20,482 loops=1)

34. 0.085 0.183 ↑ 1.0 286 1

Hash (cost=12.86..12.86 rows=286 width=8) (actual time=0.183..0.183 rows=286 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 20kB
35. 0.098 0.098 ↑ 1.0 286 1

Seq Scan on "TabFuncionario" tfu (cost=0.00..12.86 rows=286 width=8) (actual time=0.006..0.098 rows=286 loops=1)

36. 0.014 0.184 ↓ 1.4 15 1

Hash (cost=54.49..54.49 rows=11 width=456) (actual time=0.184..0.184 rows=15 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 13kB
37. 0.024 0.170 ↓ 1.4 15 1

Hash Right Join (cost=3.74..54.49 rows=11 width=456) (actual time=0.132..0.170 rows=15 loops=1)

  • Hash Cond: (tem."temID" = tcb."tcbtemID")
38. 0.011 0.047 ↑ 1.0 6 1

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

39. 0.006 0.006 ↑ 1.0 6 1

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

40. 0.030 0.030 ↑ 1.0 1 6

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

  • Index Cond: ("tpeID" = tem."temtpeID")
41. 0.018 0.099 ↓ 1.4 15 1

Hash (cost=3.32..3.32 rows=11 width=420) (actual time=0.099..0.099 rows=15 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 12kB
42. 0.020 0.081 ↓ 1.4 15 1

Hash Left Join (cost=2.15..3.32 rows=11 width=420) (actual time=0.069..0.081 rows=15 loops=1)

  • Hash Cond: (tcb."tcbtbcID" = tbc."tbcID")
43. 0.010 0.010 ↓ 1.4 15 1

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

44. 0.006 0.051 ↑ 1.0 2 1

Hash (cost=2.12..2.12 rows=2 width=44) (actual time=0.051..0.051 rows=2 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
45. 0.020 0.045 ↑ 1.0 2 1

Hash Right Join (cost=1.04..2.12 rows=2 width=44) (actual time=0.042..0.045 rows=2 loops=1)

  • Hash Cond: (tba."tbaID" = tbc."tbctbaID")
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.004 0.020 ↑ 1.0 2 1

Hash (cost=1.02..1.02 rows=2 width=40) (actual time=0.020..0.020 rows=2 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
48. 0.016 0.016 ↑ 1.0 2 1

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

49. 0.011 0.022 ↑ 1.0 22 1

Hash (cost=1.22..1.22 rows=22 width=36) (actual time=0.021..0.022 rows=22 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
50. 0.011 0.011 ↑ 1.0 22 1

Seq Scan on "TabTipoBaixa" ttb (cost=0.00..1.22 rows=22 width=36) (actual time=0.005..0.011 rows=22 loops=1)

51. 0.714 1.372 ↓ 1.0 2,240 1

Hash (cost=38.90..38.90 rows=2,190 width=13) (actual time=1.372..1.372 rows=2,240 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 137kB
52. 0.658 0.658 ↓ 1.0 2,240 1

Seq Scan on "TabRemessa" trem (cost=0.00..38.90 rows=2,190 width=13) (actual time=0.007..0.658 rows=2,240 loops=1)

53. 0.120 0.681 ↓ 1.1 334 1

Hash (cost=37.11..37.11 rows=305 width=26) (actual time=0.680..0.681 rows=334 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 26kB
54. 0.238 0.561 ↓ 1.1 334 1

Hash Right Join (cost=10.86..37.11 rows=305 width=26) (actual time=0.234..0.561 rows=334 loops=1)

  • Hash Cond: (tct."tcttcfosID" = tcfos."tcfosID")
55. 0.106 0.106 ↓ 1.0 313 1

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

56. 0.098 0.217 ↓ 1.1 324 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 21kB
57. 0.119 0.119 ↓ 1.1 324 1

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

58.          

SubPlan (forWindowAgg)

59. 0.080 0.240 ↑ 1.0 1 40

Aggregate (cost=13.65..13.66 rows=1 width=8) (actual time=0.005..0.006 rows=1 loops=40)

60. 0.160 0.160 ↓ 0.0 0 40

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

  • Index Cond: ("tcdclitrpID" = trp."trpID")
61. 0.080 2.200 ↓ 0.0 0 40

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

62. 0.040 2.120 ↓ 0.0 0 40

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

  • Join Filter: (tcd."tcdDocumento" = tdc."tdcdocID")
63. 1.920 1.920 ↓ 2.0 2 40

Seq Scan on "TabDocumentoCliente" tdc (cost=0.00..1.48 rows=1 width=4) (actual time=0.010..0.048 rows=2 loops=40)

  • Filter: ("tdcdocValor" ~~* 'comprovante_pagamento%'::text)
  • Rows Removed by Filter: 36
64. 0.160 0.160 ↓ 0.0 0 80

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

  • Index Cond: ("tcdclitrpID" = trp."trpID")
65. 0.040 1.600 ↓ 0.0 0 40

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

66. 0.080 1.560 ↓ 0.0 0 40

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

  • Join Filter: (tcd_1."tcdDocumento" = tdc_1."tdcdocID")
67. 1.400 1.400 ↓ 2.0 2 40

Seq Scan on "TabDocumentoCliente" tdc_1 (cost=0.00..1.48 rows=1 width=4) (actual time=0.030..0.035 rows=2 loops=40)

  • Filter: ("tdcdocValor" ~~* 'nfse%'::text)
  • Rows Removed by Filter: 36
68. 0.080 0.080 ↓ 0.0 0 80

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=80)

  • Index Cond: ("tcdclitrpID" = trp."trpID")
69.          

SubPlan (forSubquery Scan)

70. 0.200 0.200 ↑ 1.0 1 40

Result (cost=0.00..0.01 rows=1 width=32) (actual time=0.005..0.005 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.000..0.001 rows=1 loops=40)

72. 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)

73. 0.280 1.360 ↑ 1.0 1 40

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

74. 1.080 1.080 ↓ 2.2 22 40

Index Scan using idx_trp_trecid_trpsubstituida on "TabReceitaParcela" (cost=0.29..30.27 rows=10 width=4) (actual time=0.006..0.027 rows=22 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
75. 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)

76. 0.120 92.320 ↑ 1.0 1 40

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

77. 92.200 92.200 ↑ 1.0 1 40

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

  • Filter: (("tccTipoContato" @> '{8}'::integer[]) AND ("tcctclID" = r."tclID"))
  • Rows Removed by Filter: 10719
78. 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)

79. 0.200 0.200 ↑ 1.0 1 40

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

80. 0.080 0.080 ↑ 1.0 1 40

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

81. 1.560 1.560 ↑ 1,000.0 1 40

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

82. 1.760 1.760 ↑ 1.0 1 40

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

83. 0.120 88.920 ↑ 1.0 1 40

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

84. 88.800 88.800 ↑ 1.0 1 40

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

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

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

86. 0.160 29.520 ↑ 1.0 1 40

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

87. 0.158 29.360 ↑ 1.0 2 40

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

88. 0.195 28.320 ↑ 1.0 1 40

Nested Loop (cost=0.28..173.41 rows=1 width=4) (actual time=0.234..0.708 rows=1 loops=40)

89. 27.880 27.880 ↑ 1.0 1 40

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

  • Filter: ("trectosID" = r."tosID")
  • Rows Removed by Filter: 6345
90. 0.245 0.245 ↑ 1.0 1 49

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

  • Index Cond: ("tosID" = r."tosID")
  • Heap Fetches: 37
91. 0.882 0.882 ↑ 1.0 2 49

Index Scan using idx_trp_trecid_trpsubstituida on "TabReceitaParcela" trp_1 (cost=0.29..30.35 rows=2 width=8) (actual time=0.010..0.018 rows=2 loops=49)

  • Index Cond: (("trptrecID" = trec_1."trecID") AND ("trpSubstituida" = false))
  • Filter: (("trpPago" IS FALSE) AND ("trpSubstituida" IS FALSE) AND (('now'::cstring)::date > "trpDataVencimento"))
  • Rows Removed by Filter: 18