explain.depesz.com

PostgreSQL's explain analyze made readable

Result: WPgH

Settings
# exclusive inclusive rows x rows loops node
1. 3.380 778.117 ↑ 1.2 1,327 1

Sort (cost=14,742.43..14,746.46 rows=1,611 width=108) (actual time=777.822..778.117 rows=1,327 loops=1)

  • Sort Key: tpe."tpeNome
  • Sort Method: quicksort Memory: 236kB
2. 0.554 774.737 ↑ 1.2 1,327 1

Append (cost=4,495.05..14,656.62 rows=1,611 width=108) (actual time=58.250..774.737 rows=1,327 loops=1)

3. 4.174 59.601 ↑ 1.3 1,193 1

HashAggregate (cost=4,495.05..4,515.18 rows=1,610 width=108) (actual time=58.249..59.601 rows=1,193 loops=1)

  • Group Key: tcl."tclID", tos."tostemID", tpe."tpeNome", tpe."tpeCNPJCPF
4. 2.339 55.427 ↓ 2.6 4,144 1

Hash Join (cost=2,325.24..4,474.93 rows=1,610 width=52) (actual time=28.876..55.427 rows=4,144 loops=1)

  • Hash Cond: (tpc."tpctasID" = tas."tasID")
5. 2.683 53.001 ↓ 2.6 4,144 1

Hash Join (cost=2,307.05..4,434.61 rows=1,610 width=56) (actual time=28.778..53.001 rows=4,144 loops=1)

  • Hash Cond: (trec."trectclID" = tcl."tclID")
6. 2.805 35.018 ↓ 2.6 4,144 1

Hash Join (cost=1,509.50..3,614.96 rows=1,610 width=20) (actual time=13.453..35.018 rows=4,144 loops=1)

  • Hash Cond: (trec."trectosID" = tos."tosID")
7. 3.191 23.321 ↓ 1.6 4,872 1

Hash Join (cost=228.38..2,306.51 rows=3,006 width=16) (actual time=4.531..23.321 rows=4,872 loops=1)

  • Hash Cond: (trp."trptrecID" = trec."trecID")
8. 15.938 15.938 ↓ 1.6 4,872 1

Seq Scan on "TabReceitaParcela" trp (cost=0.00..2,036.80 rows=3,006 width=12) (actual time=0.295..15.938 rows=4,872 loops=1)

  • Filter: (("trpPago" IS TRUE) AND ("trpBaixada" IS FALSE) AND ("trpSubstituida" IS FALSE) AND (NOT "trpIsExcluido") AND ("trpDataCompensacao" >= '2019-01-05'::date) AND ("trpDataCompensacao" <= '2019-07-06'::date))
  • Rows Removed by Filter: 52143
9. 2.036 4.192 ↓ 1.0 6,341 1

Hash (cost=149.28..149.28 rows=6,328 width=12) (actual time=4.192..4.192 rows=6,341 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 337kB
10. 2.156 2.156 ↓ 1.0 6,341 1

Seq Scan on "TabReceita" trec (cost=0.00..149.28 rows=6,328 width=12) (actual time=0.008..2.156 rows=6,341 loops=1)

11. 0.890 8.892 ↓ 1.0 2,652 1

Hash (cost=1,248.02..1,248.02 rows=2,648 width=12) (actual time=8.891..8.892 rows=2,652 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 146kB
12. 3.021 8.002 ↓ 1.0 2,652 1

Hash Join (cost=241.91..1,248.02 rows=2,648 width=12) (actual time=2.428..8.002 rows=2,652 loops=1)

  • Hash Cond: (tpc."tpcID" = tos."tostpcID")
13. 2.586 2.586 ↓ 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.586 rows=6,643 loops=1)

14. 0.844 2.395 ↓ 1.0 2,652 1

Hash (cost=208.81..208.81 rows=2,648 width=12) (actual time=2.394..2.395 rows=2,652 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 146kB
15. 1.551 1.551 ↓ 1.0 2,652 1

Seq Scan on "TabOrdemServico" tos (cost=0.00..208.81 rows=2,648 width=12) (actual time=0.010..1.551 rows=2,652 loops=1)

  • Filter: ("tostemID" = 1)
  • Rows Removed by Filter: 2317
16. 1.157 15.300 ↑ 1.0 2,871 1

Hash (cost=760.74..760.74 rows=2,945 width=40) (actual time=15.300..15.300 rows=2,871 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 273kB
17. 6.886 14.143 ↑ 1.0 2,871 1

Hash Join (cost=93.26..760.74 rows=2,945 width=40) (actual time=1.775..14.143 rows=2,871 loops=1)

  • Hash Cond: (tpe."tpeID" = tcl."tcltpeID")
18. 5.524 5.524 ↑ 1.0 20,475 1

Seq Scan on "TabPessoa" tpe (cost=0.00..559.20 rows=21,020 width=40) (actual time=0.003..5.524 rows=20,475 loops=1)

19. 0.857 1.733 ↑ 1.0 2,871 1

Hash (cost=56.45..56.45 rows=2,945 width=8) (actual time=1.733..1.733 rows=2,871 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 145kB
20. 0.876 0.876 ↑ 1.0 2,871 1

Seq Scan on "TabCliente" tcl (cost=0.00..56.45 rows=2,945 width=8) (actual time=0.006..0.876 rows=2,871 loops=1)

21. 0.034 0.087 ↓ 1.0 98 1

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

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

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

23. 0.268 714.582 ↓ 134.0 134 1

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

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

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

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

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

26. 0.162 713.276 ↓ 203.0 203 1

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

27. 0.337 712.708 ↓ 203.0 203 1

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

28. 192.588 711.762 ↓ 203.0 203 1

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

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

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

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

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

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

32. 135.623 490.644 ↓ 104.5 209 3,186

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

33. 0.283 355.021 ↓ 104.5 209 1

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

34. 0.439 353.902 ↓ 104.5 209 1

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

35. 0.389 352.836 ↓ 104.5 209 1

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

36. 0.507 351.611 ↓ 104.5 209 1

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

37. 1.938 349.850 ↓ 104.5 209 1

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

38. 2.395 41.840 ↓ 21.1 4,251 1

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

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

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

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

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

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

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

42. 13.545 18.334 ↑ 1.0 16,160 1

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

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

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

44. 0.366 0.822 ↓ 1.0 1,209 1

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

  • Buckets: 2048 Batches: 1 Memory Usage: 68kB
45. 0.456 0.456 ↓ 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.456 rows=1,209 loops=1)

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

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

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

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

  • Filter: (NOT "trpcIsExcluido")
  • Rows Removed by Filter: 8
48. 14.059 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 2), 'DD-MM-YYYY'::text) >= '2019-01-05'::date) AND (to_date((SubPlan 3), 'DD-MM-YYYY'::text) <= '2019-07-06'::date) AND ((now())::date > to_date((SubPlan 1), 'DD-MM-YYYY'::text)))
  • Rows Removed by Filter: 1
49.          

SubPlan (forIndex Scan)

50. 108.621 108.621 ↑ 1,000.0 1 243

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

51. 92.020 92.020 ↑ 1,000.0 1 214

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=214)

52. 91.372 91.372 ↑ 1,000.0 1 212

Function Scan on proc_common_getnetxbusinessdays (cost=0.25..10.25 rows=1,000 width=32) (actual time=0.431..0.431 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.627 0.627 ↑ 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.003 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.134 ms
Execution time : 779.129 ms