explain.depesz.com

PostgreSQL's explain analyze made readable

Result: W7q7

Settings
# exclusive inclusive rows x rows loops node
1. 97.397 4,303.614 ↓ 267.2 6,679 1

Subquery Scan on r (cost=2,203.20..4,327.29 rows=25 width=1,074) (actual time=274.072..4,303.614 rows=6,679 loops=1)

2. 26.561 292.323 ↓ 267.2 6,679 1

WindowAgg (cost=2,203.20..2,204.51 rows=25 width=807) (actual time=272.912..292.323 rows=6,679 loops=1)

3. 7.658 265.762 ↓ 267.2 6,679 1

Group (cost=2,203.20..2,204.20 rows=25 width=758) (actual time=255.805..265.762 rows=6,679 loops=1)

  • Group Key: trp."trpID", tpe."tpeID", tcl."tclID", tos."tosID", tpc."tpcID", tcb."tcbID", tbc."tbcID", tba."tbaID", trec."trecID", ttb."ttbID", trem."tremID", tfu."tfuID", tpe_funcionario."tpeID", tct."tctID", tlsos."tlsosSituacao
4. 12.535 258.104 ↓ 267.2 6,679 1

Sort (cost=2,203.20..2,203.26 rows=25 width=758) (actual time=255.801..258.104 rows=6,679 loops=1)

  • Sort Key: trp."trpID", tpe."tpeID", tcl."tclID", tos."tosID", tpc."tpcID", tcb."tcbID", tbc."tbcID", tba."tbaID", trec."trecID", ttb."ttbID", trem."tremID", tfu."tfuID", tpe_funcionario."tpeID", tct."tctID", tlsos."tlsosSituacao
  • Sort Method: quicksort Memory: 3622kB
5. 4.750 245.569 ↓ 267.2 6,679 1

Hash Left Join (cost=252.49..2,202.62 rows=25 width=758) (actual time=4.011..245.569 rows=6,679 loops=1)

  • Hash Cond: (tcfos."tcfosID" = tct."tcttcfosID")
6. 4.884 240.529 ↓ 267.2 6,679 1

Hash Left Join (cost=226.62..2,176.38 rows=25 width=740) (actual time=3.714..240.529 rows=6,679 loops=1)

  • Hash Cond: (tos."tosID" = tcfos."tcfostosID")
7. 8.622 235.437 ↓ 267.2 6,679 1

Nested Loop Left Join (cost=215.76..2,165.41 rows=25 width=736) (actual time=3.500..235.437 rows=6,679 loops=1)

8. 4.784 226.815 ↓ 267.2 6,679 1

Hash Left Join (cost=215.48..2,157.34 rows=25 width=727) (actual time=3.498..226.815 rows=6,679 loops=1)

  • Hash Cond: (trp."trpTipoBaixa" = ttb."ttbID")
9. 6.557 221.995 ↓ 267.2 6,679 1

Hash Left Join (cost=213.99..2,155.72 rows=25 width=695) (actual time=3.456..221.995 rows=6,679 loops=1)

  • Hash Cond: (trp."trptcbID" = tcb."tcbID")
10. 6.048 215.357 ↓ 267.2 6,679 1

Nested Loop (cost=210.53..2,151.94 rows=25 width=475) (actual time=3.368..215.357 rows=6,679 loops=1)

11. 4.903 122.482 ↓ 109.5 6,679 1

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

12. 3.547 86.799 ↓ 60.0 3,420 1

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

13. 2.936 76.412 ↓ 60.0 3,420 1

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

14. 2.722 66.636 ↓ 60.0 3,420 1

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

15. 4.809 57.074 ↓ 60.0 3,420 1

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

16. 4.194 45.425 ↓ 60.0 3,420 1

Nested Loop (cost=208.83..1,642.41 rows=57 width=81) (actual time=3.263..45.425 rows=3,420 loops=1)

17. 3.659 34.391 ↓ 60.0 3,420 1

