| Aggregate (cost=422.62..422.63 rows=1 width=8) |
| -> Sort (cost=422.57..422.58 rows=3 width=403) |
| 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 = 1001)) THEN 1 WHEN ((rsvr.status = 0) AND (r.next_stop_verify_user = 1001)) THEN 2 ELSE 4 END END)), r.created_at DESC |
| -> GroupAggregate (cost=422.42..422.55 rows=3 width=403) |
| Group Key: r.id |
| -> Merge Left Join (cost=422.42..422.45 rows=3 width=30) |
| Merge Cond: (r.id = rsvr.erp_cash_cost_ticket_id) |
| -> Sort (cost=421.26..421.27 rows=3 width=26) |
| Sort Key: r.id |
| -> Hash Right Join (cost=9.88..421.23 rows=3 width=26) |
| Hash Cond: (rvr.erp_cash_cost_ticket_id = r.id) |
| -> Seq Scan on tbl_erp_cash_cost_ticket_verify_rels rvr (cost=0.00..331.60 rows=21260 width=8) |
| -> Hash (cost=9.87..9.87 rows=1 width=22) |
| -> Nested Loop (cost=0.29..9.87 rows=1 width=22) |
| -> Seq Scan on tbl_erp_cash_cost_ticket_purchase_contract_settles eptss (cost=0.00..1.56 rows=1 width=4) |
| Filter: (purchase_contract_id = 4472) |
| -> Index Scan using tbl_erp_cash_cost_tickets_pkey on tbl_erp_cash_cost_tickets r (cost=0.29..8.30 rows=1 width=22) |
| Index Cond: (id = eptss.erp_cash_cost_ticket_id) |
| -> Sort (cost=1.16..1.16 rows=1 width=8) |
| Sort Key: rsvr.erp_cash_cost_ticket_id |
| -> Seq Scan on tbl_erp_cash_cost_ticket_stop_verify_rels rsvr (cost=0.00..1.15 rows=1 width=8) |
| Filter: (user_id = 1001) |