QUERY PLAN
Limit (cost=63.37..63.42 rows=20 width=362)
-> Sort (cost=63.37..63.87 rows=200 width=362)
Sort Key: r.updated_at DESC
-> HashAggregate (cost=56.05..58.05 rows=200 width=362)
Group Key: r.id
-> Hash Right Join (cost=38.61..55.49 rows=221 width=362)
Hash Cond: (epop.erp_sales_outbound_id = r.id)
-> Seq Scan on tbl_erp_sales_outbound_products epop (cost=0.00..13.40 rows=340 width=8)
-> Hash (cost=36.98..36.98 rows=130 width=362)
-> Hash Right Join (cost=14.50..36.98 rows=130 width=362)
Hash Cond: (rvr.erp_sales_outbound_id = r.id)
Filter: ((r.created_by = 1001) OR (rvr.user_id = 1001) OR (r.created_by = ANY ('{1000,1001,1004,1005,1011,1013,1015,1017,1022,1023,5016,5064,5085,5087,5248,5250,5252,5295,5300,5311,5332,5360,5388,5446,5449}'::integer[])))
-> Seq Scan on tbl_erp_sales_outbound_verify_rels rvr (cost=0.00..19.70 rows=970 width=8)
-> Hash (cost=12.00..12.00 rows=200 width=362)
-> Seq Scan on tbl_erp_sales_outbounds r (cost=0.00..12.00 rows=200 width=362)