| Aggregate (cost=212.98..212.99 rows=1 width=32) |
| -> Nested Loop (cost=196.64..212.97 rows=1 width=5) |
| -> Nested Loop (cost=196.50..209.36 rows=1 width=9) |
| Join Filter: (((sum(r_1.amount)) + (sum(r.amount))) < t.amount) |
| -> Merge Join (cost=196.35..207.75 rows=1 width=85) |
| Merge Cond: (dt1.object_id = r_1.erp_cost_ticket_id) |
| -> Nested Loop (cost=42.98..54.29 rows=1 width=49) |
| -> GroupAggregate (cost=42.69..42.71 rows=1 width=36) |
| Group Key: r.erp_cost_ticket_id |
| -> Sort (cost=42.69..42.69 rows=1 width=36) |
| Sort Key: r.erp_cost_ticket_id |
| -> Nested Loop (cost=0.28..42.68 rows=1 width=36) |
| -> Seq Scan on tbl_erp_collect_ticket_payments r (cost=0.00..1.05 rows=5 width=40) |
| Filter: (erp_cost_ticket_id IS NOT NULL) |
| -> Index Scan using tbl_erp_collect_tickets_pkey on tbl_erp_collect_tickets t_1 (cost=0.28..8.30 rows=1 width=4) |
| Index Cond: (id = r.erp_collect_ticket_id) |
| Filter: ((bank_settle_at <= '2025-12-31 23:59:59+08'::timestamp with time zone) AND (status = 2)) |
| -> Index Scan using tbl_term_taxonomy_relationships_object_id_term_id_idx on tbl_term_taxonomy_relationships dt1 (cost=0.29..11.56 rows=1 width=13) |
| Index Cond: ((object_id = r.erp_cost_ticket_id) AND (term_id = 18)) |
| Filter: (object_type = 9) |
| -> GroupAggregate (cost=153.37..153.41 rows=2 width=36) |
| Group Key: r_1.erp_cost_ticket_id |
| -> Sort (cost=153.37..153.38 rows=2 width=10) |
| Sort Key: r_1.erp_cost_ticket_id |
| -> Hash Join (cost=41.41..153.36 rows=2 width=10) |
| Hash Cond: (t_2.id = r_1.erp_payment_ticket_id) |
| -> Seq Scan on tbl_erp_payment_tickets t_2 (cost=0.00..109.27 rows=178 width=4) |
| Filter: ((bank_settle_at <= '2025-12-31 23:59:59+08'::timestamp with time zone) AND (status = 2)) |
| -> Hash (cost=41.01..41.01 rows=32 width=14) |
| -> Seq Scan on tbl_erp_payment_ticket_settles r_1 (cost=0.00..41.01 rows=32 width=14) |
| Filter: (erp_cost_ticket_id IS NOT NULL) |
| -> Index Scan using tbl_erp_cost_tickets_pkey on tbl_erp_cost_tickets t (cost=0.14..1.59 rows=1 width=9) |
| Index Cond: (id = dt1.object_id) |
| Filter: ((verify_at <= '2025-12-31 23:59:59+08'::timestamp with time zone) AND (status = 2)) |
| -> Index Scan using tbl_term_taxonomies_pkey on tbl_term_taxonomies tt (cost=0.15..1.88 rows=1 width=4) |
| Index Cond: (id = dt1.taxonomy_id) |
| Filter: ((serial_no)::text = '221106'::text) |