explain.depesz.com

PostgreSQL's explain analyze made readable

Result: CW3h

Settings
# exclusive inclusive rows x rows loops node
1. 0.196 419.031 ↑ 1.0 40 1

WindowAgg (cost=4.27..1,293.12 rows=40 width=444) (actual time=418.992..419.031 rows=40 loops=1)

2. 0.237 418.835 ↑ 1.0 40 1

Subquery Scan on tab1 (cost=4.27..1,292.22 rows=40 width=452) (actual time=31.375..418.835 rows=40 loops=1)

3. 0.019 413.797 ↑ 1.0 40 1

Limit (cost=4.27..1,208.72 rows=40 width=404) (actual time=30.969..413.797 rows=40 loops=1)

4.          

Initplan (forLimit)

5. 0.014 0.014 ↑ 1.0 1 1

Seq Scan on "TabMenuInterno" (cost=0.00..1.58 rows=1 width=32) (actual time=0.012..0.014 rows=1 loops=1)

  • Filter: ("tmiValor" = 'controle_processo'::text)
  • Rows Removed by Filter: 45
6. 0.013 0.013 ↑ 1.0 1 1

Result (cost=0.00..0.01 rows=1 width=8) (actual time=0.012..0.013 rows=1 loops=1)

7. 0.003 0.003 ↑ 1.0 1 1

Result (cost=0.00..0.01 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=1)

8. 0.677 413.748 ↑ 18.2 40 1

Nested Loop (cost=2.67..21,983.77 rows=730 width=404) (actual time=30.967..413.748 rows=40 loops=1)

9. 0.085 4.071 ↑ 18.2 40 1

Nested Loop (cost=2.53..11,682.02 rows=730 width=240) (actual time=0.152..4.071 rows=40 loops=1)

10. 0.048 3.906 ↑ 18.2 40 1

Nested Loop (cost=2.39..11,517.08 rows=730 width=240) (actual time=0.149..3.906 rows=40 loops=1)

11. 0.069 3.698 ↑ 18.2 40 1

Nested Loop (cost=2.12..11,132.80 rows=730 width=240) (actual time=0.143..3.698 rows=40 loops=1)

12. 0.098 3.509 ↑ 18.2 40 1

Nested Loop (cost=1.97..11,004.83 rows=730 width=240) (actual time=0.138..3.509 rows=40 loops=1)

  • Join Filter: (teac."teactsssID" = tsss."tsssID")
  • Rows Removed by Join Filter: 160
13. 0.049 3.331 ↑ 18.2 40 1

Nested Loop (cost=1.97..10,949.02 rows=730 width=212) (actual time=0.125..3.331 rows=40 loops=1)

14. 0.071 3.162 ↑ 18.2 40 1

Nested Loop (cost=1.83..10,817.00 rows=730 width=180) (actual time=0.120..3.162 rows=40 loops=1)

15. 0.108 2.891 ↑ 18.2 40 1

Nested Loop (cost=1.54..10,058.67 rows=730 width=180) (actual time=0.111..2.891 rows=40 loops=1)

  • Join Filter: (tos."tostemID" = tem."temID")
  • Rows Removed by Join Filter: 200
16. 0.076 2.663 ↑ 18.2 40 1

Nested Loop (cost=1.54..9,991.89 rows=730 width=152) (actual time=0.092..2.663 rows=40 loops=1)

17. 0.041 2.387 ↑ 18.2 40 1

Nested Loop (cost=1.26..9,356.41 rows=730 width=136) (actual time=0.085..2.387 rows=40 loops=1)

18. 0.070 2.146 ↑ 18.2 40 1

Nested Loop (cost=0.98..9,110.09 rows=730 width=132) (actual time=0.077..2.146 rows=40 loops=1)

19. 0.070 1.876 ↑ 18.2 40 1

Nested Loop Left Join (cost=0.70..8,880.37 rows=730 width=119) (actual time=0.069..1.876 rows=40 loops=1)

20. 0.108 1.646 ↑ 18.2 40 1

Nested Loop (cost=0.42..8,659.08 rows=730 width=119) (actual time=0.061..1.646 rows=40 loops=1)

21. 1.258 1.258 ↑ 18.2 40 1

Seq Scan on "TabEtapaAssessoriaCliente" teac (cost=0.00..4,268.41 rows=730 width=65) (actual time=0.046..1.258 rows=40 loops=1)

  • Filter: (("teacIs_Excluido" IS FALSE) AND ("teacDataInicio" >= $39) AND ("teacDataInicio" <= $40))
  • Rows Removed by Filter: 6548
22. 0.280 0.280 ↑ 1.0 1 40

Index Scan using "TabAssessoriaCliente_tacID" on "TabAssessoriaCliente" tac (cost=0.42..6.00 rows=1 width=58) (actual time=0.007..0.007 rows=1 loops=40)

  • Index Cond: ("tacID" = teac."teactacID")
