QUERY PLAN
Limit (cost=49.11..49.16 rows=20 width=229)
-> Sort (cost=49.11..49.20 rows=35 width=229)
Sort Key: (CASE WHEN ((sub.verify_status = 0) OR (sub.stop_verify_status = 0) OR (sub.cancel_verify_status = 0)) THEN 1 ELSE 2 END), sub.created_at DESC
-> Result (cost=0.00..48.21 rows=35 width=229)
-> Append (cost=0.00..47.60 rows=35 width=225)
-> Subquery Scan on sub (cost=0.00..0.04 rows=1 width=158)
-> HashAggregate (cost=0.00..0.03 rows=1 width=166)
Group Key: id, status, status
-> Result (cost=0.00..0.00 rows=0 width=83)
One-Time Filter: false
-> Subquery Scan on "*SELECT* 2" (cost=0.00..0.05 rows=1 width=189)
-> HashAggregate (cost=0.00..0.04 rows=1 width=201)
Group Key: id, status, status, status
-> Result (cost=0.00..0.00 rows=0 width=122)
One-Time Filter: false
-> Subquery Scan on "*SELECT* 3" (cost=0.00..0.04 rows=1 width=297)
-> HashAggregate (cost=0.00..0.03 rows=1 width=305)
Group Key: id, status, status
-> Result (cost=0.00..0.00 rows=0 width=222)
One-Time Filter: false
-> Subquery Scan on "*SELECT* 4" (cost=0.00..0.04 rows=1 width=297)
-> HashAggregate (cost=0.00..0.03 rows=1 width=305)
Group Key: id, status, status
-> Result (cost=0.00..0.00 rows=0 width=218)
One-Time Filter: false
-> Subquery Scan on "*SELECT* 5" (cost=46.09..46.38 rows=7 width=202)
-> Group (cost=46.09..46.31 rows=7 width=210)
Group Key: r.id, rvr.status, rsvr.status
-> Sort (cost=46.09..46.10 rows=7 width=123)
Sort Key: r.id, rvr.status, rsvr.status
-> Nested Loop Left Join (cost=1.19..45.99 rows=7 width=123)
Join Filter: (rsvr.erp_inventory_overflow_id = r.id)
-> Hash Right Join (cost=1.19..23.33 rows=7 width=119)
Hash Cond: (rvr.erp_inventory_overflow_id = r.id)
-> Seq Scan on tbl_erp_inventory_overflow_verify_rels rvr (cost=0.00..22.12 rows=5 width=8)
Filter: (user_id = 1000)
-> Hash (cost=1.10..1.10 rows=7 width=115)
-> Seq Scan on tbl_erp_inventory_overflows r (cost=0.00..1.10 rows=7 width=115)
Filter: (status <> 0)
-> Materialize (cost=0.00..22.15 rows=5 width=8)
-> Seq Scan on tbl_erp_inventory_overflow_stop_verify_rels rsvr (cost=0.00..22.12 rows=5 width=8)
Filter: (user_id = 1000)
-> Subquery Scan on "*SELECT* 6" (cost=0.00..0.04 rows=1 width=297)
-> HashAggregate (cost=0.00..0.03 rows=1 width=305)
Group Key: id, status, status
-> Result (cost=0.00..0.00 rows=0 width=218)
One-Time Filter: false
-> Subquery Scan on "*SELECT* 7" (cost=0.00..0.04 rows=1 width=297)
-> HashAggregate (cost=0.00..0.03 rows=1 width=305)
Group Key: id, status, status
-> Result (cost=0.00..0.00 rows=0 width=218)
One-Time Filter: false
-> Subquery Scan on "*SELECT* 8" (cost=0.00..0.05 rows=1 width=197)
-> HashAggregate (cost=0.00..0.04 rows=1 width=209)
Group Key: id, status, status, status
-> Result (cost=0.00..0.00 rows=0 width=130)
One-Time Filter: false
-> Subquery Scan on "*SELECT* 9" (cost=0.00..0.04 rows=1 width=206)
-> HashAggregate (cost=0.00..0.03 rows=1 width=214)
Group Key: id, status, status
-> Result (cost=0.00..0.00 rows=0 width=131)
One-Time Filter: false
-> Subquery Scan on "*SELECT* 10" (cost=0.00..0.04 rows=1 width=297)
-> HashAggregate (cost=0.00..0.03 rows=1 width=305)
Group Key: id, status, status
-> Result (cost=0.00..0.00 rows=0 width=222)
One-Time Filter: false
-> Subquery Scan on "*SELECT* 11" (cost=0.00..0.04 rows=1 width=160)
-> HashAggregate (cost=0.00..0.03 rows=1 width=168)
Group Key: id, status, status
-> Result (cost=0.00..0.00 rows=0 width=89)
One-Time Filter: false
-> Subquery Scan on "*SELECT* 12" (cost=0.00..0.04 rows=1 width=187)
-> HashAggregate (cost=0.00..0.03 rows=1 width=195)
Group Key: id, status, status
-> Result (cost=0.00..0.00 rows=0 width=112)
One-Time Filter: false
-> Subquery Scan on "*SELECT* 13" (cost=0.00..0.04 rows=1 width=138)
-> HashAggregate (cost=0.00..0.03 rows=1 width=146)
Group Key: id, status, status
-> Result (cost=0.00..0.00 rows=0 width=107)
One-Time Filter: false
-> Subquery Scan on "*SELECT* 14" (cost=0.00..0.04 rows=1 width=143)
-> HashAggregate (cost=0.00..0.03 rows=1 width=151)
Group Key: id, status, status
-> Result (cost=0.00..0.00 rows=0 width=113)
One-Time Filter: false
-> Subquery Scan on "*SELECT* 15" (cost=0.00..0.04 rows=1 width=162)
-> HashAggregate (cost=0.00..0.03 rows=1 width=170)
Group Key: id, status, status
-> Result (cost=0.00..0.00 rows=0 width=127)
One-Time Filter: false
-> Subquery Scan on "*SELECT* 16" (cost=0.00..0.04 rows=1 width=164)
-> HashAggregate (cost=0.00..0.03 rows=1 width=172)
Group Key: id, status, status
-> Result (cost=0.00..0.00 rows=0 width=133)
One-Time Filter: false
-> Subquery Scan on "*SELECT* 17" (cost=0.00..0.04 rows=1 width=297)
-> HashAggregate (cost=0.00..0.03 rows=1 width=305)
Group Key: id, status, status
-> Result (cost=0.00..0.00 rows=0 width=226)
One-Time Filter: false
-> Subquery Scan on "*SELECT* 18" (cost=0.00..0.04 rows=1 width=297)
-> HashAggregate (cost=0.00..0.03 rows=1 width=305)
Group Key: id, status, status
-> Result (cost=0.00..0.00 rows=0 width=218)
One-Time Filter: false
-> Subquery Scan on "*SELECT* 19" (cost=0.00..0.04 rows=1 width=151)
-> HashAggregate (cost=0.00..0.03 rows=1 width=159)
Group Key: id, status, status
-> Result (cost=0.00..0.00 rows=0 width=113)
One-Time Filter: false
-> Subquery Scan on "*SELECT* 20" (cost=0.00..0.04 rows=1 width=297)
-> HashAggregate (cost=0.00..0.03 rows=1 width=305)
Group Key: id, status, status
-> Result (cost=0.00..0.00 rows=0 width=259)
One-Time Filter: false
-> Subquery Scan on "*SELECT* 21" (cost=0.00..0.04 rows=1 width=151)
-> HashAggregate (cost=0.00..0.03 rows=1 width=159)
Group Key: id, status, status
-> Result (cost=0.00..0.00 rows=0 width=120)
One-Time Filter: false
-> Subquery Scan on "*SELECT* 22" (cost=0.00..0.04 rows=1 width=156)
-> HashAggregate (cost=0.00..0.03 rows=1 width=164)
Group Key: id, status, status
-> Result (cost=0.00..0.00 rows=0 width=125)
One-Time Filter: false
-> Subquery Scan on "*SELECT* 23" (cost=0.00..0.05 rows=1 width=240)
-> HashAggregate (cost=0.00..0.04 rows=1 width=252)
Group Key: id, status, status, status
-> Result (cost=0.00..0.00 rows=0 width=173)
One-Time Filter: false
-> Subquery Scan on "*SELECT* 24" (cost=0.00..0.04 rows=1 width=196)
-> HashAggregate (cost=0.00..0.03 rows=1 width=204)
Group Key: id, status, status
-> Result (cost=0.00..0.00 rows=0 width=150)
One-Time Filter: false
-> Subquery Scan on "*SELECT* 25" (cost=0.00..0.04 rows=1 width=297)
-> HashAggregate (cost=0.00..0.03 rows=1 width=305)
Group Key: id, status, status
-> Result (cost=0.00..0.00 rows=0 width=251)
One-Time Filter: false
-> Subquery Scan on "*SELECT* 26" (cost=0.00..0.04 rows=1 width=297)
-> HashAggregate (cost=0.00..0.03 rows=1 width=305)
Group Key: id, status, status
-> Result (cost=0.00..0.00 rows=0 width=251)
One-Time Filter: false
-> Subquery Scan on "*SELECT* 27" (cost=0.00..0.04 rows=1 width=297)
-> HashAggregate (cost=0.00..0.03 rows=1 width=305)
Group Key: id, status, status
-> Result (cost=0.00..0.00 rows=0 width=251)
One-Time Filter: false
-> Subquery Scan on "*SELECT* 28" (cost=0.00..0.04 rows=1 width=297)
-> HashAggregate (cost=0.00..0.03 rows=1 width=305)
Group Key: id, status, status
-> Result (cost=0.00..0.00 rows=0 width=251)
One-Time Filter: false
-> Subquery Scan on "*SELECT* 29" (cost=0.00..0.05 rows=1 width=297)
-> HashAggregate (cost=0.00..0.04 rows=1 width=305)
Group Key: id, status, status
-> Result (cost=0.00..0.00 rows=0 width=195)
One-Time Filter: false