| Aggregate (cost=113.24..113.25 rows=1 width=8) |
| -> Sort (cost=113.23..113.23 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=110.21..113.22 rows=1 width=413) |
| Group Key: r.id |
| -> Nested Loop Left Join (cost=110.21..113.18 rows=1 width=30) |
| Join Filter: (rvr.erp_collect_ticket_id = r.id) |
| -> Merge Left Join (cost=110.21..110.25 rows=1 width=26) |
| Merge Cond: (r.id = rsvr.erp_collect_ticket_id) |
| -> Sort (cost=109.10..109.10 rows=1 width=22) |
| Sort Key: r.id |
| -> Nested Loop (cost=68.76..109.09 rows=1 width=22) |
| -> Hash Join (cost=68.48..108.71 rows=1 width=4) |
| Hash Cond: (ectss.sales_contract_id = s.id) |
| -> Seq Scan on tbl_erp_collect_ticket_settles ectss (cost=0.00..34.77 rows=2077 width=8) |
| -> Hash (cost=68.46..68.46 rows=1 width=4) |
| -> Seq Scan on tbl_sales_contracts s (cost=0.00..68.46 rows=1 width=4) |
| Filter: (project_id = 3738) |
| -> 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) |
| -> Sort (cost=1.11..1.12 rows=5 width=8) |
| Sort Key: rsvr.erp_collect_ticket_id |
| -> Seq Scan on tbl_erp_collect_ticket_stop_verify_rels rsvr (cost=0.00..1.05 rows=5 width=8) |
| -> Seq Scan on tbl_erp_collect_ticket_verify_rels rvr (cost=0.00..1.86 rows=86 width=8) |