QUERY PLAN
HashAggregate (cost=76.27..77.53 rows=101 width=42)
Group Key: r.status
-> HashAggregate (cost=73.24..74.50 rows=101 width=38)
Group Key: r.id
-> Hash Right Join (cost=48.39..72.74 rows=101 width=38)
Hash Cond: (rsvr.erp_profit_distribute_id = r.id)
-> Seq Scan on tbl_erp_profit_distribute_stop_verify_rels rsvr (cost=0.00..19.70 rows=970 width=4)
-> Hash (cost=48.09..48.09 rows=24 width=38)
-> Nested Loop Left Join (cost=17.03..48.09 rows=24 width=38)
-> Hash Right Join (cost=16.89..39.21 rows=24 width=10)
Hash Cond: (rvr.erp_profit_distribute_id = r.id)
Filter: ((r.created_by = 5495) OR (rvr.user_id = 5495) OR (r.created_by = ANY ('{5493,5495,5495}'::integer[])))
-> Seq Scan on tbl_erp_profit_distribute_verify_rels rvr (cost=0.00..19.70 rows=970 width=8)
-> Hash (cost=14.03..14.03 rows=229 width=14)
-> Seq Scan on tbl_erp_profit_distributes r (cost=0.00..14.03 rows=229 width=14)
Filter: ((status <> 0) OR ((status = 0) AND (created_by = 5495)))
-> Index Scan using tbl_projects_pkey on tbl_projects p (cost=0.14..0.37 rows=1 width=36)
Index Cond: (r.project_id = id)