QUERY PLAN
Limit (cost=28.51..28.56 rows=20 width=388)
-> Sort (cost=28.51..28.73 rows=91 width=388)
Sort Key: s.created_at DESC
-> HashAggregate (cost=24.49..26.08 rows=91 width=388)
Group Key: s.id
-> Hash Right Join (cost=12.05..23.96 rows=212 width=372)
Hash Cond: (turs.task_group_id = s.id)
-> Seq Scan on tbl_task_group_user_relationships turs (cost=0.00..7.94 rows=494 width=4)
-> Hash (cost=11.56..11.56 rows=39 width=372)
-> Hash Join (cost=7.05..11.56 rows=39 width=372)
Hash Cond: (thrs.task_group_id = s.id)
-> Seq Scan on tbl_task_group_head_of_relationships thrs (cost=0.00..4.41 rows=39 width=4)
Filter: (user_id = 1000)
-> Hash (cost=5.91..5.91 rows=91 width=372)
-> Seq Scan on tbl_task_groups s (cost=0.00..5.91 rows=91 width=372)