| GroupAggregate (cost=1726.53..1731.43 rows=14 width=68) |
| Group Key: u.id |
| -> Merge Left Join (cost=1726.53..1730.38 rows=14 width=144) |
| Merge Cond: (u.id = t.user_id) |
| -> Merge Left Join (cost=1725.10..1728.90 rows=14 width=132) |
| Merge Cond: (u.id = am_3.user_id) |
| -> Merge Left Join (cost=111.69..112.28 rows=14 width=100) |
| Merge Cond: (u.id = am_1.user_id) |
| -> Merge Left Join (cost=63.20..63.58 rows=14 width=68) |
| Merge Cond: (u.id = t_1.handler) |
| -> Sort (cost=10.23..10.26 rows=14 width=4) |
| Sort Key: u.id |
| -> Seq Scan on tbl_users u (cost=0.00..9.96 rows=14 width=4) |
| Filter: (id = ANY ('{5500,5499,5332,1001,5087,5467,5300,5311,5295,1013,5476,1004,1005,5449}'::integer[])) |
| -> GroupAggregate (cost=52.98..53.18 rows=8 width=68) |
| Group Key: t_1.handler |
| -> Sort (cost=52.98..53.00 rows=8 width=68) |
| Sort Key: t_1.handler |
| -> Append (cost=27.98..52.86 rows=8 width=68) |
| -> HashAggregate (cost=27.98..28.07 rows=6 width=68) |
| Group Key: t_1.handler |
| -> Hash Right Join (cost=13.47..27.63 rows=47 width=14) |
| Hash Cond: (eipss.erp_sales_outbound_id = t_1.id) |
| -> Seq Scan on tbl_erp_inventory_product_spents eipss (cost=0.00..12.65 rows=565 width=14) |
| -> Hash (cost=13.27..13.27 rows=16 width=8) |
| -> Seq Scan on tbl_erp_sales_outbounds t_1 (cost=1.07..13.27 rows=16 width=8) |
| Filter: (((NOT (hashed SubPlan 1)) OR (project_id IS NULL)) AND (created_at >= '2026-01-01 00:00:00+08'::timestamp with time zone) AND (created_at <= '2026-12-31 23:59:59+08'::timestamp with time zone) AND (status = 2) AND (handler = ANY ('{5500,5499,5332,1001,5087,5467,5300,5311,5295,1013,5476,1004,1005,5449}'::integer[]))) |
| SubPlan 1 |
| -> Group (cost=1.06..1.07 rows=2 width=4) |
| Group Key: t_20.project_id |
| -> Sort (cost=1.06..1.06 rows=2 width=4) |
| Sort Key: t_20.project_id |
| -> Seq Scan on tbl_erp_profit_distributes t_20 (cost=0.00..1.05 rows=2 width=4) |
| Filter: ((project_id IS NOT NULL) AND (status = 2)) |
| -> GroupAggregate (cost=24.63..24.70 rows=2 width=68) |
| Group Key: am.user_id |
| -> Sort (cost=24.63..24.64 rows=2 width=19) |
| Sort Key: am.user_id |
| -> Merge Join (cost=11.06..24.62 rows=2 width=19) |
| Merge Cond: (pd.id = am.erp_profit_distribute_id) |
| -> Nested Loop (cost=9.74..36.71 rows=2 width=14) |
| Join Filter: (t_2.project_id = pd.project_id) |
| -> Index Scan using tbl_erp_profit_distributes_pkey on tbl_erp_profit_distributes pd (cost=0.13..12.19 rows=4 width=8) |
| -> Materialize (cost=9.61..24.41 rows=2 width=18) |
| -> Hash Right Join (cost=9.61..24.40 rows=2 width=18) |
| Hash Cond: (eipss_1.erp_sales_outbound_id = t_2.id) |
| -> Seq Scan on tbl_erp_inventory_product_spents eipss_1 (cost=0.00..12.65 rows=565 width=14) |
| -> Hash (cost=9.60..9.60 rows=1 width=12) |
| -> Hash Join (cost=1.11..9.60 rows=1 width=12) |
| Hash Cond: (t_2.project_id = t_3.project_id) |
| -> Seq Scan on tbl_erp_sales_outbounds t_2 (cost=0.00..8.36 rows=47 width=8) |
| Filter: ((created_at >= '2026-01-01 00:00:00+08'::timestamp with time zone) AND (created_at <= '2026-12-31 23:59:59+08'::timestamp with time zone) AND (status = 2)) |
| -> Hash (cost=1.09..1.09 rows=2 width=4) |
| -> Group (cost=1.06..1.07 rows=2 width=4) |
| Group Key: t_3.project_id |
| -> Sort (cost=1.06..1.06 rows=2 width=4) |
| Sort Key: t_3.project_id |
| -> Seq Scan on tbl_erp_profit_distributes t_3 (cost=0.00..1.05 rows=2 width=4) |
| Filter: ((project_id IS NOT NULL) AND (status = 2)) |
| -> Sort (cost=1.32..1.34 rows=7 width=13) |
| Sort Key: am.erp_profit_distribute_id |
| -> Seq Scan on tbl_erp_profit_distribute_pcts am (cost=0.00..1.22 rows=7 width=13) |
| Filter: (user_id = ANY ('{5500,5499,5332,1001,5087,5467,5300,5311,5295,1013,5476,1004,1005,5449}'::integer[])) |
| -> GroupAggregate (cost=48.49..48.59 rows=5 width=36) |
| Group Key: am_1.user_id |
| -> Sort (cost=48.49..48.50 rows=5 width=36) |
| Sort Key: am_1.user_id |
| -> Append (cost=24.90..48.43 rows=5 width=36) |
| -> GroupAggregate (cost=24.90..24.96 rows=3 width=36) |
| Group Key: am_1.user_id |
| -> Sort (cost=24.90..24.91 rows=3 width=9) |
| Sort Key: am_1.user_id |
| -> Nested Loop Left Join (cost=4.26..24.87 rows=3 width=9) |
| Filter: (((NOT (hashed SubPlan 2)) OR (t_4.sales_contract_id IS NULL)) AND ((NOT (hashed SubPlan 3)) OR (t_4.sales_contract_id IS NULL))) |
| -> Hash Join (cost=1.84..3.25 rows=3 width=13) |
| Hash Cond: (am_1.erp_other_income_ticket_id = t_4.id) |
| -> Seq Scan on tbl_erp_other_income_ticket_handlers am_1 (cost=0.00..1.39 rows=10 width=13) |
| Filter: (user_id = ANY ('{5500,5499,5332,1001,5087,5467,5300,5311,5295,1013,5476,1004,1005,5449}'::integer[])) |
| -> Hash (cost=1.70..1.70 rows=11 width=8) |
| -> Seq Scan on tbl_erp_other_income_tickets t_4 (cost=0.00..1.70 rows=11 width=8) |
| Filter: ((created_at >= '2026-01-01 00:00:00+08'::timestamp with time zone) AND (created_at <= '2026-12-31 23:59:59+08'::timestamp with time zone) AND (status = 2)) |
| -> Index Scan using tbl_sales_contracts_pkey on tbl_sales_contracts sc (cost=0.28..6.48 rows=1 width=8) |
| Index Cond: (id = t_4.sales_contract_id) |
| SubPlan 2 |
| -> Group (cost=1.06..1.07 rows=2 width=4) |
| Group Key: t_21.project_id |
| -> Sort (cost=1.06..1.06 rows=2 width=4) |
| Sort Key: t_21.project_id |
| -> Seq Scan on tbl_erp_profit_distributes t_21 (cost=0.00..1.05 rows=2 width=4) |
| Filter: ((project_id IS NOT NULL) AND (status = 2)) |
| SubPlan 3 |
| -> Group (cost=1.06..1.07 rows=2 width=4) |
| Group Key: t_22.project_id |
| -> Sort (cost=1.06..1.06 rows=2 width=4) |
| Sort Key: t_22.project_id |
| -> Seq Scan on tbl_erp_profit_distributes t_22 (cost=0.00..1.05 rows=2 width=4) |
| Filter: ((project_id IS NOT NULL) AND (status = 2)) |
| -> GroupAggregate (cost=22.02..22.05 rows=1 width=36) |
| Group Key: am_2.user_id |
| -> Sort (cost=22.02..22.02 rows=1 width=15) |
| Sort Key: am_2.user_id |
| -> Nested Loop (cost=1.34..22.01 rows=1 width=15) |
| Join Filter: (sc_1.id = t_5.sales_contract_id) |
| -> Nested Loop (cost=1.34..20.17 rows=1 width=13) |
| Join Filter: (pd_1.id = am_2.erp_profit_distribute_id) |
| -> Nested Loop (cost=1.34..18.87 rows=1 width=8) |
| Join Filter: (sc_1.from_project = pd_1.project_id) |
| -> Seq Scan on tbl_erp_profit_distributes pd_1 (cost=0.00..1.04 rows=4 width=8) |
| -> Materialize (cost=1.34..17.71 rows=2 width=12) |
| -> Nested Loop (cost=1.34..17.70 rows=2 width=12) |
| -> Group (cost=1.06..1.07 rows=2 width=4) |
| Group Key: t_6.project_id |
| -> Sort (cost=1.06..1.06 rows=2 width=4) |
| Sort Key: t_6.project_id |
| -> Seq Scan on tbl_erp_profit_distributes t_6 (cost=0.00..1.05 rows=2 width=4) |
| Filter: ((project_id IS NOT NULL) AND (status = 2)) |
| -> Index Scan using tbl_sales_contracts_from_project_idx on tbl_sales_contracts sc_1 (cost=0.28..8.29 rows=1 width=8) |
| Index Cond: (from_project = t_6.project_id) |
| -> Seq Scan on tbl_erp_profit_distribute_pcts am_2 (cost=0.00..1.22 rows=7 width=13) |
| Filter: (user_id = ANY ('{5500,5499,5332,1001,5087,5467,5300,5311,5295,1013,5476,1004,1005,5449}'::integer[])) |
| -> Seq Scan on tbl_erp_other_income_tickets t_5 (cost=0.00..1.70 rows=11 width=10) |
| Filter: ((created_at >= '2026-01-01 00:00:00+08'::timestamp with time zone) AND (created_at <= '2026-12-31 23:59:59+08'::timestamp with time zone) AND (status = 2)) |
| -> HashAggregate (cost=1.36..1.37 rows=1 width=36) |
| Group Key: t_7.handler |
| -> Seq Scan on tbl_erp_inventory_overflows t_7 (cost=0.00..1.35 rows=2 width=9) |
| Filter: ((created_at >= '2026-01-01 00:00:00+08'::timestamp with time zone) AND (created_at <= '2026-12-31 23:59:59+08'::timestamp with time zone) AND (status = 2) AND (handler = ANY ('{5500,5499,5332,1001,5087,5467,5300,5311,5295,1013,5476,1004,1005,5449}'::integer[]))) |
| -> GroupAggregate (cost=1613.41..1615.31 rows=95 width=36) |
| Group Key: am_3.user_id |
| -> Sort (cost=1613.41..1613.65 rows=95 width=36) |
| Sort Key: am_3.user_id |
| -> Append (cost=920.55..1610.29 rows=95 width=36) |
| -> GroupAggregate (cost=920.55..922.15 rows=60 width=36) |
| Group Key: am_3.user_id |
| -> Sort (cost=920.55..920.83 rows=113 width=9) |
| Sort Key: am_3.user_id |
| -> Hash Left Join (cost=629.73..916.70 rows=113 width=9) |
| Hash Cond: (t_8.sales_contract_id = sc_2.id) |
| Filter: ((NOT (hashed SubPlan 4)) OR (t_8.sales_contract_id IS NULL)) |
| -> Hash Join (cost=538.69..825.31 rows=129 width=13) |
| Hash Cond: (am_3.erp_cash_cost_ticket_id = t_8.id) |
| -> Seq Scan on tbl_erp_cash_cost_ticket_handlers am_3 (cost=0.00..278.06 rows=3263 width=13) |
| Filter: (user_id = ANY ('{5500,5499,5332,1001,5087,5467,5300,5311,5295,1013,5476,1004,1005,5449}'::integer[])) |
| -> Hash (cost=534.50..534.50 rows=335 width=8) |
| -> Seq Scan on tbl_erp_cash_cost_tickets t_8 (cost=0.00..534.50 rows=335 width=8) |
| Filter: (is_payment_settle AND (created_at >= '2026-01-01 00:00:00+08'::timestamp with time zone) AND (created_at <= '2026-12-31 23:59:59+08'::timestamp with time zone) AND (created_at >= '2025-08-08 14:34:58+08'::timestamp with time zone) AND (status = 2)) |
| -> Hash (cost=68.32..68.32 rows=1732 width=8) |
| -> Seq Scan on tbl_sales_contracts sc_2 (cost=0.00..68.32 rows=1732 width=8) |
| SubPlan 4 |
| -> Group (cost=1.06..1.07 rows=2 width=4) |
| Group Key: t_23.project_id |
| -> Sort (cost=1.06..1.06 rows=2 width=4) |
| Sort Key: t_23.project_id |
| -> Seq Scan on tbl_erp_profit_distributes t_23 (cost=0.00..1.05 rows=2 width=4) |
| Filter: ((project_id IS NOT NULL) AND (status = 2)) |
| -> GroupAggregate (cost=558.87..558.90 rows=1 width=36) |
| Group Key: am_4.user_id |
| -> Sort (cost=558.87..558.88 rows=1 width=14) |
| Sort Key: am_4.user_id |
| -> Nested Loop (cost=1.34..558.86 rows=1 width=14) |
| Join Filter: (sc_3.id = t_9.sales_contract_id) |
| -> Nested Loop (cost=1.34..20.17 rows=1 width=13) |
| Join Filter: (pd_2.id = am_4.erp_profit_distribute_id) |
| -> Nested Loop (cost=1.34..18.87 rows=1 width=8) |
| Join Filter: (sc_3.from_project = pd_2.project_id) |
| -> Seq Scan on tbl_erp_profit_distributes pd_2 (cost=0.00..1.04 rows=4 width=8) |
| -> Materialize (cost=1.34..17.71 rows=2 width=12) |
| -> Nested Loop (cost=1.34..17.70 rows=2 width=12) |
| -> Group (cost=1.06..1.07 rows=2 width=4) |
| Group Key: t_10.project_id |
| -> Sort (cost=1.06..1.06 rows=2 width=4) |
| Sort Key: t_10.project_id |
| -> Seq Scan on tbl_erp_profit_distributes t_10 (cost=0.00..1.05 rows=2 width=4) |
| Filter: ((project_id IS NOT NULL) AND (status = 2)) |
| -> Index Scan using tbl_sales_contracts_from_project_idx on tbl_sales_contracts sc_3 (cost=0.28..8.29 rows=1 width=8) |
| Index Cond: (from_project = t_10.project_id) |
| -> Seq Scan on tbl_erp_profit_distribute_pcts am_4 (cost=0.00..1.22 rows=7 width=13) |
| Filter: (user_id = ANY ('{5500,5499,5332,1001,5087,5467,5300,5311,5295,1013,5476,1004,1005,5449}'::integer[])) |
| -> Seq Scan on tbl_erp_cash_cost_tickets t_9 (cost=0.00..534.50 rows=335 width=9) |
| Filter: (is_payment_settle AND (created_at >= '2025-08-08 14:34:58+08'::timestamp with time zone) AND (created_at >= '2026-01-01 00:00:00+08'::timestamp with time zone) AND (created_at <= '2026-12-31 23:59:59+08'::timestamp with time zone) AND (status = 2)) |
| -> HashAggregate (cost=7.18..7.28 rows=8 width=36) |
| Group Key: am_5.user_id |
| -> Hash Join (cost=4.35..7.14 rows=8 width=9) |
| Hash Cond: (am_5.erp_cost_ticket_id = t_11.id) |
| -> Seq Scan on tbl_erp_cost_ticket_handlers am_5 (cost=0.00..2.62 rows=56 width=13) |
| Filter: (user_id = ANY ('{5500,5499,5332,1001,5087,5467,5300,5311,5295,1013,5476,1004,1005,5449}'::integer[])) |
| -> Hash (cost=4.25..4.25 rows=8 width=4) |
| -> Seq Scan on tbl_erp_cost_tickets t_11 (cost=1.07..4.25 rows=8 width=4) |
| Filter: ((created_at >= '2026-01-01 00:00:00+08'::timestamp with time zone) AND (created_at <= '2026-12-31 23:59:59+08'::timestamp with time zone) AND ((NOT (hashed SubPlan 5)) OR (project_id IS NULL)) AND (status = 2)) |
| SubPlan 5 |
| -> Group (cost=1.06..1.07 rows=2 width=4) |
| Group Key: t_24.project_id |
| -> Sort (cost=1.06..1.06 rows=2 width=4) |
| Sort Key: t_24.project_id |
| -> Seq Scan on tbl_erp_profit_distributes t_24 (cost=0.00..1.05 rows=2 width=4) |
| Filter: ((project_id IS NOT NULL) AND (status = 2)) |
| -> GroupAggregate (cost=6.59..6.62 rows=1 width=36) |
| Group Key: am_6.user_id |
| -> Sort (cost=6.59..6.59 rows=1 width=14) |
| Sort Key: am_6.user_id |
| -> Nested Loop (cost=1.11..6.58 rows=1 width=14) |
| Join Filter: (pd_3.id = am_6.erp_profit_distribute_id) |
| -> Nested Loop (cost=1.11..5.27 rows=1 width=9) |
| Join Filter: (t_12.project_id = pd_3.project_id) |
| -> Hash Join (cost=1.11..4.18 rows=1 width=13) |
| Hash Cond: (t_12.project_id = t_13.project_id) |
| -> Seq Scan on tbl_erp_cost_tickets t_12 (cost=0.00..3.03 rows=13 width=9) |
| Filter: ((created_at >= '2026-01-01 00:00:00+08'::timestamp with time zone) AND (created_at <= '2026-12-31 23:59:59+08'::timestamp with time zone) AND (status = 2)) |
| -> Hash (cost=1.09..1.09 rows=2 width=4) |
| -> Group (cost=1.06..1.07 rows=2 width=4) |
| Group Key: t_13.project_id |
| -> Sort (cost=1.06..1.06 rows=2 width=4) |
| Sort Key: t_13.project_id |
| -> Seq Scan on tbl_erp_profit_distributes t_13 (cost=0.00..1.05 rows=2 width=4) |
| Filter: ((project_id IS NOT NULL) AND (status = 2)) |
| -> Seq Scan on tbl_erp_profit_distributes pd_3 (cost=0.00..1.04 rows=4 width=8) |
| -> Seq Scan on tbl_erp_profit_distribute_pcts am_6 (cost=0.00..1.22 rows=7 width=13) |
| Filter: (user_id = ANY ('{5500,5499,5332,1001,5087,5467,5300,5311,5295,1013,5476,1004,1005,5449}'::integer[])) |
| -> GroupAggregate (cost=38.88..39.12 rows=11 width=36) |
| Group Key: am_7.user_id |
| -> Sort (cost=38.88..38.92 rows=13 width=9) |
| Sort Key: am_7.user_id |
| -> Hash Join (cost=4.33..38.64 rows=13 width=9) |
| Hash Cond: (t_14.id = am_7.erp_cost_convert_ticket_id) |
| -> Nested Loop Left Join (cost=1.35..35.50 rows=4 width=4) |
| Filter: ((NOT (hashed SubPlan 6)) OR (t_14.sales_contract_id IS NULL)) |
| -> Seq Scan on tbl_erp_cost_convert_tickets t_14 (cost=0.00..1.19 rows=4 width=8) |
| Filter: ((created_at >= '2026-01-01 00:00:00+08'::timestamp with time zone) AND (created_at <= '2026-12-31 23:59:59+08'::timestamp with time zone) AND (status = 2)) |
| -> Index Scan using tbl_sales_contracts_pkey on tbl_sales_contracts sc_4 (cost=0.28..8.29 rows=1 width=8) |
| Index Cond: (id = t_14.sales_contract_id) |
| SubPlan 6 |
| -> Group (cost=1.06..1.07 rows=2 width=4) |
| Group Key: t_25.project_id |
| -> Sort (cost=1.06..1.06 rows=2 width=4) |
| Sort Key: t_25.project_id |
| -> Seq Scan on tbl_erp_profit_distributes t_25 (cost=0.00..1.05 rows=2 width=4) |
| Filter: ((project_id IS NOT NULL) AND (status = 2)) |
| -> Hash (cost=2.51..2.51 rows=37 width=13) |
| -> Seq Scan on tbl_erp_cost_convert_ticket_handlers am_7 (cost=0.00..2.51 rows=37 width=13) |
| Filter: (user_id = ANY ('{5500,5499,5332,1001,5087,5467,5300,5311,5295,1013,5476,1004,1005,5449}'::integer[])) |
| -> GroupAggregate (cost=21.43..21.45 rows=1 width=36) |
| Group Key: am_8.user_id |
| -> Sort (cost=21.43..21.43 rows=1 width=15) |
| Sort Key: am_8.user_id |
| -> Nested Loop (cost=1.34..21.41 rows=1 width=15) |
| Join Filter: (sc_5.id = t_15.sales_contract_id) |
| -> Nested Loop (cost=1.34..20.17 rows=1 width=13) |
| Join Filter: (pd_4.id = am_8.erp_profit_distribute_id) |
| -> Nested Loop (cost=1.34..18.87 rows=1 width=8) |
| Join Filter: (sc_5.from_project = pd_4.project_id) |
| -> Seq Scan on tbl_erp_profit_distributes pd_4 (cost=0.00..1.04 rows=4 width=8) |
| -> Materialize (cost=1.34..17.71 rows=2 width=12) |
| -> Nested Loop (cost=1.34..17.70 rows=2 width=12) |
| -> Group (cost=1.06..1.07 rows=2 width=4) |
| Group Key: t_16.project_id |
| -> Sort (cost=1.06..1.06 rows=2 width=4) |
| Sort Key: t_16.project_id |
| -> Seq Scan on tbl_erp_profit_distributes t_16 (cost=0.00..1.05 rows=2 width=4) |
| Filter: ((project_id IS NOT NULL) AND (status = 2)) |
| -> Index Scan using tbl_sales_contracts_from_project_idx on tbl_sales_contracts sc_5 (cost=0.28..8.29 rows=1 width=8) |
| Index Cond: (from_project = t_16.project_id) |
| -> Seq Scan on tbl_erp_profit_distribute_pcts am_8 (cost=0.00..1.22 rows=7 width=13) |
| Filter: (user_id = ANY ('{5500,5499,5332,1001,5087,5467,5300,5311,5295,1013,5476,1004,1005,5449}'::integer[])) |
| -> Seq Scan on tbl_erp_cost_convert_tickets t_15 (cost=0.00..1.19 rows=4 width=10) |
| Filter: ((created_at >= '2026-01-01 00:00:00+08'::timestamp with time zone) AND (created_at <= '2026-12-31 23:59:59+08'::timestamp with time zone) AND (status = 2)) |
| -> HashAggregate (cost=27.83..27.91 rows=7 width=36) |
| Group Key: t_17.handler |
| -> Hash Right Join (cost=12.25..26.39 rows=191 width=14) |
| Hash Cond: (eipss_2.erp_sales_gift_id = t_17.id) |
| -> Seq Scan on tbl_erp_inventory_product_spents eipss_2 (cost=0.00..12.65 rows=565 width=14) |
| -> Hash (cost=11.53..11.53 rows=58 width=8) |
| -> Seq Scan on tbl_erp_sales_gifts t_17 (cost=1.07..11.53 rows=58 width=8) |
| Filter: (((NOT (hashed SubPlan 7)) OR (project_id IS NULL)) AND (created_at >= '2026-01-01 00:00:00+08'::timestamp with time zone) AND (created_at <= '2026-12-31 23:59:59+08'::timestamp with time zone) AND (status = 2) AND (handler = ANY ('{5500,5499,5332,1001,5087,5467,5300,5311,5295,1013,5476,1004,1005,5449}'::integer[]))) |
| SubPlan 7 |
| -> Group (cost=1.06..1.07 rows=2 width=4) |
| Group Key: t_26.project_id |
| -> Sort (cost=1.06..1.06 rows=2 width=4) |
| Sort Key: t_26.project_id |
| -> Seq Scan on tbl_erp_profit_distributes t_26 (cost=0.00..1.05 rows=2 width=4) |
| Filter: ((project_id IS NOT NULL) AND (status = 2)) |
| -> GroupAggregate (cost=25.72..25.92 rows=6 width=36) |
| Group Key: am_9.user_id |
| -> Sort (cost=25.72..25.74 rows=8 width=19) |
| Sort Key: am_9.user_id |
| -> Hash Right Join (cost=10.81..25.60 rows=8 width=19) |
| Hash Cond: (eipss_3.erp_sales_gift_id = t_18.id) |
| -> Seq Scan on tbl_erp_inventory_product_spents eipss_3 (cost=0.00..12.65 rows=565 width=14) |
| -> Hash (cost=10.79..10.79 rows=2 width=13) |
| -> Hash Join (cost=3.55..10.79 rows=2 width=13) |
| Hash Cond: (t_18.project_id = pd_5.project_id) |
| -> Hash Join (cost=1.11..8.32 rows=2 width=12) |
| Hash Cond: (t_18.project_id = t_19.project_id) |
| -> Seq Scan on tbl_erp_sales_gifts t_18 (cost=0.00..7.01 rows=71 width=8) |
| Filter: ((created_at >= '2026-01-01 00:00:00+08'::timestamp with time zone) AND (created_at <= '2026-12-31 23:59:59+08'::timestamp with time zone) AND (status = 2)) |
| -> Hash (cost=1.09..1.09 rows=2 width=4) |
| -> Group (cost=1.06..1.07 rows=2 width=4) |
| Group Key: t_19.project_id |
| -> Sort (cost=1.06..1.06 rows=2 width=4) |
| Sort Key: t_19.project_id |
| -> Seq Scan on tbl_erp_profit_distributes t_19 (cost=0.00..1.05 rows=2 width=4) |
| Filter: ((project_id IS NOT NULL) AND (status = 2)) |
| -> Hash (cost=2.35..2.35 rows=7 width=13) |
| -> Hash Join (cost=1.09..2.35 rows=7 width=13) |
| Hash Cond: (am_9.erp_profit_distribute_id = pd_5.id) |
| -> Seq Scan on tbl_erp_profit_distribute_pcts am_9 (cost=0.00..1.22 rows=7 width=13) |
| Filter: (user_id = ANY ('{5500,5499,5332,1001,5087,5467,5300,5311,5295,1013,5476,1004,1005,5449}'::integer[])) |
| -> Hash (cost=1.04..1.04 rows=4 width=8) |
| -> Seq Scan on tbl_erp_profit_distributes pd_5 (cost=0.00..1.04 rows=4 width=8) |
| -> Sort (cost=1.43..1.43 rows=1 width=16) |
| Sort Key: t.user_id |
| -> Seq Scan on tbl_erp_user_profits t (cost=0.00..1.42 rows=1 width=16) |
| Filter: ((created_at >= '2026-01-01 00:00:00+08'::timestamp with time zone) AND (created_at <= '2026-12-31 23:59:59+08'::timestamp with time zone)) |