explain.depesz.com

PostgreSQL's explain analyze made readable

Result: rMhC

Settings
# exclusive inclusive rows x rows loops node
1. 0.005 0.095 ↑ 1.0 1 1

Aggregate (cost=14,033.51..14,033.52 rows=1 width=8) (actual time=0.095..0.095 rows=1 loops=1)

2. 0.016 0.090 ↓ 0.0 0 1

Sort (cost=14,033.29..14,033.33 rows=15 width=8) (actual time=0.090..0.090 rows=0 loops=1)

  • Sort Key: x2.created DESC
  • Sort Method: quicksort Memory: 25kB
3. 0.000 0.074 ↓ 0.0 0 1

Merge Join (cost=14,019.46..14,033.00 rows=15 width=8) (actual time=0.074..0.074 rows=0 loops=1)

  • Merge Cond: (profile_hierarchical_children.child_profile_id = x2.aggregate_id)
4. 0.000 0.074 ↓ 0.0 0 1

Unique (cost=13,986.00..13,989.86 rows=756 width=32) (actual time=0.074..0.074 rows=0 loops=1)

5.          

CTE profile_hierarchical_children

6. 0.005 0.066 ↑ 154,560.0 1 1

Recursive Union (cost=0.00..10,471.32 rows=154,560 width=36) (actual time=0.017..0.066 rows=1 loops=1)

7. 0.013 0.013 ↑ 960.0 1 1

Seq Scan on partner_user_relationships (cost=0.00..19.60 rows=960 width=36) (actual time=0.013..0.013 rows=1 loops=1)

8. 0.000 0.048 ↓ 0.0 0 1

Merge Join (cost=402.45..736.05 rows=15,360 width=36) (actual time=0.048..0.048 rows=0 loops=1)

  • Merge Cond: (pur.parent_profile_id = c.child_profile_id)
9. 0.038 0.038 ↑ 960.0 1 1

Index Only Scan using partner_user_relationships_parent_child_unique on partner_user_relationships pur (cost=0.15..62.55 rows=960 width=32) (actual time=0.037..0.038 rows=1 loops=1)

  • Heap Fetches: 1
10. 0.007 0.010 ↑ 3,200.0 1 1

Sort (cost=402.30..410.30 rows=3,200 width=36) (actual time=0.010..0.010 rows=1 loops=1)

  • Sort Key: c.child_profile_id
  • Sort Method: quicksort Memory: 25kB
11. 0.003 0.003 ↑ 3,200.0 1 1

WorkTable Scan on profile_hierarchical_children c (cost=0.00..216.00 rows=3,200 width=36) (actual time=0.002..0.003 rows=1 loops=1)

  • Filter: (depth < 10)
12. 0.007 0.074 ↓ 0.0 0 1

Sort (cost=3,514.68..3,516.61 rows=773 width=32) (actual time=0.074..0.074 rows=0 loops=1)

  • Sort Key: profile_hierarchical_children.child_profile_id
  • Sort Method: quicksort Memory: 25kB
13. 0.067 0.067 ↓ 0.0 0 1

CTE Scan on profile_hierarchical_children (cost=0.00..3,477.60 rows=773 width=32) (actual time=0.067..0.067 rows=0 loops=1)

  • Filter: (parent_profile_id = '1aea7152-1fd3-45c1-b4f6-03639a6acc73'::uuid)
  • Rows Removed by Filter: 1
14. 0.000 0.000 ↓ 0.0 0

Sort (cost=33.46..33.47 rows=4 width=24) (never executed)

  • Sort Key: x2.aggregate_id
15. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=21.05..33.42 rows=4 width=24) (never executed)

  • Hash Cond: (x2.id = partner_user_roles.user_profile_id)
16. 0.000 0.000 ↓ 0.0 0

Seq Scan on partner_user_profiles x2 (cost=0.00..11.70 rows=170 width=32) (never executed)

17. 0.000 0.000 ↓ 0.0 0

Hash (cost=21.00..21.00 rows=4 width=8) (never executed)

  • -> Seq Scan on partner_user_roles (cost=0.00..21.00 rows=4 width=8) (never executed)" Filter: (role = 'AGENT'::text)