QUERY PLAN
HashAggregate (cost=28.90..29.12 rows=22 width=35)
Group Key: s.id
-> Hash Right Join (cost=16.03..28.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=14.58..14.58 rows=116 width=39)
-> Hash Right Join (cost=5.43..14.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=5.15..5.15 rows=22 width=35)
-> Seq Scan on tbl_task_groups s (cost=0.00..5.15 rows=22 width=35)
Filter: (status = 0)