QUERY PLAN
Aggregate (cost=35.15..35.16 rows=1 width=8)
-> Sort (cost=34.00..34.19 rows=77 width=218)
Sort Key: s.created_at DESC
-> HashAggregate (cost=30.82..31.59 rows=77 width=218)
Group Key: s.id
-> Hash Right Join (cost=10.20..28.71 rows=842 width=12)
Hash Cond: (turs.task_group_id = s.id)
-> Seq Scan on tbl_task_group_user_relationships turs (cost=0.00..7.73 rows=473 width=4)
-> Hash (cost=8.48..8.48 rows=137 width=12)
-> Hash Right Join (cost=5.73..8.48 rows=137 width=12)
Hash Cond: (thrs.task_group_id = s.id)
-> Seq Scan on tbl_task_group_head_of_relationships thrs (cost=0.00..2.37 rows=137 width=4)
-> Hash (cost=4.77..4.77 rows=77 width=16)
-> Seq Scan on tbl_task_groups s (cost=0.00..4.77 rows=77 width=16)