Hash Join (cost=208.55..1,613.52 rows=57 width=62) (actual time=3.257..34.391 rows=3,420 loops=1)

  • Hash Cond: (tlsos."tlsostosID" = trec."trectosID")
18. 5.219 27.529 ↓ 60.9 4,994 1

Subquery Scan on tlsos (cost=0.29..1,403.97 rows=82 width=8) (actual time=0.019..27.529 rows=4,994 loops=1)

  • Filter: (tlsos.rr = 1)
  • Rows Removed by Filter: 11378
19. 14.246 22.310 ↑ 1.0 16,372 1

WindowAgg (cost=0.29..1,198.93 rows=16,403 width=20) (actual time=0.014..22.310 rows=16,372 loops=1)

20. 8.064 8.064 ↑ 1.0 16,372 1

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

21. 1.411 3.203 ↑ 1.0 3,420 1

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

  • Buckets: 4096 Batches: 1 Memory Usage: 317kB
22. 1.792 1.792 ↑ 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.792 rows=3,437 loops=1)

  • Filter: ("trectemID" = 1)
  • Rows Removed by Filter: 2910
23. 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")
24. 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")
25. 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")
26. 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")
27. 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.002..0.002 rows=1 loops=3,420)

  • Index Cond: ("tclID" = trec."trectclID")
28. 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
29. 86.827 86.827 ↑ 1.0 1 6,679

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

  • Index Cond: ("tpeID" = tcl."tcltpeID")
  • Filter: (("tpeCNPJCPF" ~~* '%%'::text) AND (proc_common_remove_acento("tpeNome") ~~* '%%'::text))
30. 0.014 0.081 ↓ 1.4 15 1

Hash (cost=3.32..3.32 rows=11 width=224) (actual time=0.080..0.081 rows=15 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
31. 0.018 0.067 ↓ 1.4 15 1

Hash Left Join (cost=2.15..3.32 rows=11 width=224) (actual time=0.041..0.067 rows=15 loops=1)

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

Seq Scan on "TabContaBancaria" tcb (cost=0.00..1.11 rows=11 width=184) (actual time=0.005..0.020 rows=15 loops=1)

33. 0.004 0.029 ↑ 1.0 2 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
34. 0.015 0.025 ↑ 1.0 2 1

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

  • Hash Cond: (tba."tbaID" = tbc."tbctbaID")
35. 0.003 0.003 ↑ 1.0 4 1

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

36. 0.004 0.007 ↑ 1.0 2 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
37. 0.003 0.003 ↑ 1.0 2 1

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

38. 0.008 0.036 ↑ 1.0 22 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
39. 0.028 0.028 ↑ 1.0 22 1

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

40. 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")
41. 0.089 0.208 ↓ 1.1 324 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 21kB
42. 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.004..0.119 rows=324 loops=1)

43. 0.099 0.290 ↓ 1.0 313 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 26kB
44. 0.191 0.191 ↓ 1.0 313 1

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

45.          

SubPlan (forSubquery Scan)

46. 20.037 20.037 ↑ 1.0 1 6,679

Result (cost=0.00..0.01 rows=1 width=32) (actual time=0.003..0.003 rows=1 loops=6,679)

47. 6.679 6.679 ↑ 1.0 1 6,679

Result (cost=0.00..0.01 rows=1 width=32) (actual time=0.000..0.001 rows=1 loops=6,679)

48. 6.679 6.679 ↑ 1.0 1 6,679

Result (cost=0.00..0.01 rows=1 width=32) (actual time=0.000..0.001 rows=1 loops=6,679)

49. 40.074 153.617 ↑ 1.0 1 6,679

Aggregate (cost=30.30..30.31 rows=1 width=8) (actual time=0.022..0.023 rows=1 loops=6,679)

50. 113.543 113.543 ↓ 1.3 13 6,679

