explain.depesz.com

PostgreSQL's explain analyze made readable

Result: xoV0 : Optimization for: Optimization for: plan #CI54; plan #Pkg6

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.096 593.762 ↑ 1.3 35 1

GroupAggregate (cost=41,577.14..41,580.31 rows=47 width=92) (actual time=593.677..593.762 rows=35 loops=1)

  • Group Key: t."tasID", t."tasDescricao", t.mes, t."tostemID
2. 0.105 593.666 ↓ 1.3 60 1

Sort (cost=41,577.14..41,577.25 rows=47 width=84) (actual time=593.654..593.666 rows=60 loops=1)

  • Sort Key: t."tasID", t."tasDescricao", t.mes, t."tostemID
  • Sort Method: quicksort Memory: 33kB
3. 0.039 593.561 ↓ 1.3 60 1

Subquery Scan on t (cost=2,249.84..41,575.83 rows=47 width=84) (actual time=115.665..593.561 rows=60 loops=1)

4. 0.042 593.522 ↓ 1.3 60 1

Append (cost=2,249.84..41,575.36 rows=47 width=84) (actual time=115.664..593.522 rows=60 loops=1)

5. 1.181 593.373 ↓ 2.3 25 1

GroupAggregate (cost=2,249.84..41,542.12 rows=11 width=89) (actual time=115.662..593.373 rows=25 loops=1)

  • Group Key: tas."tasID", tos."tostemID
6. 1.123 62.342 ↓ 137.5 1,513 1

Sort (cost=2,249.84..2,249.87 rows=11 width=49) (actual time=61.885..62.342 rows=1,513 loops=1)

  • Sort Key: tas."tasID
  • Sort Method: quicksort Memory: 189kB
7. 1.979 61.219 ↓ 137.5 1,513 1

Nested Loop (cost=0.99..2,249.65 rows=11 width=49) (actual time=0.081..61.219 rows=1,513 loops=1)

8. 1.415 57.727 ↓ 137.5 1,513 1

Nested Loop (cost=0.85..2,247.60 rows=11 width=12) (actual time=0.077..57.727 rows=1,513 loops=1)

9. 1.039 53.286 ↓ 137.5 1,513 1

Nested Loop (cost=0.57..2,230.41 rows=11 width=12) (actual time=0.071..53.286 rows=1,513 loops=1)

10. 4.536 46.713 ↓ 131.8 2,767 1

Subquery Scan on tlsos (cost=0.29..2,071.85 rows=21 width=4) (actual time=0.061..46.713 rows=2,767 loops=1)

  • Filter: ((tlsos."tlsosSituacao" = ANY ('{3,9}'::integer[])) AND (tlsos.r = 1))
  • Rows Removed by Filter: 11487
11. 11.652 42.177 ↑ 1.0 14,254 1

WindowAgg (cost=0.29..1,854.97 rows=14,459 width=68) (actual time=0.036..42.177 rows=14,254 loops=1)

12. 30.525 30.525 ↑ 1.0 14,254 1

Index Scan using idx_tlsos_tlsostosdesc on "TabLogSituacaoOrdemServico" (cost=0.29..1,601.93 rows=14,459 width=12) (actual time=0.029..30.525 rows=14,254 loops=1)

  • Filter: ("tlsosDataHora" < (date_trunc('month'::text, (('2019-1-1'::cstring)::date)::timestamp with time zone) + '1 mon -00:00:01'::interval))
  • Rows Removed by Filter: 6826
13. 5.534 5.534 ↑ 1.0 1 2,767

Index Scan using "TabOrdemServico_Unique_tosID_tostemID" on "TabOrdemServico" tos (cost=0.28..7.54 rows=1 width=12) (actual time=0.001..0.002 rows=1 loops=2,767)

  • Index Cond: (("tosID" = tlsos."tlsostosID") AND ("tostemID" = 1))
14. 3.026 3.026 ↑ 1.0 1 1,513

Index Scan using "TabPropostaComercial_tpcID" on "TabPropostaComercial" tpc (cost=0.28..1.55 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=1,513)

  • Index Cond: ("tpcID" = tos."tostpcID")
15. 1.513 1.513 ↑ 1.0 1 1,513

