QUERY PLAN
Limit (cost=26.90..26.95 rows=20 width=388)
-> Sort (cost=26.85..27.07 rows=87 width=388)
Sort Key: s.created_at DESC
-> HashAggregate (cost=22.58..24.10 rows=87 width=388)
Group Key: s.id
-> Hash Right Join (cost=11.70..22.36 rows=87 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=11.50..11.50 rows=16 width=372)
-> Hash Join (cost=7.05..11.50 rows=16 width=372)
Hash Cond: (thrs.task_group_id = s.id)
-> Seq Scan on tbl_task_group_head_of_relationships thrs (cost=0.00..4.41 rows=16 width=4)
Filter: (user_id = 1001)
-> Hash (cost=5.91..5.91 rows=91 width=372)
-> Seq Scan on tbl_task_groups s (cost=0.00..5.91 rows=91 width=372)