explain.depesz.com

PostgreSQL's explain analyze made readable

Result: GKJL : Optimization for: Optimization for: plan #3HiS; plan #ZCGu

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.083 66,303.938 ↓ 13.3 40 1

Limit (cost=17,209.65..17,209.75 rows=3 width=59) (actual time=66,303.841..66,303.938 rows=40 loops=1)

2. 0.661 66,303.855 ↓ 13.3 40 1

WindowAgg (cost=17,209.65..17,209.75 rows=3 width=59) (actual time=66,303.839..66,303.855 rows=40 loops=1)

3. 1.046 66,303.194 ↓ 339.3 1,018 1

Group (cost=17,209.65..17,209.71 rows=3 width=51) (actual time=66,301.630..66,303.194 rows=1,018 loops=1)

  • Group Key: tpe."tpeNome", tcl."tclID", tpe."tpeCNPJCPF", tpe."tpeTipoPessoa", tsc."tscMes", tsc."tscAno", tos."tosAtendimentoSuspenso
4. 9.224 66,302.148 ↓ 676.7 2,030 1

Sort (cost=17,209.65..17,209.66 rows=3 width=51) (actual time=66,301.628..66,302.148 rows=2,030 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.714 66,292.924 ↓ 676.7 2,030 1

Append (cost=9,135.11..17,209.63 rows=3 width=51) (actual time=30,303.629..66,292.924 rows=2,030 loops=1)

6. 0.616 30,304.580 ↓ 1,014.0 1,014 1

Unique (cost=9,135.11..9,135.13 rows=1 width=51) (actual time=30,303.628..30,304.580 rows=1,014 loops=1)

7. 2.865 30,303.964 ↓ 1,014.0 1,014 1

Sort (cost=9,135.11..9,135.12 rows=1 width=51) (actual time=30,303.627..30,303.964 rows=1,014 loops=1)

  • Sort Key: tcl."tclID", tpe."tpeNome", tpe."tpeCNPJCPF", tpe."tpeTipoPessoa", tos."tosAtendimentoSuspenso
  • Sort Method: quicksort Memory: 167kB
8. 444.624 30,301.099 ↓ 1,014.0 1,014 1

Nested Loop (cost=3,736.71..9,135.10 rows=1 width=51) (actual time=178.994..30,301.099 rows=1,014 loops=1)

  • Join Filter: (tos."tostclID" = thrfc."thrfctclID")
  • Rows Removed by Join Filter: 2021587
9. 2.521 26,267.660 ↓ 1,021.0 1,021 1

Nested Loop (cost=3,561.15..8,881.06 rows=1 width=55) (actual time=172.554..26,267.660 rows=1,021 loops=1)

10. 3.664 26,228.383 ↓ 1,021.0 1,021 1

Nested Loop (cost=3,560.87..8,878.11 rows=1 width=21) (actual time=172.491..26,228.383 rows=1,021 loops=1)

11. 902.866 26,218.593 ↓ 1,021.0 1,021 1

Nested Loop (cost=3,560.59..8,876.11 rows=1 width=25) (actual time=172.477..26,218.593 rows=1,021 loops=1)

  • Join Filter: (tos."tosID" = tlsos."tlsostosID")
  • Rows Removed by Join Filter: 3849875
12. 2.799 190.879 ↓ 1,022.0 1,022 1

Nested Loop (cost=3,560.30..7,403.20 rows=1 width=33) (actual time=155.533..190.879 rows=1,022 loops=1)

13. 2.376 181.948 ↓ 1,022.0 1,022 1

Nested Loop (cost=3,560.02..7,401.04 rows=1 width=25) (actual time=155.523..181.948 rows=1,022 loops=1)

14. 3.709 172.418 ↓ 1,022.0 1,022 1

Nested Loop (cost=3,559.74..7,398.63 rows=1 width=16) (actual time=155.513..172.418 rows=1,022 loops=1)

15. 43.565 158.489 ↓ 1,022.0 1,022 1

Hash Right Join (cost=3,559.32..7,390.21 rows=1 width=12) (actual time=155.490..158.489 rows=1,022 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: 17445
  • Filter: (tsl2."tslID" IS NULL)
  • Rows Removed by Filter: 12282
16. 31.332 31.332 ↑ 1.0 136,578 1

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

17. 1.992 83.592 ↓ 5.3 5,163 1

Hash (cost=3,547.21..3,547.21 rows=969 width=28) (actual time=83.591..83.592 rows=5,163 loops=1)

  • Buckets: 8192 (originally 1024) Batches: 1 (originally 1) Memory Usage: 387kB
18. 38.221 81.600 ↓ 5.3 5,163 1

Hash Join (cost=654.27..3,547.21 rows=969 width=28) (actual time=6.501..81.600 rows=5,163 loops=1)

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

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

20. 0.312 5.927 ↓ 5.8 1,022 1

Hash (cost=652.08..652.08 rows=175 width=16) (actual time=5.925..5.927 rows=1,022 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 56kB
21. 5.615 5.615 ↓ 5.8 1,022 1

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

  • Filter: (("tscIsExcluido" IS FALSE) AND ("tscMes" = 3) AND ("tscAno" = 2019))
  • Rows Removed by Filter: 23563
22. 10.220 10.220 ↑ 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.009..0.010 rows=1 loops=1,022)

  • Index Cond: ("tacID" = tsc."tsctacID")
23. 7.154 7.154 ↑ 1.0 1 1,022

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

  • Index Cond: ("tosID" = tac."tactosID")
24. 6.132 6.132 ↑ 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.005..0.006 rows=1 loops=1,022)

  • Index Cond: ("tclID" = tos."tostclID")
25. 5,007.800 25,124.848 ↓ 139.6 3,768 1,022

Subquery Scan on tlsos (cost=0.29..1,472.58 rows=27 width=4) (actual time=0.018..24.584 rows=3,768 loops=1,022)

  • Filter: ((tlsos.r = 1) AND (tlsos."tlsosSituacao" = ANY ('{3,7,9}'::integer[])))
  • Rows Removed by Filter: 12713
26. 13,166.426 20,117.048 ↑ 1.0 16,481 1,022

WindowAgg (cost=0.29..1,204.55 rows=16,494 width=68) (actual time=0.008..19.684 rows=16,481 loops=1,022)

27. 6,950.622 6,950.622 ↑ 1.0 16,481 1,022

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

28. 6.126 6.126 ↑ 1.0 1 1,021

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

  • Index Cond: ("tseID" = tac."tactseID")
  • Filter: ("tseSistemaAgregado" = 1)
29. 36.756 36.756 ↑ 1.0 1 1,021

Index Scan using "TabPessoaID" on "TabPessoa" tpe (cost=0.29..2.94 rows=1 width=42) (actual time=0.035..0.036 rows=1 loops=1,021)

  • Index Cond: ("tpeID" = tcl."tcltpeID")
  • Filter: ((COALESCE("tpeCNPJCPF", ''::text) ~~* '%%'::text) AND (proc_common_remove_acento("tpeNome") ~~* '%%'::text))
30. 991.391 3,588.815 ↓ 180.1 1,981 1,021

Subquery Scan on thrfc (cost=175.55..253.91 rows=11 width=4) (actual time=0.007..3.515 rows=1,981 loops=1,021)

  • Filter: ((thrfc."thrfcIs_Excluido" IS FALSE) AND (thrfc.r = 1))
  • Rows Removed by Filter: 462
31. 1,956.236 2,597.424 ↓ 1.0 2,443 1,021

WindowAgg (cost=175.55..223.77 rows=2,411 width=33) (actual time=0.006..2.544 rows=2,443 loops=1,021)

32. 639.304 641.188 ↓ 1.0 2,443 1,021

Sort (cost=175.55..181.58 rows=2,411 width=9) (actual time=0.004..0.628 rows=2,443 loops=1,021)

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

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

34. 0.617 35,876.776 ↓ 1,015.0 1,015 1

Unique (cost=6,297.59..6,297.61 rows=1 width=51) (actual time=35,873.254..35,876.776 rows=1,015 loops=1)

35. 9.662 35,876.159 ↓ 1,015.0 1,015 1

Sort (cost=6,297.59..6,297.60 rows=1 width=51) (actual time=35,873.252..35,876.159 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
36. 570.499 35,866.497 ↓ 1,015.0 1,015 1

Nested Loop (cost=2,633.70..6,297.58 rows=1 width=51) (actual time=109.511..35,866.497 rows=1,015 loops=1)

  • Join Filter: (tos_1."tostclID" = thrfc_1."thrfctclID")
  • Rows Removed by Join Filter: 2023567
37. 2.705 31,098.644 ↓ 1,022.0 1,022 1

Nested Loop (cost=2,458.15..6,043.53 rows=1 width=55) (actual time=104.888..31,098.644 rows=1,022 loops=1)

38. 2.731 31,058.125 ↓ 1,022.0 1,022 1

Nested Loop (cost=2,457.86..6,040.68 rows=1 width=21) (actual time=104.831..31,058.125 rows=1,022 loops=1)

39. 1,089.580 31,048.240 ↓ 1,022.0 1,022 1

Nested Loop (cost=2,457.59..6,038.68 rows=1 width=25) (actual time=104.816..31,048.240 rows=1,022 loops=1)

  • Join Filter: (tos_1."tosID" = tlsos_1."tlsostosID")
  • Rows Removed by Join Filter: 3853642
40. 2.445 130.026 ↓ 1,023.0 1,023 1

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

41. 2.675 121.443 ↓ 1,023.0 1,023 1

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

42. 4.951 112.630 ↓ 1,023.0 1,023 1

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

43. 25.493 96.426 ↓ 1,023.0 1,023 1

Hash Right Join (cost=2,456.32..4,552.83 rows=1 width=12) (actual time=94.382..96.426 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
44. 19.627 19.627 ↑ 1.0 85,576 1

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

45. 0.704 51.306 ↓ 1.6 1,968 1

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

  • Buckets: 2048 Batches: 1 Memory Usage: 139kB
46. 23.563 50.602 ↓ 1.6 1,968 1

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

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

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

48. 0.348 4.034 ↓ 2.9 1,023 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 56kB
49. 3.686 3.686 ↓ 2.9 1,023 1

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

  • Filter: (("tfcmMes" = 3) AND ("tfcmAno" = 2019))
  • Rows Removed by Filter: 23571
50. 11.253 11.253 ↑ 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.010..0.011 rows=1 loops=1,023)

  • Index Cond: ("tacID" = tfcm."tfcmtacID")
51. 6.138 6.138 ↑ 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.005..0.006 rows=1 loops=1,023)

  • Index Cond: ("tosID" = tac_1."tactosID")
52. 6.138 6.138 ↑ 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.005..0.006 rows=1 loops=1,023)

  • Index Cond: ("tclID" = tos_1."tostclID")
