explain.depesz.com

PostgreSQL's explain analyze made readable

Result: hlYt : Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: plan #3HiS; plan #ZCGu; plan #GKJL; plan #Y6VX; plan #9lxI

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.086 47,071.663 ↓ 13.3 40 1

Limit (cost=16,273.74..16,273.83 rows=3 width=59) (actual time=47,071.567..47,071.663 rows=40 loops=1)

2. 0.523 47,071.577 ↓ 13.3 40 1

WindowAgg (cost=16,273.74..16,273.83 rows=3 width=59) (actual time=47,071.564..47,071.577 rows=40 loops=1)

3. 1.034 47,071.054 ↓ 339.7 1,019 1

Group (cost=16,273.74..16,273.80 rows=3 width=51) (actual time=47,069.540..47,071.054 rows=1,019 loops=1)

  • Group Key: tpe."tpeNome", tcl."tclID", tpe."tpeCNPJCPF", tpe."tpeTipoPessoa", tsc."tscMes", tsc."tscAno", tos."tosAtendimentoSuspenso
4. 5.338 47,070.020 ↓ 677.0 2,031 1

Sort (cost=16,273.74..16,273.74 rows=3 width=51) (actual time=47,069.538..47,070.020 rows=2,031 loops=1)

  • Sort Key: tpe."tpeNome", tcl."tclID", tpe."tpeCNPJCPF", tpe."tpeTipoPessoa", tsc."tscMes", tsc."tscAno", tos."tosAtendimentoSuspenso
  • Sort Method: quicksort Memory: 334kB
5. 0.747 47,064.682 ↓ 677.0 2,031 1

Append (cost=8,199.20..16,273.71 rows=3 width=51) (actual time=4,490.810..47,064.682 rows=2,031 loops=1)

6. 0.601 4,491.738 ↓ 1,015.0 1,015 1

Unique (cost=8,199.20..8,199.22 rows=1 width=51) (actual time=4,490.809..4,491.738 rows=1,015 loops=1)

7. 1.862 4,491.137 ↓ 1,048.0 1,048 1

Sort (cost=8,199.20..8,199.20 rows=1 width=51) (actual time=4,490.808..4,491.137 rows=1,048 loops=1)

  • Sort Key: tcl."tclID", tpe."tpeNome", tpe."tpeCNPJCPF", tpe."tpeTipoPessoa", tos."tosAtendimentoSuspenso
  • Sort Method: quicksort Memory: 196kB
8. 520.197 4,489.275 ↓ 1,048.0 1,048 1

Nested Loop (cost=5,234.19..8,199.19 rows=1 width=51) (actual time=185.685..4,489.275 rows=1,048 loops=1)

  • Join Filter: (tos."tostclID" = thrfc."thrfctclID")
  • Rows Removed by Join Filter: 2088907
9. 1.529 210.113 ↓ 1,055.0 1,055 1

Nested Loop (cost=5,058.63..7,945.14 rows=1 width=55) (actual time=180.564..210.113 rows=1,055 loops=1)

10. 41.933 182.209 ↓ 1,055.0 1,055 1

Hash Right Join (cost=5,058.35..7,942.17 rows=1 width=21) (actual time=180.454..182.209 rows=1,055 loops=1)

  • Hash Cond: (tsl2."tsltscID" = tsc."tscID")
  • Join Filter: ((tsl."tslDataHora" < tsl2."tslDataHora") OR ((tsl."tslDataHora" = tsl2."tslDataHora") AND (tsl."tsltscID" < tsl2."tsltscID")))
  • Rows Removed by Join Filter: 17891
  • Filter: (tsl2."tslID" IS NULL)
  • Rows Removed by Filter: 12587
11. 31.216 31.216 ↑ 1.0 136,578 1

Seq Scan on "TabSICILogAlteracaoSituacao" tsl2 (cost=0.00..2,371.00 rows=136,600 width=16) (actual time=0.012..31.216 rows=136,578 loops=1)

12. 2.079 109.060 ↓ 884.0 5,304 1

Hash (cost=5,058.27..5,058.27 rows=6 width=37) (actual time=109.060..109.060 rows=5,304 loops=1)

  • Buckets: 8192 (originally 1024) Batches: 1 (originally 1) Memory Usage: 437kB
