explain.depesz.com

PostgreSQL's explain analyze made readable

Result: wa3k

Settings
# exclusive inclusive rows x rows loops node
1. 3.266 11,458.714 ↑ 1.6 1,327 1

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

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

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

3. 2.969 10,727.888 ↑ 1.8 1,193 1

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

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

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

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

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

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

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

7. 11.263 10,673.960 ↓ 1.9 4,144 1

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

8. 6.460 10,641.977 ↓ 1.9 4,144 1

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

9. 5.851 36.937 ↓ 1.0 3,420 1

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

10. 5.722 5.722 ↓ 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.722 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. 173.601 10,598.580 ↑ 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.327..3.099 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. 9,206.055 9,206.055 ↑ 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.405..0.405 rows=1 loops=22,731)

15. 1,218.924 1,218.924 ↑ 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.293..0.294 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. 20.720 20.720 ↑ 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.005 rows=1 loops=4,144)

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

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

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

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

  • Hash Cond: (tpc."tpctasID" = tas."tasID")
20. 2.688 2.688 ↓ 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.688 rows=6,643 loops=1)

21. 0.032 0.080 ↓ 1.0 98 1

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

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

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

23. 0.273 727.032 ↓ 134.0 134 1

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

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

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

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

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

26. 0.204 725.732 ↓ 203.0 203 1

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

27. 0.342 725.122 ↓ 203.0 203 1

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

28. 195.678 724.171 ↓ 203.0 203 1

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

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

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

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

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

31. 7.726 7.726 ↓ 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.013..7.726 rows=16,314 loops=1)

32. 130.154 500.202 ↓ 104.5 209 3,186

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

33. 0.308 370.048 ↓ 104.5 209 1

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

34. 0.301 368.904 ↓ 104.5 209 1

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

35. 0.298 367.767 ↓ 104.5 209 1

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

36. 0.561 366.424 ↓ 104.5 209 1

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

37. 3.872 364.609 ↓ 104.5 209 1

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

38. 2.479 41.912 ↓ 21.1 4,251 1

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

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

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

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

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

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

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

42. 14.594 19.090 ↑ 1.0 16,160 1

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

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

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

44. 0.361 0.846 ↓ 1.0 1,209 1

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

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

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

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

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

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

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

  • Filter: (NOT "trpcIsExcluido")
  • Rows Removed by Filter: 8
48. 13.150 318.825 ↓ 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.075..0.075 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. 113.967 113.967 ↑ 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.468..0.469 rows=1 loops=243)

51. 97.156 97.156 ↑ 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.454..0.454 rows=1 loops=214)

52. 94.552 94.552 ↑ 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.446..0.446 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. 1.045 1.045 ↑ 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.005 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.405 ms
Execution time : 11,459.677 ms