QUERY PLAN
Limit (cost=28.33..28.38 rows=20 width=385)
-> Sort (cost=28.33..28.56 rows=92 width=385)
Sort Key: s.created_at DESC
-> HashAggregate (cost=24.27..25.88 rows=92 width=385)
Group Key: s.id
-> Hash Right Join (cost=13.06..23.96 rows=126 width=369)
Hash Cond: (turs.task_group_id = s.id)
-> Seq Scan on tbl_task_group_user_relationships turs (cost=0.00..7.83 rows=483 width=4)
-> Hash (cost=12.76..12.76 rows=24 width=369)
-> Hash Join (cost=6.07..12.76 rows=24 width=369)
Hash Cond: (thrs.task_group_id = s.id)
-> Seq Scan on tbl_task_group_head_of_relationships thrs (cost=0.00..6.62 rows=24 width=4)
Filter: (user_id = 1001)
-> Hash (cost=4.92..4.92 rows=92 width=369)
-> Seq Scan on tbl_task_groups s (cost=0.00..4.92 rows=92 width=369)