QUERY PLAN
Limit (cost=0.03..0.04 rows=1 width=152)
-> Sort (cost=0.03..0.04 rows=1 width=152)
Sort Key: (CASE WHEN ((rvr.status = 0) AND (r.next_verify_user = 1001)) THEN 1 ELSE 0 END) DESC, (CASE WHEN ((crvr.status = 0) AND (r.next_cancel_verify_user = 1001)) THEN 1 ELSE 0 END) DESC, (CASE WHEN (r.status = ANY ('{1,5}'::integer[])) THEN 0 ELSE 1 END), r.created_at DESC
-> HashAggregate (cost=0.00..0.02 rows=1 width=152)
Group Key: r.id, CASE WHEN ((rvr.status = 0) AND (r.next_verify_user = 1001)) THEN 1 ELSE 0 END, CASE WHEN ((crvr.status = 0) AND (r.next_cancel_verify_user = 1001)) THEN 1 ELSE 0 END
-> Result (cost=0.00..0.00 rows=0 width=148)
One-Time Filter: false