QUERY PLAN
HashAggregate (cost=66.86..68.61 rows=140 width=42)
Group Key: r.status
-> HashAggregate (cost=63.01..64.41 rows=140 width=38)
Group Key: r.id
-> Hash Right Join (cost=38.06..62.66 rows=140 width=38)
Hash Cond: (rsvr.erp_collect_ticket_id = r.id)
-> Seq Scan on tbl_erp_collect_ticket_stop_verify_rels rsvr (cost=0.00..19.70 rows=970 width=4)
-> Hash (cost=37.73..37.73 rows=26 width=38)
-> Hash Right Join (cost=15.39..37.73 rows=26 width=38)
Hash Cond: (rvr.erp_collect_ticket_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_collect_ticket_verify_rels rvr (cost=0.00..19.70 rows=970 width=8)
-> Hash (cost=13.15..13.15 rows=179 width=42)
-> Seq Scan on tbl_erp_collect_tickets r (cost=0.00..13.15 rows=179 width=42)
Filter: ((status <> 0) OR ((status = 0) AND (created_by = 5495)))