53. 5,958.975 29,828.634 ↓ 139.6 3,768 1,023

Subquery Scan on tlsos_1 (cost=0.29..1,472.58 rows=27 width=4) (actual time=0.023..29.158 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
54. 15,363.414 23,869.659 ↑ 1.0 16,481 1,023

WindowAgg (cost=0.29..1,204.55 rows=16,494 width=68) (actual time=0.008..23.333 rows=16,481 loops=1,023)

55. 8,506.245 8,506.245 ↑ 1.0 16,481 1,023

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

56. 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)
57. 37.814 37.814 ↑ 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.036..0.037 rows=1 loops=1,022)

  • Index Cond: ("tpeID" = tcl_1."tcltpeID")
  • Filter: ((COALESCE("tpeCNPJCPF", ''::text) ~~* '%%'::text) AND (proc_common_remove_acento("tpeNome") ~~* '%%'::text))
58. 1,179.388 4,197.354 ↓ 180.1 1,981 1,022

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

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

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

60. 748.436 749.126 ↓ 1.0 2,443 1,022

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

  • Sort Key: "TabHistoricoRegimeFiscalCliente_1"."thrfctclID", "TabHistoricoRegimeFiscalCliente_1"."thrfcID" DESC
  • Sort Method: quicksort Memory: 211kB
61. 0.690 0.690 ↓ 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.690 rows=2,443 loops=1)

62. 0.005 110.854 ↑ 1.0 1 1

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

63. 0.029 110.849 ↓ 3.0 3 1

Sort (cost=1,776.84..1,776.85 rows=1 width=51) (actual time=110.848..110.849 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
64. 1.253 110.820 ↓ 3.0 3 1

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

  • Join Filter: (tos_2."tostclID" = thrfc_2."thrfctclID")
  • Rows Removed by Join Filter: 5940
65. 0.010 82.099 ↓ 3.0 3 1

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

66. 0.058 81.990 ↓ 3.0 3 1

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

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

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

68. 0.006 81.875 ↑ 1.0 1 1

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

69. 0.032 81.863 ↑ 1.0 1 1

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

  • Join Filter: (tlsos_2."tlsostosID" = tos_2."tosID")
70. 3.677 81.824 ↑ 1.0 1 1

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

  • Join Filter: (tlsos_2."tlsostosID" = tac_2."tactosID")
  • Rows Removed by Join Filter: 3767
71. 1.634 63.075 ↓ 3,768.0 3,768 1

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

72. 0.020 0.605 ↑ 1.0 1 1

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

  • Join Filter: (tsgqcm."tsgqcmID" = tsgqll."tsgqltsgqcmID")
  • Rows Removed by Join Filter: 44
73. 0.050 0.360 ↓ 45.0 45 1

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

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

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

75. 0.122 0.183 ↑ 1.7 151 1

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

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

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

77. 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
78. 13.067 60.836 ↓ 139.6 3,768 1

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

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

WindowAgg (cost=0.29..1,204.55 rows=16,494 width=68) (actual time=0.011..47.769 rows=16,481 loops=1)

80. 19.737 19.737 ↑ 1.0 16,481 1

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

81. 15.072 15.072 ↑ 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.004..0.004 rows=1 loops=3,768)

  • Index Cond: ("tacID" = tsgqcm."tsgqcmtacID")
82. 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.005..0.007 rows=1 loops=1)

  • Index Cond: ("tosID" = tac_2."tactosID")
83. 0.006 0.006 ↑ 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.005..0.006 rows=1 loops=1)

  • Index Cond: ("tclID" = tos_2."tostclID")
84. 0.012 0.012 ↑ 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.012 rows=1 loops=1)

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

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

86. 0.099 0.099 ↑ 1.0 1 3

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

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

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

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

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

89. 10.943 11.754 ↓ 1.0 2,443 3

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

  • Sort Key: "TabHistoricoRegimeFiscalCliente_2"."thrfctclID", "TabHistoricoRegimeFiscalCliente_2"."thrfcID" DESC
  • Sort Method: quicksort Memory: 211kB
90. 0.811 0.811 ↓ 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.811 rows=2,443 loops=1)

Planning time : 13.696 ms
Execution time : 66,304.920 ms