QUERY PLAN
Aggregate (cost=17.97..17.98 rows=1 width=8)
-> Sort (cost=17.91..17.92 rows=4 width=218)
Sort Key: s.created_at DESC
-> HashAggregate (cost=17.83..17.87 rows=4 width=218)
Group Key: s.id
-> Hash Right Join (cost=7.85..17.74 rows=39 width=12)
Hash Cond: (turs.task_group_id = s.id)
-> Seq Scan on tbl_task_group_user_relationships turs (cost=0.00..7.33 rows=433 width=4)
-> Hash (cost=7.76..7.76 rows=7 width=12)
-> Hash Right Join (cost=5.01..7.76 rows=7 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.96..4.96 rows=4 width=16)
-> Seq Scan on tbl_task_groups s (cost=0.00..4.96 rows=4 width=16)
Filter: (client_id = 2815)