explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ItGN

Settings
# exclusive inclusive rows x rows loops node
1. 3.318 11,261.467 ↑ 1.6 1,327 1

Sort (cost=716,764.10..716,769.45 rows=2,141 width=108) (actual time=11,261.165..11,261.467 rows=1,327 loops=1)

  • Sort Key: tpe."tpeNome
  • Sort Method: quicksort Memory: 236kB
2. 0.542 11,258.149 ↑ 1.6 1,327 1

Append (cost=706,440.06..716,645.66 rows=2,141 width=108) (actual time=10,557.096..11,258.149 rows=1,327 loops=1)

3. 3.024 10,561.118 ↑ 1.8 1,193 1

GroupAggregate (cost=706,440.06..706,498.91 rows=2,140 width=108) (actual time=10,557.096..10,561.118 rows=1,193 loops=1)

  • Group Key: tcl."tclID", tos."tostemID", tpe."tpeNome", tpe."tpeCNPJCPF
4. 7.175 10,558.094 ↓ 1.9 4,144 1

Sort (cost=706,440.06..706,445.41 rows=2,140 width=52) (actual time=10,557.076..10,558.094 rows=4,144 loops=1)

  • Sort Key: tcl."tclID", tpe."tpeNome", tpe."tpeCNPJCPF
  • Sort Method: quicksort Memory: 776kB
5. 6.941 10,550.919 ↓ 1.9 4,144 1

Hash Join (cost=1,140.38..706,321.69 rows=2,140 width=52) (actual time=664.392..10,550.919 rows=4,144 loops=1)

  • Hash Cond: (tos."tostpcID" = tpc."tpcID")
6. 5.310 10,535.298 ↓ 1.9 4,144 1

Nested Loop (cost=1.42..705,153.31 rows=2,140 width=56) (actual time=655.691..10,535.298 rows=4,144 loops=1)

7. 11.437 10,513.412 ↓ 1.9 4,144 1

Nested Loop (cost=1.14..703,290.40 rows=2,140 width=24) (actual time=655.680..10,513.412 rows=4,144 loops=1)

8. 6.552 10,481.255 ↓ 1.9 4,144 1

Nested Loop (cost=0.85..702,582.30 rows=2,140 width=20) (actual time=655.664..10,481.255 rows=4,144 loops=1)

9. 6.071 36.863 ↓ 1.0 3,420 1

Nested Loop (cost=0.56..2,950.45 rows=3,389 width=16) (actual time=0.020..36.863 rows=3,420 loops=1)

10. 5.428 5.428 ↓ 1.0 6,341 1

Index Scan using "TabReceita_trecID" on "TabReceita" trec (cost=0.28..292.95 rows=6,328 width=12) (actual time=0.008..5.428 rows=6,341 loops=1)

11. 25.364 25.364 ↑ 1.0 1 6,341

Index Scan using "TabOrdemServico_tosID" on "TabOrdemServico" tos (cost=0.28..0.41 rows=1 width=12) (actual time=0.003..0.004 rows=1 loops=6,341)

  • Index Cond: ("tosID" = trec."trectosID")
  • Filter: ("tostemID" = 1)
  • Rows Removed by Filter: 0
12. 182.127 10,437.840 ↑ 1.0 1 3,420

Index Scan using idx_trp_trecid_trpsubstituida on "TabReceitaParcela" trp (cost=0.29..206.43 rows=1 width=12) (actual time=2.319..3.052 rows=1 loops=3,420)

  • Index Cond: (("trptrecID" = trec."trecID") AND ("trpSubstituida" = false))
  • Filter: (("trpPago" IS TRUE) AND ("trpBaixada" IS FALSE) AND ("trpSubstituida" IS FALSE) AND (NOT "trpIsExcluido") AND (to_date((SubPlan 1), 'DD-MM-YYYY'::text) >= '2019-01-05'::date) AND (to_date((SubPlan 2), 'DD-MM-YYYY'::text) <= '2019-07-06'::date))
  • Rows Removed by Filter: 9
13.          

SubPlan (forIndex Scan)

14. 8,978.745 8,978.745 ↑ 1,000.0 1 22,731