13. 36.289 106.981 ↓ 884.0 5,304 1

Hash Join (cost=2,174.96..5,058.27 rows=6 width=37) (actual time=40.156..106.981 rows=5,304 loops=1)

  • Hash Cond: (tsl."tsltscID" = tsc."tscID")
14. 31.046 31.046 ↑ 1.0 136,578 1

Seq Scan on "TabSICILogAlteracaoSituacao" tsl (cost=0.00..2,371.00 rows=136,600 width=12) (actual time=0.013..31.046 rows=136,578 loops=1)

15. 0.555 39.646 ↓ 1,055.0 1,055 1

Hash (cost=2,174.95..2,174.95 rows=1 width=25) (actual time=39.646..39.646 rows=1,055 loops=1)

  • Buckets: 2048 (originally 1024) Batches: 1 (originally 1) Memory Usage: 78kB
16. 1.184 39.091 ↓ 1,055.0 1,055 1

Nested Loop Anti Join (cost=1.56..2,174.95 rows=1 width=25) (actual time=5.465..39.091 rows=1,055 loops=1)

17. 1.332 31.577 ↓ 1,055.0 1,055 1

Nested Loop (cost=1.27..2,172.44 rows=1 width=41) (actual time=5.064..31.577 rows=1,055 loops=1)

  • Join Filter: (tos."tosID" = tlsos."tlsostosID")
18. 1.006 20.025 ↓ 1,022.0 1,022 1

Nested Loop (cost=0.98..2,169.52 rows=1 width=33) (actual time=4.637..20.025 rows=1,022 loops=1)

19. 1.193 16.975 ↓ 1,022.0 1,022 1

Nested Loop (cost=0.70..2,167.36 rows=1 width=25) (actual time=4.631..16.975 rows=1,022 loops=1)

20. 2.699 13.738 ↓ 1,022.0 1,022 1

Nested Loop (cost=0.42..2,164.94 rows=1 width=16) (actual time=4.622..13.738 rows=1,022 loops=1)

  • Join Filter: (tac."tactseID" = tse."tseID")
  • Rows Removed by Join Filter: 6132
21. 0.776 7.973 ↓ 5.8 1,022 1

Nested Loop (cost=0.42..2,126.39 rows=175 width=20) (actual time=3.522..7.973 rows=1,022 loops=1)

22. 4.131 4.131 ↓ 5.8 1,022 1

Seq Scan on "TabSICIColetaMensal" tsc (cost=0.00..652.08 rows=175 width=16) (actual time=3.509..4.131 rows=1,022 loops=1)

  • Filter: (("tscIsExcluido" IS FALSE) AND ("tscMes" = 3) AND ("tscAno" = 2019))
  • Rows Removed by Filter: 23563
23. 3.066 3.066 ↑ 1.0 1 1,022

Index Scan using "TabAssessoriaCliente_tacID" on "TabAssessoriaCliente" tac (cost=0.42..8.41 rows=1 width=12) (actual time=0.002..0.003 rows=1 loops=1,022)

  • Index Cond: ("tacID" = tsc."tsctacID")
24. 1.326 3.066 ↓ 1.8 7 1,022

Materialize (cost=0.00..28.06 rows=4 width=4) (actual time=0.001..0.003 rows=7 loops=1,022)

25. 1.740 1.740 ↓ 1.8 7 1

Seq Scan on "TabServico" tse (cost=0.00..28.04 rows=4 width=4) (actual time=1.086..1.740 rows=7 loops=1)

  • Filter: ("tseSistemaAgregado" = 1)
  • Rows Removed by Filter: 810
26. 2.044 2.044 ↑ 1.0 1 1,022

Index Scan using "TabOrdemServico_tosID" on "TabOrdemServico" tos (cost=0.28..2.41 rows=1 width=9) (actual time=0.002..0.002 rows=1 loops=1,022)

  • Index Cond: ("tosID" = tac."tactosID")
27. 2.044 2.044 ↑ 1.0 1 1,022

Index Scan using "TabCliente_tclID" on "TabCliente" tcl (cost=0.28..2.15 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=1,022)

  • Index Cond: ("tclID" = tos."tostclID")