Index Scan using "TabAssessoria_tasID" on "TabAssessoria" tas (cost=0.14..0.18 rows=1 width=41) (actual time=0.001..0.001 rows=1 loops=1,513)

  • Index Cond: ("tasID" = tpc."tpctasID")
16.          

SubPlan (for GroupAggregate)

17. 0.450 130.925 ↑ 1.0 1 25

Aggregate (cost=892.99..893.00 rows=1 width=8) (actual time=5.237..5.237 rows=1 loops=25)

18. 3.345 130.475 ↓ 47.0 47 25

Nested Loop (cost=4.52..892.98 rows=1 width=16) (actual time=0.799..5.219 rows=47 loops=25)

19. 82.700 82.700 ↓ 8.4 118 25

Seq Scan on "TabReceita" trec (cost=0.00..291.29 rows=14 width=4) (actual time=0.249..3.308 rows=118 loops=25)

  • Filter: ("trectosID" = ANY (array_agg(tos."tosID")))
  • Rows Removed by Filter: 8048
20. 35.544 44.430 ↓ 0.0 0 2,962

Bitmap Heap Scan on "TabReceitaParcela" trp (cost=4.52..42.97 rows=1 width=20) (actual time=0.013..0.015 rows=0 loops=2,962)

  • Recheck Cond: ("trptrecID" = trec."trecID")
  • Filter: (("trpSubstituida" IS FALSE) AND ("trpBaixada" IS FALSE) AND (NOT "trpIsExcluido") AND (date_part('month'::text, ("trpDataVencimento")::timestamp without time zone) = '1'::double precision) AND (date_part('year'::text, ("trpDataVencimento")::timestamp without time zone) = '2019'::double precision))
  • Rows Removed by Filter: 11
  • Heap Blocks: exact=22340
21. 8.886 8.886 ↓ 1.1 11 2,962

Bitmap Index Scan on idx_trp_trecid_trpsubstituida (cost=0.00..4.52 rows=10 width=0) (actual time=0.003..0.003 rows=11 loops=2,962)

  • Index Cond: (("trptrecID" = trec."trecID") AND ("trpSubstituida" = false))
22. 0.375 134.550 ↑ 1.0 1 25

Aggregate (cost=892.99..893.00 rows=1 width=8) (actual time=5.382..5.382 rows=1 loops=25)

23. 3.183 134.175 ↓ 47.0 47 25

Nested Loop (cost=4.52..892.98 rows=1 width=8) (actual time=0.789..5.367 rows=47 loops=25)

24. 83.600 83.600 ↓ 8.4 118 25

Seq Scan on "TabReceita" trec_1 (cost=0.00..291.29 rows=14 width=4) (actual time=0.244..3.344 rows=118 loops=25)

  • Filter: ("trectosID" = ANY (array_agg(tos."tosID")))
  • Rows Removed by Filter: 8048
25. 38.506 47.392 ↓ 0.0 0 2,962

Bitmap Heap Scan on "TabReceitaParcela" trp_1 (cost=4.52..42.97 rows=1 width=12) (actual time=0.014..0.016 rows=0 loops=2,962)

  • Recheck Cond: ("trptrecID" = trec_1."trecID")
  • Filter: (("trpSubstituida" IS FALSE) AND ("trpBaixada" IS FALSE) AND (NOT "trpIsExcluido") AND (date_part('month'::text, COALESCE(("trpDataCompensacao")::timestamp with time zone, "trpDataRecebimento")) = '1'::double precision) AND (date_part('year'::text, COALESCE(("trpDataCompensacao")::timestamp with time zone, "trpDataRecebimento")) = '2019'::double precision))
  • Rows Removed by Filter: 11
  • Heap Blocks: exact=22340
26. 8.886 8.886 ↓ 1.1 11 2,962

Bitmap Index Scan on idx_trp_trecid_trpsubstituida (cost=0.00..4.52 rows=10 width=0) (actual time=0.003..0.003 rows=11 loops=2,962)

  • Index Cond: (("trptrecID" = trec_1."trecID") AND ("trpSubstituida" = false))
27. 0.425 135.075 ↑ 1.0 1 25

Aggregate (cost=892.99..893.00 rows=1 width=8) (actual time=5.402..5.403 rows=1 loops=25)

