QUERY PLAN
HashAggregate (cost=36.90..37.12 rows=22 width=35)
Group Key: s.id
-> Hash Right Join (cost=24.03..36.75 rows=63 width=35)
Hash Cond: (thrs.task_group_id = s.id)
Filter: ((thrs.user_id = 1001) OR (turs.user_id = 1001))
-> Seq Scan on tbl_task_group_head_of_relationships thrs (cost=0.00..5.70 rows=370 width=8)
-> Hash (cost=22.58..22.58 rows=116 width=39)
-> Hash Right Join (cost=13.43..22.58 rows=116 width=39)
Hash Cond: (turs.task_group_id = s.id)
-> Seq Scan on tbl_task_group_user_relationships turs (cost=0.00..7.83 rows=483 width=8)
-> Hash (cost=13.15..13.15 rows=22 width=35)
-> Seq Scan on tbl_task_groups s (cost=0.00..13.15 rows=22 width=35)
Filter: (status = 0)