explain.depesz.com

PostgreSQL's explain analyze made readable

Result: bJ98

Settings

Optimization(s) for this plan:

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

Sort (cost=10,101,032,948,736.70..10,101,032,981,294.97 rows=13,023,308 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'::text) THEN 'IRDR'::text WHEN ((e.cd_evento)::text = '12100' (...)
2. 0.000 0.000 ↓ 0.0

Hash Join (cost=1,597,011.24..10,101,026,602,298.31 rows=13,023,308 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,596,412.24..2,511,995.96 rows=26,046,617 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,596,363.38..2,443,104.33 rows=26,046,617 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,464,636.43..1,635,998.51 rows=26,119,772 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.56..18,355.86 rows=5,249 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.25 rows=5,249 width=0) (actual rows= loops=)

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

Hash (cost=984,987.72..984,987.72 rows=26,119,772 width=20) (actual rows= loops=)

9. 0.000 0.000 ↓ 0.0

Seq Scan on tb_processo_evento pe (cost=0.00..984,987.72 rows=26,119,772 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,292.22..775,292.24 rows=1 width=32) (actual rows= loops=)

37. 0.000 0.000 ↓ 0.0

Nested Loop (cost=3,389.87..775,186.13 rows=42,437 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,381.30..387,576.60 rows=888 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,381.08 rows=177,686 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)