Aggregate (cost=944.31..944.32 rows=1 width=32) |
-> Nested Loop (cost=158.48..944.05 rows=101 width=6) |
-> Hash Join (cost=158.20..731.41 rows=316 width=10) |
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=63.71..63.71 rows=1671 width=14) |
-> Seq Scan on tbl_sales_contracts c (cost=0.00..63.71 rows=1671 width=14) |
-> 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: ((project_status = 3) AND (created_by = ANY ('{1001,1004,1005,1013,5087,5295,5300,5311,5329,5332,5420,5448,5449}'::integer[]))) |