Skip to content

Instantly share code, notes, and snippets.

@light-flight
Created January 29, 2025 11:45
Show Gist options
  • Save light-flight/a955d0f05eb966278e2ba0c701de4cba to your computer and use it in GitHub Desktop.
Save light-flight/a955d0f05eb966278e2ba0c701de4cba to your computer and use it in GitHub Desktop.
HashAggregate (cost=8.16..8.62 rows=37 width=13)
Group Key: courses.id
-> Hash Join (cost=4.87..7.80 rows=48 width=20)
Hash Cond: (discountings.discountable_id = courses.id)
-> Hash Join (cost=2.04..4.83 rows=48 width=24)
Hash Cond: (discountings.discount_id = discounts.id)
-> Seq Scan on discountings (cost=0.00..2.60 rows=48 width=16)
Filter: ((discountable_type)::text = 'Course'::text)
-> Hash (cost=2.02..2.02 rows=1 width=24)
-> Nested Loop Left Join (cost=0.00..2.02 rows=1 width=24)
Join Filter: (users_discounts.discount_id = discounts.id)
Filter: ((users_discounts.user_id = '41'::bigint) OR (users_discounts.user_id IS NULL))
-> Seq Scan on discounts (cost=0.00..1.00 rows=1 width=16)
-> Seq Scan on users_discounts (cost=0.00..1.01 rows=1 width=16)
-> Hash (cost=2.37..2.37 rows=37 width=4)
-> Seq Scan on courses (cost=0.00..2.37 rows=37 width=4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment