explain.depesz.com

PostgreSQL's explain analyze made readable

Result: QqK3 : Optimization for: plan #7wId

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

Sort (cost=10,114,889,775,772.10..10,114,889,808,352.64 rows=13,032,216 width=264) (actual rows= loops=)

  • Sort Key: ((cs.ds_texto)::integer), (CASE WHEN ((e.cd_evento)::text = '265'::text) THEN 'RG'::text WHEN ((e.cd_evento)::text = '11975'::text) THEN 'RR'::text WHEN ((e.cd_evento)::text = '12099':
2. 0.000 0.000 ↓ 0.0

Hash Join (cost=1,598,013.21..10,114,883,424,930.24 rows=13,032,216 width=264) (actual rows= loops=)

  • Hash Cond: ((e.id_evento)::integer = ("ANY_subquery".id_evento)::integer)
3. 0.000 0.000 ↓ 0.0

Hash Join (cost=1,597,414.21..2,513,619.74 rows=26,064,431 width=69) (actual rows= loops=)

  • Hash Cond: ((pe.id_evento)::integer = (e.id_evento)::integer)
4. 0.000 0.000 ↓ 0.0

Hash Join (cost=1,597,365.35..2,444,681.03 rows=26,064,431 width=60) (actual rows= loops=)

  • Hash Cond: ((pe.id_processo)::integer = (pt.id_processo_trf)::integer)
5. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=1,465,638.40..1,637,119.59 rows=26,137,636 width=18) (actual rows= loops=)

  • Hash Cond: (cs.id_movimento_processo = (pe.id_processo_evento)::integer)
6. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on tb_complemento_segmentado cs (cost=105.59..18,369.99 rows=5,253 width=14) (actual rows= loops=)

  • Recheck Cond: (id_tipo_complemento = ANY ('{52,54}'::bigint[]))
7. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on idx_complemento_segmentado1 (cost=0.00..104.28 rows=5,253 width=0) (actual rows= loops=)

  • Index Cond: (id_tipo_complemento = ANY ('{52,54}'::bigint[]))
8. 0.000 0.000 ↓ 0.0

Hash (cost=985,661.36..985,661.36 rows=26,137,636 width=20) (actual rows= loops=)

9. 0.000 0.000 ↓ 0.0

Seq Scan on tb_processo_evento pe (cost=0.00..985,661.36 rows=26,137,636 width=20) (actual rows= loops=)

10. 0.000 0.000 ↓ 0.0

Hash (cost=108,608.99..108,608.99 rows=1,038,237 width=50) (actual rows= loops=)

11. 0.000 0.000 ↓ 0.0

Hash Join (cost=45,183.44..108,608.99 rows=1,038,237 width=50) (actual rows= loops=)

  • Hash Cond: ((pt.id_orgao_julgador)::integer = (oj.id_orgao_julgador)::integer)
12. 0.000 0.000 ↓ 0.0

Hash Join (cost=45,167.86..105,826.35 rows=1,038,237 width=49) (actual rows= loops=)

  • Hash Cond: ((pt.id_classe_judicial)::integer = (cj.id_classe_judicial)::integer)
13. 0.000 0.000 ↓ 0.0

Hash Join (cost=45,096.94..103,014.70 rows=1,038,237 width=49) (actual rows= loops=)

  • Hash Cond: ((pt.id_processo_trf)::integer = (p.id_processo)::integer)
14. 0.000 0.000 ↓ 0.0

Seq Scan on tb_processo_trf pt (cost=0.00..35,906.37 rows=1,038,237 width=20) (actual rows= loops=)

15. 0.000 0.000 ↓ 0.0

Hash (cost=24,964.53..24,964.53 rows=1,041,153 width=29) (actual rows= loops=)

16. 0.000 0.000 ↓ 0.0

Seq Scan on tb_processo p (cost=0.00..24,964.53 rows=1,041,153 width=29) (actual rows= loops=)

17. 0.000 0.000 ↓ 0.0

Hash (cost=61.52..61.52 rows=752 width=8) (actual rows= loops=)

18. 0.000 0.000 ↓ 0.0

Seq Scan on tb_classe_judicial cj (cost=0.00..61.52 rows=752 width=8) (actual rows= loops=)

19. 0.000 0.000 ↓ 0.0

Hash (cost=12.48..12.48 rows=248 width=9) (actual rows= loops=)

20. 0.000 0.000 ↓ 0.0

Seq Scan on tb_orgao_julgador oj (cost=0.00..12.48 rows=248 width=9) (actual rows= loops=)

21. 0.000 0.000 ↓ 0.0

Hash (cost=41.16..41.16 rows=616 width=9) (actual rows= loops=)

22. 0.000 0.000 ↓ 0.0

Seq Scan on tb_evento e (cost=0.00..41.16 rows=616 width=9) (actual rows= loops=)

23. 0.000 0.000 ↓ 0.0

Hash (cost=596.50..596.50 rows=200 width=4) (actual rows= loops=)

24. 0.000 0.000 ↓ 0.0

HashAggregate (cost=594.50..596.50 rows=200 width=4) (actual rows= loops=)

  • Group Key: ("ANY_subquery".id_evento)::integer
25. 0.000 0.000 ↓ 0.0

Subquery Scan on ANY_subquery (cost=533.62..589.81 rows=1,873 width=4) (actual rows= loops=)

26. 0.000 0.000 ↓ 0.0

CTE Scan on arvore_eventos (cost=533.62..571.08 rows=1,873 width=4) (actual rows= loops=)

27.          

CTE arvore_eventos

28. 0.000 0.000 ↓ 0.0

Recursive Union (cost=13.14..533.62 rows=1,873 width=153) (actual rows= loops=)

29. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on tb_evento e_1 (cost=13.14..22.55 rows=3 width=153) (actual rows= loops=)

  • Recheck Cond: ((cd_evento)::text = ANY ('{265,11975,12099,12100}'::text[]))
  • Filter: in_ativo
30. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on idx_cdevento_idevent_idsup_ativo (cost=0.00..13.14 rows=3 width=0) (actual rows= loops=)

  • Index Cond: (((cd_evento)::text = ANY ('{265,11975,12099,12100}'::text[])) AND (in_ativo = true))
31. 0.000 0.000 ↓ 0.0

Hash Join (cost=0.97..47.36 rows=187 width=153) (actual rows= loops=)

  • Hash Cond: ((e2.id_evento_superior)::integer = (aa.id_evento)::integer)
32. 0.000 0.000 ↓ 0.0

Seq Scan on tb_evento e2 (cost=0.00..41.16 rows=521 width=13) (actual rows= loops=)

  • Filter: in_ativo
33. 0.000 0.000 ↓ 0.0

Hash (cost=0.60..0.60 rows=30 width=149) (actual rows= loops=)

34. 0.000 0.000 ↓ 0.0

WorkTable Scan on arvore_eventos aa (cost=0.00..0.60 rows=30 width=149) (actual rows= loops=)

35.          

SubPlan (forHash Join)

36. 0.000 0.000 ↓ 0.0

Aggregate (cost=775,825.34..775,825.35 rows=1 width=32) (actual rows= loops=)

37. 0.000 0.000 ↓ 0.0

Nested Loop (cost=3,394.78..775,719.17 rows=42,466 width=8) (actual rows= loops=)

38. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on tb_evento e1 (cost=8.57..15.16 rows=2 width=9) (actual rows= loops=)

  • Recheck Cond: (((cd_evento)::text = '848'::text) OR ((cd_evento)::text = '246'::text))
39. 0.000 0.000 ↓ 0.0

BitmapOr (cost=8.57..8.57 rows=2 width=0) (actual rows= loops=)

40. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on idx_evento_cdevento_id_evento (cost=0.00..4.28 rows=1 width=0) (actual rows= loops=)

  • Index Cond: ((cd_evento)::text = '848'::text)
41. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on idx_evento_cdevento_id_evento (cost=0.00..4.28 rows=1 width=0) (actual rows= loops=)

  • Index Cond: ((cd_evento)::text = '246'::text)
42. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on tb_processo_evento pe1 (cost=3,386.21..387,843.12 rows=889 width=16) (actual rows= loops=)

  • Recheck Cond: ((id_evento)::integer = (e1.id_evento)::integer)
  • Filter: ((((id_processo)::integer = (pe.id_processo)::integer) AND ((e1.cd_evento)::text = '848'::text)) OR ((e1.cd_evento)::text = '246'::text))
43. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on idx_tb_processo_evento2 (cost=0.00..3,385.99 rows=177,807 width=0) (actual rows= loops=)

  • Index Cond: ((id_evento)::integer = (e1.id_evento)::integer)
44. 0.000 0.000 ↓ 0.0

Aggregate (cost=318.95..318.96 rows=1 width=32) (actual rows= loops=)

45. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.71..318.94 rows=1 width=8) (actual rows= loops=)

  • Join Filter: ((pe1_1.id_evento)::integer = (e1_1.id_evento)::integer)
46. 0.000 0.000 ↓ 0.0

Index Only Scan using idx_evento_cdevento_id_evento on tb_evento e1_1 (cost=0.28..8.29 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (cd_evento = '848'::text)
47. 0.000 0.000 ↓ 0.0

Index Scan using idx_tb_processo_evento1 on tb_processo_evento pe1_1 (cost=0.44..307.98 rows=214 width=12) (actual rows= loops=)

  • Index Cond: ((id_processo)::integer = (pe.id_processo)::integer)