28. 2.221 134.650 ↓ 47.0 47 25

Nested Loop (cost=4.52..892.98 rows=1 width=4) (actual time=0.784..5.386 rows=47 loops=25)

29. 82.075 82.075 ↓ 8.4 118 25

Seq Scan on "TabReceita" trec_2 (cost=0.00..291.29 rows=14 width=4) (actual time=0.244..3.283 rows=118 loops=25)

  • Filter: ("trectosID" = ANY (array_agg(tos."tosID")))
  • Rows Removed by Filter: 8048
30. 41.468 50.354 ↓ 0.0 0 2,962

Bitmap Heap Scan on "TabReceitaParcela" trp_2 (cost=4.52..42.97 rows=1 width=8) (actual time=0.015..0.017 rows=0 loops=2,962)

  • Recheck Cond: ("trptrecID" = trec_2."trecID")
  • Filter: (("trpSubstituida" IS FALSE) AND ("trpBaixada" IS FALSE) AND (NOT "trpIsExcluido") AND (date_part('month'::text, COALESCE(("trpDataCompensacao")::timestamp with time zone, "trpDataRecebimento")) = '1'::double precision) AND (date_part('year'::text, COALESCE(("trpDataCompensacao")::timestamp with time zone, "trpDataRecebimento")) = '2019'::double precision))
  • Rows Removed by Filter: 11
  • Heap Blocks: exact=22340
31. 8.886 8.886 ↓ 1.1 11 2,962

Bitmap Index Scan on idx_trp_trecid_trpsubstituida (cost=0.00..4.52 rows=10 width=0) (actual time=0.003..0.003 rows=11 loops=2,962)

  • Index Cond: (("trptrecID" = trec_2."trecID") AND ("trpSubstituida" = false))
32. 0.425 129.300 ↑ 1.0 1 25

Aggregate (cost=892.99..893.00 rows=1 width=8) (actual time=5.172..5.172 rows=1 loops=25)

33. 1.920 128.875 ↓ 47.0 47 25

Nested Loop (cost=4.52..892.98 rows=1 width=4) (actual time=0.794..5.155 rows=47 loops=25)

34. 82.525 82.525 ↓ 8.4 118 25

Seq Scan on "TabReceita" trec_3 (cost=0.00..291.29 rows=14 width=4) (actual time=0.243..3.301 rows=118 loops=25)

  • Filter: ("trectosID" = ANY (array_agg(tos."tosID")))
  • Rows Removed by Filter: 8048
35. 35.544 44.430 ↓ 0.0 0 2,962

Bitmap Heap Scan on "TabReceitaParcela" trp_3 (cost=4.52..42.97 rows=1 width=8) (actual time=0.013..0.015 rows=0 loops=2,962)

  • Recheck Cond: ("trptrecID" = trec_3."trecID")
  • Filter: (("trpSubstituida" IS FALSE) AND ("trpBaixada" IS FALSE) AND (NOT "trpIsExcluido") AND (date_part('month'::text, ("trpDataVencimento")::timestamp without time zone) = '1'::double precision) AND (date_part('year'::text, ("trpDataVencimento")::timestamp without time zone) = '2019'::double precision))
  • Rows Removed by Filter: 11
  • Heap Blocks: exact=22340
36. 8.886 8.886 ↓ 1.1 11 2,962

Bitmap Index Scan on idx_trp_trecid_trpsubstituida (cost=0.00..4.52 rows=10 width=0) (actual time=0.003..0.003 rows=11 loops=2,962)

  • Index Cond: (("trptrecID" = trec_3."trecID") AND ("trpSubstituida" = false))
37. 0.027 0.107 ↑ 1.0 35 1

Subquery Scan on *SELECT* 2 (cost=0.00..33.14 rows=36 width=89) (actual time=0.017..0.107 rows=35 loops=1)

38. 0.080 0.080 ↑ 1.0 35 1

Seq Scan on "TabAssessoria" (cost=0.00..32.33 rows=36 width=69) (actual time=0.010..0.080 rows=35 loops=1)

  • Filter: ("tastemID" = 1)
  • Rows Removed by Filter: 72
Planning time : 60.226 ms
Execution time : 595.881 ms