| Aggregate (cost=381.40..381.41 rows=1 width=32) |
| -> Nested Loop (cost=91.37..381.39 rows=1 width=32) |
| -> Nested Loop (cost=91.09..374.07 rows=11 width=36) |
| -> Subquery Scan on sub (cost=90.81..302.81 rows=11 width=36) |
| Filter: ((sub.collected_date >= '2026-01-01 00:00:00+08'::timestamp with time zone) AND (sub.collected_date < '2027-01-01 00:00:00'::timestamp without time zone)) |
| -> Append (cost=90.81..270.41 rows=2160 width=124) |
| -> Subquery Scan on "*SELECT* 1" (cost=90.81..175.49 rows=2153 width=83) |
| -> Hash Join (cost=90.81..148.58 rows=2153 width=79) |
| Hash Cond: (r.erp_collect_ticket_id = t.id) |
| -> Seq Scan on tbl_erp_collect_ticket_settles r (cost=0.00..35.94 rows=2160 width=18) |
| Filter: (sales_contract_id IS NOT NULL) |
| -> Hash (cost=63.45..63.45 rows=2189 width=37) |
| -> Seq Scan on tbl_erp_collect_tickets t (cost=0.00..63.45 rows=2189 width=37) |
| Filter: (status = ANY ('{2,5}'::integer[])) |
| -> Nested Loop (cost=0.29..9.33 rows=1 width=95) |
| -> Seq Scan on tbl_erp_cash_cost_ticket_sales_contract_settles r_1 (cost=0.00..1.02 rows=1 width=17) |
| Filter: (sales_contract_id IS NOT NULL) |
| -> Index Scan using tbl_erp_cash_cost_tickets_pkey on tbl_erp_cash_cost_tickets t_1 (cost=0.29..8.30 rows=1 width=46) |
| Index Cond: (id = r_1.erp_cash_cost_ticket_id) |
| Filter: (is_payment_settle AND (status = ANY ('{2,5}'::integer[]))) |
| -> Nested Loop (cost=0.28..85.52 rows=6 width=116) |
| -> Seq Scan on tbl_erp_payment_ticket_settles r_2 (cost=0.00..39.65 rows=6 width=18) |
| Filter: (sales_contract_id IS NOT NULL) |
| -> Index Scan using tbl_erp_payment_tickets_pkey on tbl_erp_payment_tickets t_2 (cost=0.28..7.63 rows=1 width=40) |
| Index Cond: (id = r_2.erp_payment_ticket_id) |
| Filter: (is_payment_settle AND (status = ANY ('{2,5}'::integer[]))) |
| -> Index Scan using tbl_sales_contracts_pkey on tbl_sales_contracts c (cost=0.28..6.48 rows=1 width=8) |
| Index Cond: (id = sub.contract_id) |
| -> Index Scan using tbl_projects_pkey on tbl_projects p (cost=0.28..0.67 rows=1 width=4) |
| Index Cond: (id = c.from_project) |
| Filter: ((created_by = 1001) AND (project_status = 3)) |