23. 0.160 0.160 ↑ 1.0 1 40

Index Only Scan using "TabServico_tseID" on "TabServico" tse (cost=0.28..0.29 rows=1 width=4) (actual time=0.003..0.004 rows=1 loops=40)

  • Index Cond: ("tseID" = tac."tactseID")
  • Heap Fetches: 38
24. 0.200 0.200 ↑ 1.0 1 40

Index Scan using "TabOrdemServico_tosID" on "TabOrdemServico" tos (cost=0.28..0.30 rows=1 width=17) (actual time=0.004..0.005 rows=1 loops=40)

  • Index Cond: ("tosID" = tac."tactosID")
25. 0.200 0.200 ↑ 1.0 1 40

Index Scan using "TabCliente_tclID" on "TabCliente" tcl (cost=0.28..0.33 rows=1 width=8) (actual time=0.004..0.005 rows=1 loops=40)

  • Index Cond: ("tclID" = tos."tostclID")
26. 0.200 0.200 ↑ 1.0 1 40

Index Scan using "TabPessoaID" on "TabPessoa" tpe (cost=0.29..0.86 rows=1 width=24) (actual time=0.004..0.005 rows=1 loops=40)

  • Index Cond: ("tpeID" = tcl."tcltpeID")
27. 0.109 0.120 ↑ 1.0 6 40

Materialize (cost=0.00..1.09 rows=6 width=36) (actual time=0.001..0.003 rows=6 loops=40)

28. 0.011 0.011 ↑ 1.0 6 1

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

29. 0.200 0.200 ↑ 1.0 1 40

Index Scan using "TabPropostaComercial_tpcID" on "TabPropostaComercial" tpc (cost=0.28..1.03 rows=1 width=8) (actual time=0.004..0.005 rows=1 loops=40)

  • Index Cond: ("tpcID" = tos."tostpcID")
30. 0.120 0.120 ↑ 1.0 1 40

Index Scan using "TabAssessoria_tasID" on "TabAssessoria" tas (cost=0.14..0.17 rows=1 width=40) (actual time=0.002..0.003 rows=1 loops=40)

  • Index Cond: ("tasID" = tpc."tpctasID")
31. 0.075 0.080 ↑ 1.0 5 40

Materialize (cost=0.00..1.07 rows=5 width=36) (actual time=0.000..0.002 rows=5 loops=40)

32. 0.005 0.005 ↑ 1.0 5 1

Seq Scan on "TabServiceStepState" tsss (cost=0.00..1.05 rows=5 width=36) (actual time=0.004..0.005 rows=5 loops=1)

33. 0.120 0.120 ↑ 1.0 1 40

Index Scan using "TabUsuarioInterno_tuiID" on "TabUsuarioInterno" tui (cost=0.15..0.17 rows=1 width=8) (actual time=0.002..0.003 rows=1 loops=40)

  • Index Cond: ("tuiID" = tac."tactuiID")
34. 0.160 0.160 ↑ 1.0 1 40

Index Scan using "TabFuncionario_tfuID" on "TabFuncionario" tfu (cost=0.27..0.52 rows=1 width=8) (actual time=0.003..0.004 rows=1 loops=40)

  • Index Cond: ("tfuID" = tui."tuitfuID")
35. 0.080 0.080 ↑ 1.0 1 40

Index Scan using "TabCargoFuncionario_tcfID" on "TabCargoFuncionario" tcf (cost=0.14..0.22 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=40)

  • Index Cond: ("tcfID" = tfu."tfutcfID")
36. 0.120 0.120 ↑ 1.0 1 40

Index Only Scan using "TabDepartamentoID" on "TabDepartamento" tde (cost=0.14..0.25 rows=1 width=4) (actual time=0.002..0.003 rows=1 loops=40)

  • Index Cond: ("tdeID" = tcf."tcftdeID")
  • Heap Fetches: 40
37.          

SubPlan (forNested Loop)

38. 0.160 0.160 ↑ 1.0 1 40

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

39. 0.080 0.080 ↑ 1.0 1 40

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

40. 0.160 200.400 ↑ 1.0 1 40

Aggregate (cost=12.75..12.76 rows=1 width=8) (actual time=5.009..5.010 rows=1 loops=40)

41. 200.240 200.240 ↓ 0.0 0 40

Function Scan on proc_cliente_getsuspensoesassessoria_porminuto (cost=0.25..10.25 rows=1,000 width=4) (actual time=5.006..5.006 rows=0 loops=40)

42. 0.080 199.320 ↓ 0.0 0 40

Limit (cost=0.25..0.26 rows=1 width=8) (actual time=4.983..4.983 rows=0 loops=40)

43. 199.240 199.240 ↓ 0.0 0 40

