QUERY PLAN
Limit (cost=18.52..18.53 rows=1 width=463)
-> Sort (cost=18.52..18.53 rows=1 width=463)
Sort Key: s.created_at DESC
-> HashAggregate (cost=18.49..18.51 rows=1 width=463)
Group Key: s.id
-> Hash Right Join (cost=8.24..18.46 rows=14 width=443)
Hash Cond: (turs.task_group_id = s.id)
-> Seq Scan on tbl_task_group_user_relationships turs (cost=0.00..7.73 rows=473 width=4)
-> Hash (cost=8.22..8.22 rows=2 width=443)
-> Hash Right Join (cost=4.98..8.22 rows=2 width=443)
Hash Cond: (thrs.task_group_id = s.id)
-> Seq Scan on tbl_task_group_head_of_relationships thrs (cost=0.00..2.76 rows=176 width=4)
-> Hash (cost=4.96..4.96 rows=1 width=443)
-> Seq Scan on tbl_task_groups s (cost=0.00..4.96 rows=1 width=443)
Filter: (client_id = 2815)