QUERY PLAN
Limit (cost=21.40..21.41 rows=2 width=396)
-> Sort (cost=21.40..21.41 rows=2 width=396)
Sort Key: s.created_at DESC
-> HashAggregate (cost=21.36..21.39 rows=2 width=396)
Group Key: s.id
-> Hash Right Join (cost=10.67..21.30 rows=23 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=10.62..10.62 rows=4 width=372)
-> Hash Right Join (cost=6.16..10.62 rows=4 width=372)
Hash Cond: (thrs.task_group_id = s.id)
-> Seq Scan on tbl_task_group_head_of_relationships thrs (cost=0.00..3.93 rows=193 width=8)
-> Hash (cost=6.14..6.14 rows=2 width=372)
-> Seq Scan on tbl_task_groups s (cost=0.00..6.14 rows=2 width=372)
Filter: (client_id = 982)