| Limit (cost=69.03..69.08 rows=20 width=421) |
| -> Sort (cost=69.03..69.31 rows=113 width=421) |
| Sort Key: (min(CASE WHEN (1 = r.verify_type) THEN CASE WHEN (rvr.status = 0) THEN 1 WHEN (rsvr.status = 0) THEN 2 ELSE 4 END ELSE CASE WHEN ((rvr.status = 0) AND (r.next_verify_user = 5493)) THEN 1 WHEN ((rsvr.status = 0) AND (r.next_stop_verify_user = 5493)) THEN 2 ELSE 4 END END)), r.created_at DESC |
| -> HashAggregate (cost=64.89..66.02 rows=113 width=421) |
| Group Key: r.id |
| -> Hash Right Join (cost=37.99..62.35 rows=113 width=425) |
| Hash Cond: (rsvr.erp_inventory_build_id = r.id) |
| -> Seq Scan on tbl_erp_inventory_build_stop_verify_rels rsvr (cost=0.00..19.70 rows=970 width=8) |
| -> Hash (cost=37.73..37.73 rows=21 width=421) |
| -> Hash Right Join (cost=15.39..37.73 rows=21 width=421) |
| Hash Cond: (rvr.erp_inventory_build_id = r.id) |
| Filter: ((r.created_by = 5493) OR (rvr.user_id = 5493) OR (r.created_by = ANY ('{5493,5495}'::integer[]))) |
| -> Seq Scan on tbl_erp_inventory_build_verify_rels rvr (cost=0.00..19.70 rows=970 width=12) |
| -> Hash (cost=13.15..13.15 rows=179 width=417) |
| -> Seq Scan on tbl_erp_inventory_builds r (cost=0.00..13.15 rows=179 width=417) |
| Filter: ((status <> 0) OR ((status = 0) AND (created_by = 5493))) |