28. 10.220 10.220 ↑ 1.0 1 1,022

Index Scan using idx_tlsos_tosid on "TabLogSituacaoOrdemServico" tlsos (cost=0.29..2.91 rows=1 width=16) (actual time=0.010..0.010 rows=1 loops=1,022)

  • Index Cond: ("tlsostosID" = tac."tactosID")
  • Filter: ("tlsosSituacao" = ANY ('{3,7,9}'::integer[]))
  • Rows Removed by Filter: 3
29. 6.330 6.330 ↓ 0.0 0 1,055

Index Scan using "TabLogSituacaoOrdemServico_tlsosID" on "TabLogSituacaoOrdemServico" tlsos2 (cost=0.29..2.49 rows=1 width=16) (actual time=0.006..0.006 rows=0 loops=1,055)

  • Index Cond: ("tlsosID" = tlsos."tlsosID")
  • Filter: ((tlsos."tlsosDataHora" < "tlsosDataHora") OR ((tlsos."tlsosDataHora" = "tlsosDataHora") AND (tlsos."tlsostosID" < "tlsostosID")))
  • Rows Removed by Filter: 1
30. 26.375 26.375 ↑ 1.0 1 1,055

Index Scan using "TabPessoaID" on "TabPessoa" tpe (cost=0.29..2.96 rows=1 width=42) (actual time=0.023..0.025 rows=1 loops=1,055)

  • Index Cond: ("tpeID" = tcl."tcltpeID")
  • Filter: ((COALESCE("tpeCNPJCPF", ''::text) ~~* '%%'::text) AND (proc_common_remove_acento("tpeNome") ~~* '%%'::text))
31. 1,052.890 3,758.965 ↓ 180.1 1,981 1,055

Subquery Scan on thrfc (cost=175.55..253.91 rows=11 width=4) (actual time=0.004..3.563 rows=1,981 loops=1,055)

  • Filter: ((thrfc."thrfcIs_Excluido" IS FALSE) AND (thrfc.r = 1))
  • Rows Removed by Filter: 462
32. 2,060.415 2,706.075 ↓ 1.0 2,443 1,055

WindowAgg (cost=175.55..223.77 rows=2,411 width=33) (actual time=0.003..2.565 rows=2,443 loops=1,055)

33. 644.875 645.660 ↓ 1.0 2,443 1,055

Sort (cost=175.55..181.58 rows=2,411 width=9) (actual time=0.002..0.612 rows=2,443 loops=1,055)

  • Sort Key: "TabHistoricoRegimeFiscalCliente"."thrfctclID", "TabHistoricoRegimeFiscalCliente"."thrfcID" DESC
  • Sort Method: quicksort Memory: 211kB
34. 0.785 0.785 ↓ 1.0 2,443 1

Seq Scan on "TabHistoricoRegimeFiscalCliente" (cost=0.00..40.11 rows=2,411 width=9) (actual time=0.013..0.785 rows=2,443 loops=1)

35. 0.548 42,520.960 ↓ 1,015.0 1,015 1

Unique (cost=6,297.59..6,297.61 rows=1 width=51) (actual time=42,520.111..42,520.960 rows=1,015 loops=1)

36. 3.241 42,520.412 ↓ 1,015.0 1,015 1

Sort (cost=6,297.59..6,297.60 rows=1 width=51) (actual time=42,520.109..42,520.412 rows=1,015 loops=1)

  • Sort Key: tcl_1."tclID", tpe_1."tpeNome", tpe_1."tpeCNPJCPF", tpe_1."tpeTipoPessoa", tos_1."tosAtendimentoSuspenso
  • Sort Method: quicksort Memory: 167kB
37. 584.315 42,517.171 ↓ 1,015.0 1,015 1

Nested Loop (cost=2,633.70..6,297.58 rows=1 width=51) (actual time=111.148..42,517.171 rows=1,015 loops=1)

  • Join Filter: (tos_1."tostclID" = thrfc_1."thrfctclID")
  • Rows Removed by Join Filter: 2023567
38. 11.584 36,843.296 ↓ 1,022.0 1,022 1

Nested Loop (cost=2,458.15..6,043.53 rows=1 width=55) (actual time=106.488..36,843.296 rows=1,022 loops=1)

