QUERY PLAN
Aggregate (cost=17.42..17.43 rows=1 width=8)
-> Sort (cost=17.40..17.41 rows=1 width=218)
Sort Key: s.created_at DESC
-> HashAggregate (cost=17.38..17.39 rows=1 width=218)
Group Key: s.id
-> Hash Right Join (cost=7.75..17.36 rows=11 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.73..7.73 rows=2 width=12)
-> Hash Right Join (cost=4.98..7.73 rows=2 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=1 width=16)
-> Seq Scan on tbl_task_groups s (cost=0.00..4.96 rows=1 width=16)
Filter: (project_id = 3810)