QUERY PLAN
Limit (cost=21.92..21.92 rows=1 width=396)
-> Sort (cost=21.92..21.92 rows=1 width=396)
Sort Key: s.created_at DESC
-> Group (cost=21.84..21.91 rows=1 width=396)
Group Key: s.id
-> Sort (cost=21.84..21.87 rows=11 width=376)
Sort Key: s.id
-> Hash Right Join (cost=10.85..21.65 rows=11 width=376)
Hash Cond: (turs.task_group_id = s.id)
-> Seq Scan on tbl_task_group_user_relationships turs (cost=0.00..8.13 rows=513 width=4)
-> Hash (cost=10.82..10.82 rows=2 width=376)
-> Hash Right Join (cost=6.20..10.82 rows=2 width=376)
Hash Cond: (thrs.task_group_id = s.id)
-> Seq Scan on tbl_task_group_head_of_relationships thrs (cost=0.00..4.06 rows=206 width=4)
-> Hash (cost=6.19..6.19 rows=1 width=376)
-> Seq Scan on tbl_task_groups s (cost=0.00..6.19 rows=1 width=376)
Filter: (client_id = 518)