39. 8.024 36,695.786 ↓ 1,022.0 1,022 1

Nested Loop (cost=2,457.86..6,040.68 rows=1 width=21) (actual time=106.421..36,695.786 rows=1,022 loops=1)

40. 1,235.399 36,680.608 ↓ 1,022.0 1,022 1

Nested Loop (cost=2,457.59..6,038.68 rows=1 width=25) (actual time=106.403..36,680.608 rows=1,022 loops=1)

  • Join Filter: (tos_1."tosID" = tlsos_1."tlsostosID")
  • Rows Removed by Join Filter: 3853642
41. 2.708 761.417 ↓ 1,023.0 1,023 1

Nested Loop (cost=2,457.30..4,565.77 rows=1 width=33) (actual time=95.806..761.417 rows=1,023 loops=1)

42. 3.742 751.548 ↓ 1,023.0 1,023 1

Nested Loop (cost=2,457.02..4,563.61 rows=1 width=25) (actual time=95.797..751.548 rows=1,023 loops=1)

43. 4.077 740.645 ↓ 1,023.0 1,023 1

Nested Loop (cost=2,456.74..4,561.23 rows=1 width=16) (actual time=95.784..740.645 rows=1,023 loops=1)

44. 27.887 98.216 ↓ 1,023.0 1,023 1

Hash Right Join (cost=2,456.32..4,552.83 rows=1 width=12) (actual time=95.758..98.216 rows=1,023 loops=1)

  • Hash Cond: (tfls2."tflstfcmID" = tfcm."tfcmID")
  • Join Filter: ((tfls."tflsDataHora" < tfls2."tflsDataHora") OR ((tfls."tflsDataHora" = tfls2."tflsDataHora") AND (tfls."tflstfcmID" < tfls2."tflstfcmID")))
  • Rows Removed by Join Filter: 3411
  • Filter: (tfls2."tflsID" IS NULL)
  • Rows Removed by Filter: 1443
45. 19.723 19.723 ↑ 1.0 85,576 1

Seq Scan on "TabFUSTLogSituacao" tfls2 (cost=0.00..1,486.80 rows=85,680 width=16) (actual time=0.011..19.723 rows=85,576 loops=1)

46. 0.804 50.606 ↓ 1.6 1,968 1

