Aggregate (cost=1019.07..1019.08 rows=1 width=32) |
-> Hash Join (cost=322.96..1019.06 rows=5 width=6) |
Hash Cond: ("*SELECT* 1".contract_id = c.id) |
-> Append (cost=71.63..766.67 rows=269 width=4) |
-> Subquery Scan on "*SELECT* 1" (cost=71.63..111.62 rows=187 width=4) |
-> Hash Join (cost=71.63..109.75 rows=187 width=124) |
Hash Cond: (r.erp_collect_ticket_id = t.id) |
-> Seq Scan on tbl_erp_collect_ticket_settles r (cost=0.00..32.89 rows=1988 width=8) |
Filter: (sales_contract_id IS NOT NULL) |
-> Hash (cost=69.29..69.29 rows=187 width=4) |
-> Seq Scan on tbl_erp_collect_tickets t (cost=0.00..69.29 rows=187 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=591.35..612.00 rows=81 width=4) |
-> Hash Join (cost=591.35..611.19 rows=81 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=581.78..581.78 rows=766 width=4) |
-> Seq Scan on tbl_erp_cash_cost_tickets t_1 (cost=0.00..581.78 rows=766 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..43.06 rows=1 width=4) |
-> Nested Loop (cost=0.28..43.05 rows=1 width=124) |
-> Seq Scan on tbl_erp_payment_ticket_settles r_2 (cost=0.00..34.66 rows=1 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=250.93..250.93 rows=32 width=10) |
-> Hash Join (cost=185.89..250.93 rows=32 width=10) |
Hash Cond: (c.from_project = p.id) |
-> Seq Scan on tbl_sales_contracts c (cost=0.00..60.86 rows=1586 width=14) |
-> Hash (cost=185.15..185.15 rows=59 width=4) |
-> Bitmap Heap Scan on tbl_projects p (cost=5.12..185.15 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) |