Function Scan on proc_cliente_getsuspensoesassessoria_porminuto proc_cliente_getsuspensoesassessoria_porminuto_1 (cost=0.25..10.25 rows=1,000 width=8) (actual time=4.981..4.981 rows=0 loops=40)

44. 4.040 4.040 ↑ 1.0 1 40

Function Scan on proc_common_addbusinessdays (cost=0.25..0.26 rows=1 width=4) (actual time=0.101..0.101 rows=1 loops=40)

45. 1.560 4.720 ↑ 1.0 1 40

Function Scan on proc_common_countbusinessdays proc_common_countbusinessdays_2 (cost=0.52..0.53 rows=1 width=8) (actual time=0.117..0.118 rows=1 loops=40)

46.          

Initplan (forFunction Scan)

47. 3.160 3.160 ↑ 1.0 1 40

Function Scan on proc_common_addbusinessdays proc_common_addbusinessdays_1 (cost=0.25..0.26 rows=1 width=4) (actual time=0.078..0.079 rows=1 loops=40)

48. 0.160 0.160 ↑ 1.0 1 40

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

49.          

SubPlan (forSubquery Scan)

50. 0.120 0.120 ↑ 1.0 1 40

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

51. 0.000 0.000 ↓ 0.0 0

Result (cost=0.29..0.31 rows=1 width=32) (never executed)

52.          

Initplan (forResult)

53. 0.000 0.000 ↓ 0.0 0

Function Scan on proc_common_addbusinessdays_byminutes (cost=0.28..0.29 rows=1 width=8) (never executed)

54.          

Initplan (forFunction Scan)

55. 0.000 0.000 ↓ 0.0 0

Result (cost=0.00..0.01 rows=1 width=8) (never executed)

56. 0.016 0.560 ↑ 1.0 1 2

Result (cost=0.30..0.31 rows=1 width=32) (actual time=0.280..0.280 rows=1 loops=2)

57.          

Initplan (forResult)

58. 0.540 0.544 ↑ 1.0 1 2

Function Scan on proc_common_addbusinessdays_byminutes proc_common_addbusinessdays_byminutes_1 (cost=0.29..0.30 rows=1 width=8) (actual time=0.272..0.272 rows=1 loops=2)

59.          

Initplan (forFunction Scan)

60. 0.004 0.004 ↑ 1.0 1 2

Result (cost=0.00..0.01 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=2)

61. 0.000 0.000 ↓ 0.0 0

Result (cost=0.31..0.32 rows=1 width=32) (never executed)

62.          

Initplan (forResult)

63. 0.000 0.000 ↓ 0.0 0

Function Scan on proc_common_addbusinessdays_byminutes proc_common_addbusinessdays_byminutes_2 (cost=0.30..0.31 rows=1 width=8) (never executed)

64.          

Initplan (forFunction Scan)

65. 0.000 0.000 ↓ 0.0 0

Result (cost=0.00..0.01 rows=1 width=8) (never executed)

66. 0.065 1.456 ↑ 1.0 1 13

Result (cost=0.27..0.28 rows=1 width=32) (actual time=0.111..0.112 rows=1 loops=13)

67.          

Initplan (forResult)

68. 1.391 1.391 ↑ 1.0 1 13

Function Scan on proc_common_addbusinessdays_byminutes proc_common_addbusinessdays_byminutes_3 (cost=0.26..0.27 rows=1 width=8) (actual time=0.106..0.107 rows=1 loops=13)

69. 1.143 1.147 ↑ 1.0 1 37

Function Scan on proc_common_countbusinessdays (cost=0.27..0.28 rows=1 width=8) (actual time=0.031..0.031 rows=1 loops=37)

70.          

Initplan (forFunction Scan)

71. 0.004 0.004 ↑ 1.0 1 1

Result (cost=0.00..0.01 rows=1 width=4) (actual time=0.003..0.004 rows=1 loops=1)

72. 0.682 1.518 ↑ 1.0 1 3

Function Scan on proc_common_countbusinessdays proc_common_countbusinessdays_1 (cost=0.56..0.57 rows=1 width=8) (actual time=0.506..0.506 rows=1 loops=3)

73.          

Initplan (forFunction Scan)

74. 0.002 0.002 ↑ 1.0 1 1

Result (cost=0.00..0.01 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=1)

75. 0.828 0.834 ↑ 1.0 1 3

Function Scan on proc_common_addbusinessdays_byminutes proc_common_addbusinessdays_byminutes_4 (cost=0.29..0.30 rows=1 width=8) (actual time=0.278..0.278 rows=1 loops=3)

76.          

Initplan (forFunction Scan)

77. 0.006 0.006 ↑ 1.0 1 3

Result (cost=0.00..0.01 rows=1 width=8) (actual time=0.001..0.002 rows=1 loops=3)

Planning time : 54.339 ms
Execution time : 419.676 ms