Aggregate (cost=859.95..859.96 rows=1 width=32) |
-> Hash Join (cost=286.32..859.93 rows=6 width=6) |
Hash Cond: ("*SELECT* 1".contract_id = c.id) |
-> Append (cost=73.61..645.98 rows=316 width=4) |
-> Subquery Scan on "*SELECT* 1" (cost=73.61..114.27 rows=219 width=4) |
-> Hash Join (cost=73.61..112.08 rows=219 width=124) |
Hash Cond: (r.erp_collect_ticket_id = t.id) |
-> Seq Scan on tbl_erp_collect_ticket_settles r (cost=0.00..33.18 rows=2011 width=8) |
Filter: (sales_contract_id IS NOT NULL) |
-> Hash (cost=70.86..70.86 rows=220 width=4) |
-> Seq Scan on tbl_erp_collect_tickets t (cost=0.00..70.86 rows=220 width=4) |
Filter: ((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) AND (status = ANY ('{2,5,1}'::integer[]))) |
-> Subquery Scan on "*SELECT* 2" (cost=459.09..479.88 rows=96 width=4) |
-> Hash Join (cost=459.09..478.92 rows=96 width=124) |
Hash Cond: (r_1.erp_cash_cost_ticket_id = t_1.id) |
-> Seq Scan on tbl_erp_cash_cost_ticket_sales_contract_settles r_1 (cost=0.00..17.80 rows=776 width=8) |
Filter: (sales_contract_id IS NOT NULL) |
-> Hash (cost=447.51..447.51 rows=926 width=4) |
-> Seq Scan on tbl_erp_cash_cost_tickets t_1 (cost=0.00..447.51 rows=926 width=4) |
Filter: ((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) AND (status = ANY ('{2,5,1}'::integer[]))) |
-> Subquery Scan on "*SELECT* 3" (cost=0.28..51.83 rows=1 width=4) |
-> Nested Loop (cost=0.28..51.82 rows=1 width=124) |
-> Seq Scan on tbl_erp_payment_ticket_settles r_2 (cost=0.00..35.14 rows=2 width=8) |
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.31 rows=1 width=4) |
Index Cond: (id = r_2.erp_payment_ticket_id) |
Filter: ((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) AND (status = ANY ('{2,5,1}'::integer[]))) |
-> Hash (cost=212.30..212.30 rows=33 width=10) |
-> Hash Join (cost=144.19..212.30 rows=33 width=10) |
Hash Cond: (c.from_project = p.id) |
-> Seq Scan on tbl_sales_contracts c (cost=0.00..63.71 rows=1671 width=14) |
-> Hash (cost=143.45..143.45 rows=59 width=4) |
-> Bitmap Heap Scan on tbl_projects p (cost=5.12..143.45 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.11 rows=110 width=0) |
Index Cond: (created_by = 1001) |