Hash (cost=2,441.04..2,441.04 rows=1,222 width=28) (actual time=50.606..50.606 rows=1,968 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 139kB
47. 26.964 49.802 ↓ 1.6 1,968 1

Hash Join (cost=620.72..2,441.04 rows=1,222 width=28) (actual time=3.150..49.802 rows=1,968 loops=1)

  • Hash Cond: (tfls."tflstfcmID" = tfcm."tfcmID")
48. 19.898 19.898 ↑ 1.0 85,576 1

Seq Scan on "TabFUSTLogSituacao" tfls (cost=0.00..1,486.80 rows=85,680 width=12) (actual time=0.012..19.898 rows=85,576 loops=1)

49. 0.319 2.940 ↓ 2.9 1,023 1

Hash (cost=616.32..616.32 rows=352 width=16) (actual time=2.939..2.940 rows=1,023 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 56kB
50. 2.621 2.621 ↓ 2.9 1,023 1

Seq Scan on "TabFUSTColetaMensal" tfcm (cost=0.00..616.32 rows=352 width=16) (actual time=0.046..2.621 rows=1,023 loops=1)

  • Filter: (("tfcmMes" = 3) AND ("tfcmAno" = 2019))
  • Rows Removed by Filter: 23571
51. 638.352 638.352 ↑ 1.0 1 1,023

Index Scan using "TabAssessoriaCliente_tacID" on "TabAssessoriaCliente" tac_1 (cost=0.42..8.39 rows=1 width=12) (actual time=0.623..0.624 rows=1 loops=1,023)

  • Index Cond: ("tacID" = tfcm."tfcmtacID")
52. 7.161 7.161 ↑ 1.0 1 1,023

Index Scan using "TabOrdemServico_tosID" on "TabOrdemServico" tos_1 (cost=0.28..2.36 rows=1 width=9) (actual time=0.006..0.007 rows=1 loops=1,023)

  • Index Cond: ("tosID" = tac_1."tactosID")
53. 7.161 7.161 ↑ 1.0 1 1,023

Index Scan using "TabCliente_tclID" on "TabCliente" tcl_1 (cost=0.28..2.15 rows=1 width=8) (actual time=0.006..0.007 rows=1 loops=1,023)

  • Index Cond: ("tclID" = tos_1."tostclID")
54. 6,852.054 34,683.792 ↓ 139.6 3,768 1,023

Subquery Scan on tlsos_1 (cost=0.29..1,472.58 rows=27 width=4) (actual time=0.022..33.904 rows=3,768 loops=1,023)

  • Filter: ((tlsos_1.r = 1) AND (tlsos_1."tlsosSituacao" = ANY ('{3,7,9}'::integer[])))
  • Rows Removed by Filter: 12713
55. 18,176.664 27,831.738 ↑ 1.0 16,481 1,023

WindowAgg (cost=0.29..1,204.55 rows=16,494 width=20) (actual time=0.009..27.206 rows=16,481 loops=1,023)

56. 9,655.074 9,655.074 ↑ 1.0 16,481 1,023

Index Scan using idx_tlsos_tlsostosdesc on "TabLogSituacaoOrdemServico" (cost=0.29..915.90 rows=16,494 width=12) (actual time=0.007..9.438 rows=16,481 loops=1,023)

57. 7.154 7.154 ↑ 1.0 1 1,022

Index Scan using "TabServico_tseID" on "TabServico" tse_1 (cost=0.28..1.98 rows=1 width=4) (actual time=0.006..0.007 rows=1 loops=1,022)

  • Index Cond: ("tseID" = tac_1."tactseID")
  • Filter: ("tseSistemaAgregado" = 2)
58. 135.926 135.926 ↑ 1.0 1 1,022

Index Scan using "TabPessoaID" on "TabPessoa" tpe_1 (cost=0.29..2.85 rows=1 width=42) (actual time=0.132..0.133 rows=1 loops=1,022)

  • Index Cond: ("tpeID" = tcl_1."tcltpeID")
  • Filter: ((COALESCE("tpeCNPJCPF", ''::text) ~~* '%%'::text) AND (proc_common_remove_acento("tpeNome") ~~* '%%'::text))
59. 1,380.722 5,089.560 ↓ 180.1 1,981 1,022

Subquery Scan on thrfc_1 (cost=175.55..253.91 rows=11 width=4) (actual time=0.010..4.980 rows=1,981 loops=1,022)

  • Filter: ((thrfc_1."thrfcIs_Excluido" IS FALSE) AND (thrfc_1.r = 1))
  • Rows Removed by Filter: 462
60. 2,757.356 3,708.838 ↓ 1.0 2,443 1,022

WindowAgg (cost=175.55..223.77 rows=2,411 width=33) (actual time=0.009..3.629 rows=2,443 loops=1,022)

61. 950.719 951.482 ↓ 1.0 2,443 1,022

Sort (cost=175.55..181.58 rows=2,411 width=9) (actual time=0.003..0.931 rows=2,443 loops=1,022)

  • Sort Key: "TabHistoricoRegimeFiscalCliente_1"."thrfctclID", "TabHistoricoRegimeFiscalCliente_1"."thrfcID" DESC
  • Sort Method: quicksort Memory: 211kB
62. 0.763 0.763 ↓ 1.0 2,443 1

Seq Scan on "TabHistoricoRegimeFiscalCliente" "TabHistoricoRegimeFiscalCliente_1" (cost=0.00..40.11 rows=2,411 width=9) (actual time=0.010..0.763 rows=2,443 loops=1)

63. 0.002 51.237 ↑ 1.0 1 1

Unique (cost=1,776.84..1,776.86 rows=1 width=51) (actual time=51.233..51.237 rows=1 loops=1)

64. 0.030 51.235 ↓ 3.0 3 1

Sort (cost=1,776.84..1,776.85 rows=1 width=51) (actual time=51.232..51.235 rows=3 loops=1)

  • Sort Key: tcl_2."tclID", tpe_2."tpeNome", tpe_2."tpeCNPJCPF", tpe_2."tpeTipoPessoa", tos_2."tosAtendimentoSuspenso
  • Sort Method: quicksort Memory: 25kB
65. 1.396 51.205 ↓ 3.0 3 1

Nested Loop (cost=192.19..1,776.83 rows=1 width=51) (actual time=24.557..51.205 rows=3 loops=1)

  • Join Filter: (tos_2."tostclID" = thrfc_2."thrfctclID")
  • Rows Removed by Join Filter: 5940
66. 0.006 37.800 ↓ 3.0 3 1

Nested Loop (cost=16.63..1,522.78 rows=1 width=55) (actual time=19.761..37.800 rows=3 loops=1)

67. 0.042 37.701 ↓ 3.0 3 1

Nested Loop (cost=16.35..1,520.04 rows=1 width=21) (actual time=19.709..37.701 rows=3 loops=1)

  • Join Filter: (tsgqcm."tsgqcmID" = tsgql."tsgqltsgqcmID")
  • Rows Removed by Join Filter: 148
68. 0.002 37.617 ↑ 1.0 1 1

Nested Loop (cost=16.35..1,512.28 rows=1 width=29) (actual time=19.641..37.617 rows=1 loops=1)

69. 0.004 37.604 ↑ 1.0 1 1

Nested Loop (cost=16.07..1,510.28 rows=1 width=33) (actual time=19.629..37.604 rows=1 loops=1)

70. 0.011 37.593 ↑ 1.0 1 1

Nested Loop (cost=15.79..1,508.27 rows=1 width=25) (actual time=19.619..37.593 rows=1 loops=1)

  • Join Filter: (tlsos_2."tlsostosID" = tos_2."tosID")
71. 2.456 37.575 ↑ 1.0 1 1

Nested Loop (cost=15.51..1,506.09 rows=1 width=28) (actual time=19.602..37.575 rows=1 loops=1)

  • Join Filter: (tlsos_2."tlsostosID" = tac_2."tactosID")
  • Rows Removed by Join Filter: 3767
72. 1.675 27.583 ↓ 3,768.0 3,768 1

Nested Loop (cost=15.09..1,497.64 rows=1 width=24) (actual time=1.075..27.583 rows=3,768 loops=1)

73. 0.042 1.120 ↑ 1.0 1 1

Nested Loop (cost=14.80..24.79 rows=1 width=20) (actual time=1.045..1.120 rows=1 loops=1)

  • Join Filter: (tsgqcm."tsgqcmID" = tsgqll."tsgqltsgqcmID")
  • Rows Removed by Join Filter: 44
74. 0.054 0.853 ↓ 45.0 45 1

Subquery Scan on tsgqll (cost=14.80..23.12 rows=1 width=4) (actual time=0.655..0.853 rows=45 loops=1)

  • Filter: (tsgqll.s = 1)
  • Rows Removed by Filter: 106
75. 0.127 0.799 ↑ 1.7 151 1

WindowAgg (cost=14.80..19.92 rows=256 width=36) (actual time=0.640..0.799 rows=151 loops=1)

76. 0.108 0.672 ↑ 1.7 151 1

Sort (cost=14.80..15.44 rows=256 width=8) (actual time=0.635..0.672 rows=151 loops=1)

  • Sort Key: "TabSGQLogSituacao"."tsgqltsgqcmID", "TabSGQLogSituacao"."tsgqlID" DESC
  • Sort Method: quicksort Memory: 32kB
77. 0.564 0.564 ↑ 1.7 151 1

Seq Scan on "TabSGQLogSituacao" (cost=0.00..4.56 rows=256 width=8) (actual time=0.515..0.564 rows=151 loops=1)

78. 0.225 0.225 ↑ 1.0 1 45

Seq Scan on "TabSGQColetaMensal" tsgqcm (cost=0.00..1.66 rows=1 width=16) (actual time=0.004..0.005 rows=1 loops=45)

  • Filter: (("tsgqcmMes" = 3) AND ("tsgqcmAno" = 2019))
  • Rows Removed by Filter: 44
79. 4.856 24.788 ↓ 139.6 3,768 1

Subquery Scan on tlsos_2 (cost=0.29..1,472.58 rows=27 width=4) (actual time=0.027..24.788 rows=3,768 loops=1)

  • Filter: ((tlsos_2.r = 1) AND (tlsos_2."tlsosSituacao" = ANY ('{3,7,9}'::integer[])))
  • Rows Removed by Filter: 12713
80. 13.116 19.932 ↑ 1.0 16,481 1

WindowAgg (cost=0.29..1,204.55 rows=16,494 width=20) (actual time=0.010..19.932 rows=16,481 loops=1)

81. 6.816 6.816 ↑ 1.0 16,481 1

Index Scan using idx_tlsos_tlsostosdesc on "TabLogSituacaoOrdemServico" "TabLogSituacaoOrdemServico_1" (cost=0.29..915.90 rows=16,494 width=12) (actual time=0.008..6.816 rows=16,481 loops=1)

82. 7.536 7.536 ↑ 1.0 1 3,768

Index Scan using "TabAssessoriaCliente_tacID" on "TabAssessoriaCliente" tac_2 (cost=0.42..8.44 rows=1 width=12) (actual time=0.002..0.002 rows=1 loops=3,768)

  • Index Cond: ("tacID" = tsgqcm."tsgqcmtacID")
83. 0.007 0.007 ↑ 1.0 1 1

Index Scan using "TabOrdemServico_tosID" on "TabOrdemServico" tos_2 (cost=0.28..2.17 rows=1 width=9) (actual time=0.006..0.007 rows=1 loops=1)

  • Index Cond: ("tosID" = tac_2."tactosID")
84. 0.007 0.007 ↑ 1.0 1 1

Index Scan using "TabCliente_tclID" on "TabCliente" tcl_2 (cost=0.28..2.00 rows=1 width=8) (actual time=0.006..0.007 rows=1 loops=1)

  • Index Cond: ("tclID" = tos_2."tostclID")
85. 0.011 0.011 ↑ 1.0 1 1

Index Scan using "TabServico_tseID" on "TabServico" tse_2 (cost=0.28..1.98 rows=1 width=4) (actual time=0.010..0.011 rows=1 loops=1)

  • Index Cond: ("tseID" = tac_2."tactseID")
  • Filter: ("tseSistemaAgregado" = 3)
86. 0.042 0.042 ↑ 1.7 151 1

Seq Scan on "TabSGQLogSituacao" tsgql (cost=0.00..4.56 rows=256 width=4) (actual time=0.006..0.042 rows=151 loops=1)

87. 0.093 0.093 ↑ 1.0 1 3

Index Scan using "TabPessoaID" on "TabPessoa" tpe_2 (cost=0.29..2.73 rows=1 width=42) (actual time=0.029..0.031 rows=1 loops=3)

  • Index Cond: ("tpeID" = tcl_2."tcltpeID")
  • Filter: ((COALESCE("tpeCNPJCPF", ''::text) ~~* '%%'::text) AND (proc_common_remove_acento("tpeNome") ~~* '%%'::text))
88. 2.880 12.009 ↓ 180.1 1,981 3

Subquery Scan on thrfc_2 (cost=175.55..253.91 rows=11 width=4) (actual time=0.603..4.003 rows=1,981 loops=3)

  • Filter: ((thrfc_2."thrfcIs_Excluido" IS FALSE) AND (thrfc_2.r = 1))
  • Rows Removed by Filter: 462
89. 5.559 9.129 ↓ 1.0 2,443 3

WindowAgg (cost=175.55..223.77 rows=2,411 width=33) (actual time=0.601..3.043 rows=2,443 loops=3)

90. 2.929 3.570 ↓ 1.0 2,443 3

Sort (cost=175.55..181.58 rows=2,411 width=9) (actual time=0.599..1.190 rows=2,443 loops=3)

  • Sort Key: "TabHistoricoRegimeFiscalCliente_2"."thrfctclID", "TabHistoricoRegimeFiscalCliente_2"."thrfcID" DESC
  • Sort Method: quicksort Memory: 211kB
91. 0.641 0.641 ↓ 1.0 2,443 1

Seq Scan on "TabHistoricoRegimeFiscalCliente" "TabHistoricoRegimeFiscalCliente_2" (cost=0.00..40.11 rows=2,411 width=9) (actual time=0.008..0.641 rows=2,443 loops=1)

Planning time : 14.321 ms
Execution time : 47,072.516 ms