Function Scan on proc_common_getnetxbusinessdays (cost=0.25..10.25 rows=1,000 width=32) (actual time=0.395..0.395 rows=1 loops=22,731)

15. 1,276.968 1,276.968 ↑ 1,000.0 1 4,146

Function Scan on proc_common_getnetxbusinessdays proc_common_getnetxbusinessdays_1 (cost=0.25..10.25 rows=1,000 width=32) (actual time=0.308..0.308 rows=1 loops=4,146)

16. 20.720 20.720 ↑ 1.0 1 4,144

Index Scan using "TabCliente_tclID" on "TabCliente" tcl (cost=0.28..0.32 rows=1 width=8) (actual time=0.005..0.005 rows=1 loops=4,144)

  • Index Cond: ("tclID" = trec."trectclID")
17. 16.576 16.576 ↑ 1.0 1 4,144

Index Scan using "TabPessoaID" on "TabPessoa" tpe (cost=0.29..0.86 rows=1 width=40) (actual time=0.003..0.004 rows=1 loops=4,144)

  • Index Cond: ("tpeID" = tcl."tcltpeID")
18. 1.873 8.680 ↓ 1.0 6,643 1

Hash (cost=1,055.93..1,055.93 rows=6,642 width=4) (actual time=8.680..8.680 rows=6,643 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 298kB
19. 4.052 6.807 ↓ 1.0 6,643 1

Hash Join (cost=18.18..1,055.93 rows=6,642 width=4) (actual time=0.092..6.807 rows=6,643 loops=1)

  • Hash Cond: (tpc."tpctasID" = tas."tasID")
20. 2.673 2.673 ↓ 1.0 6,643 1

Seq Scan on "TabPropostaComercial" tpc (cost=0.00..946.42 rows=6,642 width=8) (actual time=0.004..2.673 rows=6,643 loops=1)

21. 0.028 0.082 ↓ 1.0 98 1

Hash (cost=16.97..16.97 rows=97 width=4) (actual time=0.082..0.082 rows=98 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 12kB
22. 0.054 0.054 ↓ 1.0 98 1

Seq Scan on "TabAssessoria" tas (cost=0.00..16.97 rows=97 width=4) (actual time=0.005..0.054 rows=98 loops=1)

23. 0.276 696.489 ↓ 134.0 134 1

GroupAggregate (cost=10,125.30..10,125.33 rows=1 width=108) (actual time=696.201..696.489 rows=134 loops=1)

  • Group Key: tcl_1."tclID", tem."temID", tpe_1."tpeNome", tpe_1."tpeCNPJCPF
24. 0.257 696.213 ↓ 203.0 203 1

Sort (cost=10,125.30..10,125.30 rows=1 width=76) (actual time=696.159..696.213 rows=203 loops=1)

  • Sort Key: tcl_1."tclID", tpe_1."tpeNome", tpe_1."tpeCNPJCPF
  • Sort Method: quicksort Memory: 53kB
25. 0.302 695.956 ↓ 203.0 203 1

Nested Loop (cost=1,705.39..10,125.29 rows=1 width=76) (actual time=20.692..695.956 rows=203 loops=1)

26. 0.206 695.248 ↓ 203.0 203 1

Nested Loop (cost=1,705.39..10,124.20 rows=1 width=76) (actual time=20.684..695.248 rows=203 loops=1)

27. 0.283 694.636 ↓ 203.0 203 1

Nested Loop (cost=1,705.25..10,124.02 rows=1 width=80) (actual time=20.663..694.636 rows=203 loops=1)

28. 183.938 693.744 ↓ 203.0 203 1

Nested Loop (cost=1,704.97..10,122.98 rows=1 width=80) (actual time=20.654..693.744 rows=203 loops=1)

  • Join Filter: (tos_1."tosID" = tlsos."tlsostosID")
  • Rows Removed by Join Filter: 665671
29. 4.985 25.534 ↓ 132.8 3,186 1

Subquery Scan on tlsos (cost=0.29..1,437.94 rows=24 width=4) (actual time=0.035..25.534 rows=3,186 loops=1)

  • Filter: ((tlsos."tlsosSituacao" = ANY ('{3,9}'::integer[])) AND (tlsos.r = 1))
  • Rows Removed by Filter: 13128
30. 13.115 20.549 ↓ 1.0 16,314 1

WindowAgg (cost=0.29..1,193.28 rows=16,311 width=68) (actual time=0.016..20.549 rows=16,314 loops=1)

31. 7.434 7.434 ↓ 1.0 16,314 1

Index Scan using idx_tlsos_tlsostosdesc on "TabLogSituacaoOrdemServico" (cost=0.29..907.84 rows=16,311 width=12) (actual time=0.011..7.434 rows=16,314 loops=1)

32. 127.663 484.272 ↓ 104.5 209 3,186

Materialize (cost=1,704.68..8,684.32 rows=2 width=88) (actual time=0.007..0.152 rows=209 loops=3,186)

33. 0.308 356.609 ↓ 104.5 209 1

Nested Loop (cost=1,704.68..8,684.31 rows=2 width=88) (actual time=20.612..356.609 rows=209 loops=1)

34. 0.297 355.465 ↓ 104.5 209 1

Nested Loop (cost=1,704.40..8,683.48 rows=2 width=80) (actual time=20.604..355.465 rows=209 loops=1)

35. 0.403 354.332 ↓ 104.5 209 1

Nested Loop (cost=1,704.12..8,681.30 rows=2 width=80) (actual time=20.594..354.332 rows=209 loops=1)

36. 0.597 353.093 ↓ 104.5 209 1

Nested Loop (cost=1,703.83..8,679.56 rows=2 width=48) (actual time=20.586..353.093 rows=209 loops=1)

37. 3.340 351.242 ↓ 104.5 209 1

Nested Loop (cost=1,703.55..8,678.70 rows=2 width=44) (actual time=20.563..351.242 rows=209 loops=1)

38. 2.447 41.830 ↓ 21.1 4,251 1

Hash Join (cost=1,703.26..2,237.25 rows=201 width=12) (actual time=18.021..41.830 rows=4,251 loops=1)

  • Hash Cond: (tlsc."tlsctcoID" = trpc."trpctcoID")
39. 1.097 35.908 ↓ 20.5 1,209 1

Hash Join (cost=1,547.15..2,074.18 rows=59 width=16) (actual time=14.507..35.908 rows=1,209 loops=1)

  • Hash Cond: (tlsc."tlsctcoID" = tco."tcoID")
40. 4.179 33.893 ↓ 20.2 1,639 1

Subquery Scan on tlsc (cost=1,501.72..2,027.86 rows=81 width=4) (actual time=13.570..33.893 rows=1,639 loops=1)

  • Filter: (tlsc.r = 1)
  • Rows Removed by Filter: 14521
41. 11.303 29.714 ↑ 1.0 16,160 1

WindowAgg (cost=1,501.72..1,825.50 rows=16,189 width=96) (actual time=13.565..29.714 rows=16,160 loops=1)

42. 13.563 18.411 ↑ 1.0 16,160 1

Sort (cost=1,501.72..1,542.19 rows=16,189 width=8) (actual time=13.560..18.411 rows=16,160 loops=1)

  • Sort Key: "TabLogSituacaoCobranca"."tlsctcoID", "TabLogSituacaoCobranca"."tlscID" DESC
  • Sort Method: quicksort Memory: 1142kB
43. 4.848 4.848 ↑ 1.0 16,160 1

Seq Scan on "TabLogSituacaoCobranca" (cost=0.00..369.89 rows=16,189 width=8) (actual time=0.005..4.848 rows=16,160 loops=1)

44. 0.470 0.918 ↓ 1.0 1,209 1

Hash (cost=30.40..30.40 rows=1,202 width=12) (actual time=0.918..0.918 rows=1,209 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 68kB
45. 0.448 0.448 ↓ 1.0 1,209 1

Seq Scan on "TabCobranca" tco (cost=0.00..30.40 rows=1,202 width=12) (actual time=0.008..0.448 rows=1,209 loops=1)

  • Filter: ("tcotemID" = 1)
  • Rows Removed by Filter: 430
46. 1.746 3.475 ↓ 1.0 5,586 1

Hash (cost=86.65..86.65 rows=5,557 width=8) (actual time=3.475..3.475 rows=5,586 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 283kB
47. 1.729 1.729 ↓ 1.0 5,586 1

Seq Scan on "TabReceitaParcelaCobranca" trpc (cost=0.00..86.65 rows=5,557 width=8) (actual time=0.010..1.729 rows=5,586 loops=1)

  • Filter: (NOT "trpcIsExcluido")
  • Rows Removed by Filter: 8
48. 13.143 306.072 ↓ 0.0 0 4,251

Index Scan using "TabReceitaParcela_trpID" on "TabReceitaParcela" trp_1 (cost=0.29..32.04 rows=1 width=40) (actual time=0.072..0.072 rows=0 loops=4,251)

  • Index Cond: ("trpID" = trpc."trpctrpID")
  • Filter: (("trpPago" IS FALSE) AND ("trpBaixada" IS FALSE) AND ("trpSubstituida" IS FALSE) AND (NOT "trpIsExcluido") AND (to_date((SubPlan 4), 'DD-MM-YYYY'::text) >= '2019-01-05'::date) AND (to_date((SubPlan 5), 'DD-MM-YYYY'::text) <= '2019-07-06'::date) AND ((now())::date > to_date((SubPlan 3), 'DD-MM-YYYY'::text)))
  • Rows Removed by Filter: 1
49.          

SubPlan (forIndex Scan)

50. 109.107 109.107 ↑ 1,000.0 1 243

Function Scan on proc_common_getnetxbusinessdays proc_common_getnetxbusinessdays_3 (cost=0.25..10.25 rows=1,000 width=32) (actual time=0.449..0.449 rows=1 loops=243)

51. 92.662 92.662 ↑ 1,000.0 1 214

Function Scan on proc_common_getnetxbusinessdays proc_common_getnetxbusinessdays_4 (cost=0.25..10.25 rows=1,000 width=32) (actual time=0.433..0.433 rows=1 loops=214)

52. 91.160 91.160 ↑ 1,000.0 1 212

Function Scan on proc_common_getnetxbusinessdays proc_common_getnetxbusinessdays_2 (cost=0.25..10.25 rows=1,000 width=32) (actual time=0.429..0.430 rows=1 loops=212)

53. 1.254 1.254 ↑ 1.0 1 209

Index Scan using "TabCliente_tclID" on "TabCliente" tcl_1 (cost=0.28..0.42 rows=1 width=8) (actual time=0.006..0.006 rows=1 loops=209)

  • Index Cond: ("tclID" = tco."tcotclID")
54. 0.836 0.836 ↑ 1.0 1 209

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

  • Index Cond: ("tpeID" = tcl_1."tcltpeID")
55. 0.836 0.836 ↑ 1.0 1 209

Index Scan using "TabReceita_trecID" on "TabReceita" trec_1 (cost=0.28..1.08 rows=1 width=8) (actual time=0.003..0.004 rows=1 loops=209)

  • Index Cond: ("trecID" = trp_1."trptrecID")
56. 0.836 0.836 ↑ 1.0 1 209

Index Scan using "TabOrdemServico_tosID" on "TabOrdemServico" tos_1 (cost=0.28..0.41 rows=1 width=8) (actual time=0.003..0.004 rows=1 loops=209)

  • Index Cond: ("tosID" = trec_1."trectosID")
57. 0.609 0.609 ↑ 1.0 1 203

Index Scan using "TabPropostaComercial_tpcID" on "TabPropostaComercial" tpc_1 (cost=0.28..1.03 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=203)

  • Index Cond: ("tpcID" = tos_1."tostpcID")
58. 0.406 0.406 ↑ 1.0 1 203

Index Only Scan using "TabAssessoria_tasID" on "TabAssessoria" tas_1 (cost=0.14..0.17 rows=1 width=4) (actual time=0.001..0.002 rows=1 loops=203)

  • Index Cond: ("tasID" = tpc_1."tpctasID")
  • Heap Fetches: 203
59. 0.406 0.406 ↑ 1.0 1 203

Seq Scan on "TabEmpresa" tem (cost=0.00..1.07 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=203)

  • Filter: ("temID" = 1)
  • Rows Removed by Filter: 5
Planning time : 4.160 ms
Execution time : 11,262.505 ms