| Aggregate (cost=120.68..120.69 rows=1 width=8) |
| -> Sort (cost=120.66..120.67 rows=1 width=413) |
| 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=120.61..120.65 rows=1 width=413) |
| Group Key: r.id |
| -> Sort (cost=120.61..120.62 rows=1 width=30) |
| Sort Key: r.id |
| -> Nested Loop Left Join (cost=114.76..120.60 rows=1 width=30) |
| Join Filter: (rsvr.erp_collect_ticket_id = r.id) |
| -> Hash Right Join (cost=114.76..119.47 rows=1 width=26) |
| Hash Cond: (rvr.erp_collect_ticket_id = r.id) |
| -> Seq Scan on tbl_erp_collect_ticket_verify_rels rvr (cost=0.00..3.96 rows=196 width=8) |
| -> Hash (cost=114.75..114.75 rows=1 width=22) |
| -> Nested Loop (cost=72.94..114.75 rows=1 width=22) |
| -> Hash Join (cost=72.66..114.37 rows=1 width=4) |
| Hash Cond: (ectss.sales_contract_id = s.id) |
| -> Seq Scan on tbl_erp_collect_ticket_settles ectss (cost=0.00..35.94 rows=2194 width=8) |
| -> Hash (cost=72.65..72.65 rows=1 width=4) |
| -> Seq Scan on tbl_sales_contracts s (cost=0.00..72.65 rows=1 width=4) |
| Filter: (project_id = 4157) |
| -> Index Scan using tbl_erp_collect_tickets_pkey on tbl_erp_collect_tickets r (cost=0.28..0.38 rows=1 width=22) |
| Index Cond: (id = ectss.erp_collect_ticket_id) |
| -> Seq Scan on tbl_erp_collect_ticket_stop_verify_rels rsvr (cost=0.00..1.06 rows=6 width=8) |