Index Scan using idx_trp_trecid_trpsubstituida on "TabReceitaParcela" (cost=0.29..30.27 rows=10 width=4) (actual time=0.007..0.017 rows=13 loops=6,679)

  • Index Cond: (("trptrecID" = r."trecID") AND ("trpSubstituida" = false))
  • Filter: (("trpSubstituida" IS FALSE) AND ("trptrpOriundaID" IS NULL) AND (NOT "trpIsExcluido"))
  • Rows Removed by Filter: 0
51. 6.679 6.679 ↑ 1.0 1 6,679

Result (cost=0.00..0.01 rows=1 width=32) (actual time=0.000..0.001 rows=1 loops=6,679)

52. 6.679 6.679 ↑ 1.0 1 6,679

Result (cost=0.00..0.01 rows=1 width=32) (actual time=0.000..0.001 rows=1 loops=6,679)

53. 26.716 26.716 ↑ 1.0 1 6,679

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

54. 20.037 20.037 ↑ 1.0 1 6,679

Result (cost=0.00..0.02 rows=1 width=32) (actual time=0.002..0.003 rows=1 loops=6,679)

55. 6.679 26.716 ↑ 1.0 1 6,679

Aggregate (cost=13.65..13.66 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=6,679)

56. 20.037 20.037 ↓ 0.0 0 6,679

Index Scan using idx_tcdcli_tcdclitrpid on "TabClienteDocumento" (cost=0.29..13.64 rows=3 width=4) (actual time=0.003..0.003 rows=0 loops=6,679)

  • Index Cond: ("tcdclitrpID" = r."trpID")
57. 13.358 353.987 ↓ 0.0 0 6,679

Limit (cost=0.29..15.15 rows=1 width=4) (actual time=0.053..0.053 rows=0 loops=6,679)

58. 13.358 340.629 ↓ 0.0 0 6,679

Nested Loop (cost=0.29..15.15 rows=1 width=4) (actual time=0.051..0.051 rows=0 loops=6,679)

  • Join Filter: (tcd."tcdDocumento" = tdc."tdcdocID")
  • Rows Removed by Join Filter: 0
59. 313.913 313.913 ↓ 2.0 2 6,679

Seq Scan on "TabDocumentoCliente" tdc (cost=0.00..1.48 rows=1 width=4) (actual time=0.009..0.047 rows=2 loops=6,679)

  • Filter: ("tdcdocValor" ~~* 'comprovante_pagamento%'::text)
  • Rows Removed by Filter: 36
60. 13.358 13.358 ↓ 0.0 0 13,358

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=13,358)

  • Index Cond: ("tcdclitrpID" = r."trpID")
61. 6.679 260.481 ↓ 0.0 0 6,679

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

62. 13.358 253.802 ↓ 0.0 0 6,679

Nested Loop (cost=0.29..15.15 rows=1 width=4) (actual time=0.038..0.038 rows=0 loops=6,679)

  • Join Filter: (tcd_1."tcdDocumento" = tdc_1."tdcdocID")
  • Rows Removed by Join Filter: 0
63. 227.086 227.086 ↓ 2.0 2 6,679

Seq Scan on "TabDocumentoCliente" tdc_1 (cost=0.00..1.48 rows=1 width=4) (actual time=0.029..0.034 rows=2 loops=6,679)

  • Filter: ("tdcdocValor" ~~* 'nfse%'::text)
  • Rows Removed by Filter: 36
64. 13.358 13.358 ↓ 0.0 0 13,358

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=13,358)

  • Index Cond: ("tcdclitrpID" = r."trpID")
65. 227.086 227.086 ↑ 1.0 1 6,679

Function Scan on proc_common_countbusinessdays (cost=0.25..0.26 rows=1 width=8) (actual time=0.034..0.034 rows=1 loops=6,679)

66. 2,798.501 2,798.501 ↑ 1,000.0 1 6,679

Function Scan on proc_common_getnetxbusinessdays (cost=0.25..10.25 rows=1,000 width=32) (actual time=0.418..0.419 rows=1 loops=6,679)

Planning time : 5.993 ms
Execution time : 4,306.949 ms