QUERY PLAN
Limit (cost=36.33..36.38 rows=20 width=385)
-> Sort (cost=36.33..36.56 rows=92 width=385)
Sort Key: s.created_at DESC
-> HashAggregate (cost=32.27..33.88 rows=92 width=385)
Group Key: s.id
-> Hash Right Join (cost=21.06..31.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=20.76..20.76 rows=24 width=369)
-> Hash Join (cost=14.07..20.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=12.92..12.92 rows=92 width=369)
-> Seq Scan on tbl_task_groups s (cost=0.00..12.92 rows=92 width=369)