Aggregate (cost=100.12..100.13 rows=1 width=8) |
-> Sort (cost=99.72..99.79 rows=27 width=301) |
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..99.08 rows=27 width=301) |
-> Append (cost=0.00..98.60 rows=27 width=20) |
-> Subquery Scan on sub (cost=0.00..0.04 rows=1 width=20) |
-> HashAggregate (cost=0.00..0.03 rows=1 width=305) |
Group Key: id, status, status |
-> Result (cost=0.00..0.00 rows=0 width=30) |
One-Time Filter: false |
-> Subquery Scan on "*SELECT* 2" (cost=97.63..97.68 rows=1 width=20) |
-> Group (cost=97.63..97.67 rows=1 width=309) |
Group Key: r.id, rvr.status, rsvr.status, rcvr.status |
-> Sort (cost=97.63..97.64 rows=1 width=38) |
Sort Key: r.id, rvr.status, rsvr.status, rcvr.status |
-> Nested Loop Left Join (cost=0.00..97.62 rows=1 width=38) |
Join Filter: (rsvr.erp_purchase_order_id = r.id) |
Filter: ((rvr.user_id = 1000) OR (rsvr.user_id = 1000) OR (rcvr.user_id = 1000)) |
-> Nested Loop Left Join (cost=0.00..96.56 rows=1 width=42) |
Join Filter: (rcvr.erp_purchase_order_id = r.id) |
-> Nested Loop Left Join (cost=0.00..74.38 rows=1 width=34) |
Join Filter: (rvr.erp_purchase_order_id = r.id) |
-> Seq Scan on tbl_erp_purchase_orders r (cost=0.00..72.75 rows=1 width=26) |
Filter: ((status <> 0) AND (created_at >= '2025-09-16 00:00:00+08'::timestamp with time zone) AND (created_at <= '2025-09-16 23:59:59+08'::timestamp with time zone)) |
-> Seq Scan on tbl_erp_purchase_order_verify_rels rvr (cost=0.00..1.61 rows=1 width=12) |
Filter: (user_id = 1000) |
-> Seq Scan on tbl_erp_purchase_order_cancel_verify_rels rcvr (cost=0.00..22.12 rows=5 width=12) |
Filter: (user_id = 1000) |
-> Seq Scan on tbl_erp_purchase_order_stop_verify_rels rsvr (cost=0.00..1.04 rows=1 width=12) |
Filter: (user_id = 1000) |
-> Subquery Scan on "*SELECT* 3" (cost=0.00..0.04 rows=1 width=20) |
-> HashAggregate (cost=0.00..0.03 rows=1 width=305) |
Group Key: id, status, status |
-> Result (cost=0.00..0.00 rows=0 width=30) |
One-Time Filter: false |
-> Subquery Scan on "*SELECT* 4" (cost=0.00..0.04 rows=1 width=20) |
-> HashAggregate (cost=0.00..0.03 rows=1 width=305) |
Group Key: id, status, status |
-> Result (cost=0.00..0.00 rows=0 width=30) |
One-Time Filter: false |
-> Subquery Scan on "*SELECT* 5" (cost=0.00..0.04 rows=1 width=20) |
-> HashAggregate (cost=0.00..0.03 rows=1 width=305) |
Group Key: id, status, status |
-> Result (cost=0.00..0.00 rows=0 width=30) |
One-Time Filter: false |
-> Subquery Scan on "*SELECT* 6" (cost=0.00..0.04 rows=1 width=20) |
-> HashAggregate (cost=0.00..0.03 rows=1 width=309) |
Group Key: id, status, status, status |
-> Result (cost=0.00..0.00 rows=0 width=38) |
One-Time Filter: false |
-> Subquery Scan on "*SELECT* 7" (cost=0.00..0.04 rows=1 width=20) |
-> HashAggregate (cost=0.00..0.03 rows=1 width=305) |
Group Key: id, status, status |
-> Result (cost=0.00..0.00 rows=0 width=30) |
One-Time Filter: false |
-> Subquery Scan on "*SELECT* 8" (cost=0.00..0.04 rows=1 width=20) |
-> HashAggregate (cost=0.00..0.03 rows=1 width=305) |
Group Key: id, status, status |
-> Result (cost=0.00..0.00 rows=0 width=30) |
One-Time Filter: false |
-> Subquery Scan on "*SELECT* 9" (cost=0.00..0.04 rows=1 width=20) |
-> HashAggregate (cost=0.00..0.03 rows=1 width=305) |
Group Key: id, status, status |
-> Result (cost=0.00..0.00 rows=0 width=30) |
One-Time Filter: false |
-> Subquery Scan on "*SELECT* 10" (cost=0.00..0.04 rows=1 width=20) |
-> HashAggregate (cost=0.00..0.03 rows=1 width=305) |
Group Key: id, status, status |
-> Result (cost=0.00..0.00 rows=0 width=30) |
One-Time Filter: false |
-> Subquery Scan on "*SELECT* 11" (cost=0.00..0.04 rows=1 width=20) |
-> HashAggregate (cost=0.00..0.03 rows=1 width=305) |
Group Key: id, status, status |
-> Result (cost=0.00..0.00 rows=0 width=30) |
One-Time Filter: false |
-> Subquery Scan on "*SELECT* 12" (cost=0.00..0.04 rows=1 width=20) |
-> HashAggregate (cost=0.00..0.03 rows=1 width=305) |
Group Key: id, status, status |
-> Result (cost=0.00..0.00 rows=0 width=30) |
One-Time Filter: false |
-> Subquery Scan on "*SELECT* 13" (cost=0.00..0.04 rows=1 width=20) |
-> HashAggregate (cost=0.00..0.03 rows=1 width=305) |
Group Key: id, status, status |
-> Result (cost=0.00..0.00 rows=0 width=30) |
One-Time Filter: false |
-> Subquery Scan on "*SELECT* 14" (cost=0.00..0.04 rows=1 width=20) |
-> HashAggregate (cost=0.00..0.03 rows=1 width=305) |
Group Key: id, status, status |
-> Result (cost=0.00..0.00 rows=0 width=30) |
One-Time Filter: false |
-> Subquery Scan on "*SELECT* 15" (cost=0.00..0.04 rows=1 width=20) |
-> HashAggregate (cost=0.00..0.03 rows=1 width=305) |
Group Key: id, status, status |
-> Result (cost=0.00..0.00 rows=0 width=30) |
One-Time Filter: false |
-> Subquery Scan on "*SELECT* 16" (cost=0.00..0.04 rows=1 width=20) |
-> HashAggregate (cost=0.00..0.03 rows=1 width=305) |
Group Key: id, status, status |
-> Result (cost=0.00..0.00 rows=0 width=30) |
One-Time Filter: false |
-> Subquery Scan on "*SELECT* 17" (cost=0.00..0.04 rows=1 width=20) |
-> HashAggregate (cost=0.00..0.03 rows=1 width=305) |
Group Key: id, status, status |
-> Result (cost=0.00..0.00 rows=0 width=30) |
One-Time Filter: false |
-> Subquery Scan on "*SELECT* 18" (cost=0.00..0.04 rows=1 width=20) |
-> HashAggregate (cost=0.00..0.03 rows=1 width=305) |
Group Key: id, status, status |
-> Result (cost=0.00..0.00 rows=0 width=30) |
One-Time Filter: false |
-> Subquery Scan on "*SELECT* 19" (cost=0.00..0.04 rows=1 width=20) |
-> HashAggregate (cost=0.00..0.03 rows=1 width=305) |
Group Key: id, status, status |
-> Result (cost=0.00..0.00 rows=0 width=30) |
One-Time Filter: false |
-> Subquery Scan on "*SELECT* 20" (cost=0.00..0.04 rows=1 width=20) |
-> HashAggregate (cost=0.00..0.03 rows=1 width=305) |
Group Key: id, status, status |
-> Result (cost=0.00..0.00 rows=0 width=30) |
One-Time Filter: false |
-> Subquery Scan on "*SELECT* 21" (cost=0.00..0.04 rows=1 width=20) |
-> HashAggregate (cost=0.00..0.03 rows=1 width=309) |
Group Key: id, status, status, status |
-> Result (cost=0.00..0.00 rows=0 width=38) |
One-Time Filter: false |
-> Subquery Scan on "*SELECT* 22" (cost=0.00..0.04 rows=1 width=20) |
-> HashAggregate (cost=0.00..0.03 rows=1 width=305) |
Group Key: id, status, status |
-> Result (cost=0.00..0.00 rows=0 width=30) |
One-Time Filter: false |
-> Subquery Scan on "*SELECT* 23" (cost=0.00..0.04 rows=1 width=20) |
-> HashAggregate (cost=0.00..0.03 rows=1 width=305) |
Group Key: id, status, status |
-> Result (cost=0.00..0.00 rows=0 width=30) |
One-Time Filter: false |
-> Subquery Scan on "*SELECT* 24" (cost=0.00..0.04 rows=1 width=20) |
-> HashAggregate (cost=0.00..0.03 rows=1 width=305) |
Group Key: id, status, status |
-> Result (cost=0.00..0.00 rows=0 width=30) |
One-Time Filter: false |
-> Subquery Scan on "*SELECT* 25" (cost=0.00..0.04 rows=1 width=20) |
-> HashAggregate (cost=0.00..0.03 rows=1 width=305) |
Group Key: id, status, status |
-> Result (cost=0.00..0.00 rows=0 width=30) |
One-Time Filter: false |
-> Subquery Scan on "*SELECT* 26" (cost=0.00..0.04 rows=1 width=20) |
-> HashAggregate (cost=0.00..0.03 rows=1 width=305) |
Group Key: id, status, status |
-> Result (cost=0.00..0.00 rows=0 width=30) |
One-Time Filter: false |
-> Subquery Scan on "*SELECT* 27" (cost=0.00..0.04 rows=1 width=20) |
-> HashAggregate (cost=0.00..0.03 rows=1 width=305) |
Group Key: id, status, status |
-> Result (cost=0.00..0.00 rows=0 width=30) |
One-Time Filter: false |