explain.depesz.com

PostgreSQL's explain analyze made readable

Result: TovG

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

CTE Scan on fc (cost=630,766,027.15..1,744,967,134.41 rows=55,710,055,363 width=552) (actual rows= loops=)

2.          

CTE entid

3. 0.000 0.000 ↓ 0.0

Index Only Scan using ents_pkey on ents e_1 (cost=44,131.85..66,396.35 rows=482,748 width=4) (actual rows= loops=)

  • Filter: ((id = 75584) OR (hashed SubPlan 2))
4.          

SubPlan (forIndex Only Scan)

5. 0.000 0.000 ↓ 0.0

Nested Loop (cost=42,619.69..42,924.56 rows=482,747 width=4) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

HashAggregate (cost=42,619.26..42,621.26 rows=200 width=4) (actual rows= loops=)

  • Group Key: final_sub.entity_id
7. 0.000 0.000 ↓ 0.0

CTE Scan on final_sub (cost=41,776.50..42,295.12 rows=25,931 width=4) (actual rows= loops=)

8.          

CTE final_sub

9. 0.000 0.000 ↓ 0.0

Recursive Union (cost=0.42..41,776.50 rows=25,931 width=4) (actual rows= loops=)

10. 0.000 0.000 ↓ 0.0

Index Scan using idx_ent_relationships_related_ent_id on ent_relationships er (cost=0.42..40.00 rows=161 width=4) (actual rows= loops=)

  • Index Cond: (related_ent_id = 75584)
11. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.42..4,121.79 rows=2,577 width=4) (actual rows= loops=)

12. 0.000 0.000 ↓ 0.0

WorkTable Scan on final_sub fs (cost=0.00..32.20 rows=1,610 width=4) (actual rows= loops=)

13. 0.000 0.000 ↓ 0.0

Index Scan using idx_ent_relationships_related_ent_id on ent_relationships er_1 (cost=0.42..2.52 rows=2 width=8) (actual rows= loops=)

  • Index Cond: (related_ent_id = fs.entity_id)
  • Filter: (ent_relationship_type_id = ANY ('{1,2,6}'::integer[]))
14. 0.000 0.000 ↓ 0.0

Index Only Scan using ents_pkey on ents e (cost=0.42..1.51 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = final_sub.entity_id)
  • Filter: (id <> 75584)
15.          

CTE fc

16. 0.000 0.000 ↓ 0.0

Hash Join (cost=2,856,367.88..630,699,630.80 rows=55,710,055,363 width=71) (actual rows= loops=)

  • Hash Cond: (lp.lit_party_type_id = lpt.id)
17. 0.000 0.000 ↓ 0.0

Nested Loop (cost=2.56..710,597.44 rows=115,410 width=75) (actual rows= loops=)

18. 0.000 0.000 ↓ 0.0

Nested Loop (cost=2.00..540,897.62 rows=115,410 width=20) (actual rows= loops=)

19. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.43..225,830.72 rows=115,410 width=16) (actual rows= loops=)

  • Join Filter: (l.id = lpm.lit_id)
20. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.01..159,115.27 rows=80,830 width=12) (actual rows= loops=)

21. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.58..73,894.59 rows=80,830 width=16) (actual rows= loops=)

22. 0.000 0.000 ↓ 0.0

Index Scan using lit_parties_lit_party_type_id_idx on lit_parties lp (cost=0.29..18,407.54 rows=80,830 width=12) (actual rows= loops=)

23. 0.000 0.000 ↓ 0.0

Index Only Scan using lits_pkey on lits l (cost=0.29..0.68 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = lp.lit_id)
24. 0.000 0.000 ↓ 0.0

Index Only Scan using alias_ent_details_alias_id_idx on alias_ent_details aed (cost=0.43..1.04 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (alias_id = lp.alias_id)
25. 0.000 0.000 ↓ 0.0

Index Only Scan using lits_pats_map_lit_id_patnum_idx on lits_pats_map lpm (cost=0.41..0.81 rows=1 width=16) (actual rows= loops=)

  • Index Cond: (lit_id = lp.lit_id)
26. 0.000 0.000 ↓ 0.0

Index Scan using all_pats_new_patnum_idx on all_pats pa (cost=0.57..2.72 rows=1 width=16) (actual rows= loops=)

  • Index Cond: ((patnum)::text = (lpm.patnum)::text)
27. 0.000 0.000 ↓ 0.0

Index Scan using int_pats_tmp_pkey on int_pats pats (cost=0.57..1.46 rows=1 width=63) (actual rows= loops=)

  • Index Cond: (id = pa.id)
28. 0.000 0.000 ↓ 0.0

Hash (cost=1,240,667.91..1,240,667.91 rows=98,480,592 width=4) (actual rows= loops=)

29. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.00..1,240,667.91 rows=98,480,592 width=4) (actual rows= loops=)

30. 0.000 0.000 ↓ 0.0

CTE Scan on entid (cost=0.00..9,654.96 rows=482,748 width=0) (actual rows= loops=)