| Aggregate (cost=401.61..401.62 rows=1 width=32) |
| -> Hash Join (cost=293.08..401.59 rows=5 width=6) |
| Hash Cond: ("*SELECT* 1".contract_id = c.id) |
| -> Append (cost=75.98..183.41 rows=275 width=10) |
| -> Subquery Scan on "*SELECT* 1" (cost=75.98..118.90 rows=273 width=10) |
| -> Hash Join (cost=75.98..116.17 rows=273 width=98) |
| Hash Cond: (r.erp_collect_ticket_id = t.id) |
| -> Seq Scan on tbl_erp_collect_ticket_settles r (cost=0.00..34.77 rows=2059 width=14) |
| Filter: (sales_contract_id IS NOT NULL) |
| -> Hash (cost=72.43..72.43 rows=284 width=4) |
| -> Seq Scan on tbl_erp_collect_tickets t (cost=0.00..72.43 rows=284 width=4) |
| Filter: ((status = ANY ('{2,5}'::integer[])) AND (created_at >= '2025-01-01 00:00:00+08'::timestamp with time zone) AND (created_at < '2026-01-01 00:00:00'::timestamp without time zone)) |
| -> Subquery Scan on "*SELECT* 2" (cost=0.28..9.34 rows=1 width=36) |
| -> Nested Loop (cost=0.28..9.33 rows=1 width=124) |
| -> Seq Scan on tbl_erp_cash_cost_ticket_sales_contract_settles r_1 (cost=0.00..1.01 rows=1 width=40) |
| 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.28..8.31 rows=1 width=4) |
| Index Cond: (id = r_1.erp_cash_cost_ticket_id) |
| Filter: (is_payment_settle AND (status = ANY ('{2,5}'::integer[])) AND (created_at >= '2025-01-01 00:00:00+08'::timestamp with time zone) AND (created_at < '2026-01-01 00:00:00'::timestamp without time zone)) |
| -> Subquery Scan on "*SELECT* 3" (cost=0.28..55.17 rows=1 width=36) |
| -> Nested Loop (cost=0.28..55.16 rows=1 width=124) |
| -> Seq Scan on tbl_erp_payment_ticket_settles r_2 (cost=0.00..38.50 rows=2 width=14) |
| 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..8.30 rows=1 width=4) |
| Index Cond: (id = r_2.erp_payment_ticket_id) |
| Filter: (is_payment_settle AND (status = ANY ('{2,5}'::integer[])) AND (created_at >= '2025-01-01 00:00:00+08'::timestamp with time zone) AND (created_at < '2026-01-01 00:00:00'::timestamp without time zone)) |
| -> Hash (cost=216.70..216.70 rows=32 width=4) |
| -> Hash Join (cost=148.02..216.70 rows=32 width=4) |
| Hash Cond: (c.from_project = p.id) |
| -> Seq Scan on tbl_sales_contracts c (cost=0.00..64.37 rows=1637 width=8) |
| -> Hash (cost=147.29..147.29 rows=59 width=4) |
| -> Bitmap Heap Scan on tbl_projects p (cost=5.13..147.29 rows=59 width=4) |
| Recheck Cond: (created_by = 1001) |
| Filter: (project_status = 3) |
| -> Bitmap Index Scan on tbl_projects_created_by_idx (cost=0.00..5.12 rows=112 width=0) |
| Index Cond: (created_by = 1001) |