explain.depesz.com

PostgreSQL's explain analyze made readable

Result: D28I

Settings
# exclusive inclusive rows x rows loops node
1. 0.025 55.090 ↑ 1.0 1 1

Limit (cost=2,152.94..2,152.95 rows=1 width=28) (actual time=55.066..55.090 rows=1 loops=1)

2. 0.014 55.065 ↑ 1.0 1 1

Sort (cost=2,152.94..2,152.95 rows=1 width=28) (actual time=55.064..55.065 rows=1 loops=1)

  • Sort Key: tlsos."tlsosDataHora" DESC
  • Sort Method: quicksort Memory: 25kB
3. 0.182 55.051 ↓ 2.0 2 1

Nested Loop Left Join (cost=500.72..2,152.93 rows=1 width=28) (actual time=24.647..55.051 rows=2 loops=1)

  • Join Filter: (tcgc."tcgctclID" = tce."tcetclID")
  • Rows Removed by Join Filter: 718
4. 0.084 54.709 ↓ 2.0 2 1

Nested Loop (cost=500.72..2,142.94 rows=1 width=24) (actual time=24.595..54.709 rows=2 loops=1)

  • Join Filter: (tfu."tfuID" = tui_vendedor."tuitfuID")
  • Rows Removed by Join Filter: 236
5. 0.068 54.495 ↓ 2.0 2 1

Nested Loop (cost=500.72..2,129.81 rows=1 width=28) (actual time=24.476..54.495 rows=2 loops=1)

  • Join Filter: (tpc."tpctfuID" = tfu."tfuID")
  • Rows Removed by Join Filter: 246
6. 0.012 54.299 ↓ 2.0 2 1

Nested Loop (cost=500.72..2,115.40 rows=1 width=24) (actual time=24.449..54.299 rows=2 loops=1)

7. 1.550 54.269 ↓ 2.0 2 1

Nested Loop (cost=500.44..2,108.53 rows=1 width=24) (actual time=24.436..54.269 rows=2 loops=1)

  • Join Filter: (tos."tosID" = tlsos."tlsostosID")
  • Rows Removed by Join Filter: 6370
8. 0.032 4.393 ↓ 2.0 2 1

Merge Join (cost=500.15..670.28 rows=1 width=16) (actual time=4.120..4.393 rows=2 loops=1)

  • Merge Cond: (tos."tostclID" = tce."tcetclID")
9. 0.065 4.343 ↓ 2.7 68 1

Subquery Scan on tos (cost=499.87..660.58 rows=25 width=12) (actual time=4.070..4.343 rows=68 loops=1)

  • Filter: (tos.t = 1)
  • Rows Removed by Filter: 119
10. 0.159 4.278 ↑ 26.4 187 1

WindowAgg (cost=499.87..598.77 rows=4,945 width=266) (actual time=4.063..4.278 rows=187 loops=1)

11. 2.435 4.119 ↑ 26.4 187 1

Sort (cost=499.87..512.23 rows=4,945 width=12) (actual time=4.056..4.119 rows=187 loops=1)

  • Sort Key: "TabOrdemServico"."tostclID", "TabOrdemServico"."tosID" DESC
  • Sort Method: quicksort Memory: 425kB
12. 1.684 1.684 ↓ 1.0 4,969 1

Seq Scan on "TabOrdemServico" (cost=0.00..196.45 rows=4,945 width=12) (actual time=0.008..1.684 rows=4,969 loops=1)

13. 0.018 0.018 ↑ 1.0 2 1

Index Scan using "TabClienteEmpresa_unique_tcetclID_tcetemID" on "TabClienteEmpresa" tce (cost=0.28..16.05 rows=2 width=8) (actual time=0.007..0.018 rows=2 loops=1)

  • Index Cond: (("tcetclID" = ANY ('{7,69}'::integer[])) AND ("tcetemID" = 6))
14. 9.518 48.326 ↓ 132.8 3,186 2

Subquery Scan on tlsos (cost=0.29..1,437.94 rows=24 width=12) (actual time=0.025..24.163 rows=3,186 loops=2)

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

WindowAgg (cost=0.29..1,193.28 rows=16,311 width=68) (actual time=0.011..19.404 rows=16,314 loops=2)

16. 13.606 13.606 ↓ 1.0 16,314 2

Index Scan using idx_tlsos_tlsostosdesc on "TabLogSituacaoOrdemServico" (cost=0.29..907.84 rows=16,311 width=20) (actual time=0.008..6.803 rows=16,314 loops=2)

17. 0.018 0.018 ↑ 1.0 1 2

Index Scan using "TabPropostaComercial_tpcID" on "TabPropostaComercial" tpc (cost=0.28..6.86 rows=1 width=8) (actual time=0.009..0.009 rows=1 loops=2)

  • Index Cond: ("tpcID" = tos."tostpcID")
18. 0.128 0.128 ↑ 1.0 124 2

Seq Scan on "TabFuncionario" tfu (cost=0.00..12.86 rows=124 width=4) (actual time=0.007..0.064 rows=124 loops=2)

  • Filter: ("tfuAtivo" IS TRUE)
  • Rows Removed by Filter: 162
19. 0.130 0.130 ↑ 1.0 119 2

Seq Scan on "TabUsuarioInterno" tui_vendedor (cost=0.00..11.65 rows=119 width=8) (actual time=0.004..0.065 rows=119 loops=2)

  • Filter: ("tuiAtivo" IS TRUE)
  • Rows Removed by Filter: 146
20. 0.160 0.160 ↓ 1.0 360 2

Seq Scan on "TabClienteGrupoCliente" tcgc (cost=0.00..5.55 rows=355 width=8) (actual time=0.007..0.080 rows=360 loops=2)

Planning time : 1.657 ms
Execution time : 55.241 ms