explain.depesz.com

PostgreSQL's explain analyze made readable

Result: EWAr

Settings
# exclusive inclusive rows x rows loops node
1. 3.428 766.918 ↑ 1.2 1,327 1

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

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

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

3. 4.173 57.708 ↑ 1.3 1,193 1

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

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

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

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

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

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

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

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

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

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

Seq Scan on "TabReceitaParcela" trp (cost=0.00..2,036.80 rows=3,006 width=12) (actual time=0.267..16.120 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.011 4.067 ↓ 1.0 6,341 1

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

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

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

11. 0.789 8.520 ↓ 1.0 2,652 1

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

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

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

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

14. 0.837 2.327 ↓ 1.0 2,652 1

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

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

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

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

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

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

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

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

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

19. 0.737 1.636 ↑ 1.0 2,871 1

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

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

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

21. 0.031 0.086 ↓ 1.0 98 1

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

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

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

23. 0.282 705.254 ↓ 134.0 134 1

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

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

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

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

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

26. 0.206 703.925 ↓ 203.0 203 1

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

27. 0.365 703.313 ↓ 203.0 203 1

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

28. 189.342 702.339 ↓ 203.0 203 1

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

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

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

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

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

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

32. 130.846 487.458 ↓ 104.5 209 3,186

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

33. 0.301 356.612 ↓ 104.5 209 1

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

34. 0.294 355.475 ↓ 104.5 209 1

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

35. 0.449 354.345 ↓ 104.5 209 1

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

36. 0.574 353.060 ↓ 104.5 209 1

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

37. 4.168 351.232 ↓ 104.5 209 1

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

38. 2.289 40.992 ↓ 21.1 4,251 1

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

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

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

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

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

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

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

42. 13.533 18.120 ↑ 1.0 16,160 1

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

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

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

44. 0.348 0.837 ↓ 1.0 1,209 1

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

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

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

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

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

  • Buckets: 8192 Batches: 1 Memory Usage: 283kB
47. 1.720 1.720 ↓ 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.720 rows=5,586 loops=1)

  • Filter: (NOT "trpcIsExcluido")
  • Rows Removed by Filter: 8
48. 12.050 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. 109.350 109.350 ↑ 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.449..0.450 rows=1 loops=243)

51. 92.876 92.876 ↑ 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.434..0.434 rows=1 loops=214)

52. 91.796 91.796 ↑ 1,000.0 1 212

Function Scan on proc_common_getnetxbusinessdays (cost=0.25..10.25 rows=1,000 width=32) (actual time=0.433..0.433 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.224 ms
Execution time : 768.034 ms