explain.depesz.com

PostgreSQL's explain analyze made readable

Result: obTe

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

Hash Right Join (cost=5.44..28.54 rows=5 width=666) (actual rows= loops=)

  • Hash Cond: (course_templates.id = enrollments.course_template_id)
  • Filter: ((course_templates.domain_id = ANY ('{1,2}'::bigint[])) OR (alternatives: SubPlan 1 or hashed SubPlan 2))
2. 0.000 0.000 ↓ 0.0

Seq Scan on course_templates (cost=0.00..10.40 rows=40 width=16) (actual rows= loops=)

3. 0.000 0.000 ↓ 0.0

Hash (cost=5.32..5.32 rows=10 width=666) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Hash Join (cost=1.23..5.32 rows=10 width=666) (actual rows= loops=)

  • Hash Cond: (users.id = enrollments.user_id)
5. 0.000 0.000 ↓ 0.0

Seq Scan on users (cost=0.00..3.76 rows=61 width=8) (actual rows= loops=)

  • Filter: (sub_account_id = 1)
6. 0.000 0.000 ↓ 0.0

Hash (cost=1.10..1.10 rows=10 width=666) (actual rows= loops=)

7. 0.000 0.000 ↓ 0.0

Seq Scan on enrollments (cost=0.00..1.10 rows=10 width=666) (actual rows= loops=)

8.          

SubPlan (forHash Right Join)

9. 0.000 0.000 ↓ 0.0

Seq Scan on affiliated_sub_accounts (cost=0.00..1.23 rows=1 width=0) (actual rows= loops=)

  • Filter: ((deleted_at IS NULL) AND (domain_id = ANY ('{1,2}'::bigint[])) AND (item_id = course_templates.id) AND ((item_type)::text = 'CourseTemplate'::text))
10. 0.000 0.000 ↓ 0.0

Seq Scan on affiliated_sub_accounts affiliated_sub_accounts_1 (cost=0.00..1.20 rows=1 width=8) (actual rows= loops=)

  • Filter: ((deleted_at IS NULL) AND (domain_id = ANY ('{1,2}'::bigint[])) AND ((item_type)::text = 'CourseTemplate'::text))