| Limit (cost=1996.98..1997.08 rows=40 width=452) |
| -> Sort (cost=1996.98..2015.98 rows=7598 width=452) |
| Sort Key: "*SELECT* 1".updated_at DESC |
| -> Append (cost=392.35..1680.83 rows=7598 width=452) |
| -> Subquery Scan on "*SELECT* 1" (cost=392.35..538.30 rows=2013 width=443) |
| -> HashAggregate (cost=392.35..508.10 rows=2013 width=387) |
| Group Key: s.id |
| -> Hash Left Join (cost=155.23..301.77 rows=2013 width=343) |
| Hash Cond: (s.id = sales_contract.client_id) |
| -> Hash Left Join (cost=30.25..171.50 rows=2013 width=303) |
| Hash Cond: (s.id = cos.client_id) |
| -> Hash Left Join (cost=23.37..156.54 rows=2013 width=239) |
| Hash Cond: (s.id = "*SELECT* 1_1".client_id) |
| -> Hash Left Join (cost=15.51..140.84 rows=2013 width=175) |
| Hash Cond: (s.id = oc.client_id) |
| -> Hash Left Join (cost=12.06..129.75 rows=2013 width=111) |
| Hash Cond: (s.id = ap.client_id) |
| -> Seq Scan on tbl_clients s (cost=0.00..110.13 rows=2013 width=79) |
| Filter: (NOT deleted) |
| -> Hash (cost=12.04..12.04 rows=1 width=36) |
| -> Subquery Scan on ap (cost=12.01..12.04 rows=1 width=36) |
| -> GroupAggregate (cost=12.01..12.04 rows=1 width=40) |
| Group Key: t.supplier_id, t.client_id |
| -> Sort (cost=12.01..12.02 rows=1 width=40) |
| Sort Key: t.supplier_id, t.client_id |
| -> Seq Scan on tbl_erp_advance_payment_tickets t (cost=0.00..12.00 rows=1 width=40) |
| Filter: (is_payment_settle AND (status = 2)) |
| -> Hash (cost=3.32..3.32 rows=10 width=68) |
| -> Subquery Scan on oc (cost=3.07..3.32 rows=10 width=68) |
| -> HashAggregate (cost=3.07..3.22 rows=10 width=80) |
| Group Key: t_1.supplier_id, t_1.client_id, t_1.user_id, t_1.contact_id |
| -> Seq Scan on tbl_erp_other_collect_tickets t_1 (cost=0.00..2.55 rows=35 width=25) |
| Filter: ((bank_settle_at IS NOT NULL) AND (status = 2)) |
| -> Hash (cost=7.50..7.50 rows=29 width=68) |
| -> Append (cost=4.18..7.50 rows=29 width=68) |
| -> Subquery Scan on "*SELECT* 1_1" (cost=4.18..4.83 rows=26 width=68) |
| -> HashAggregate (cost=4.18..4.57 rows=26 width=80) |
| Group Key: t_2.supplier_id, t_2.client_id, t_2.user_id, t_2.contact_id |
| -> Seq Scan on tbl_erp_other_payment_tickets t_2 (cost=0.00..3.55 rows=42 width=26) |
| Filter: (status = 2) |
| -> Subquery Scan on "*SELECT* 2_1" (cost=2.60..2.67 rows=3 width=68) |
| -> HashAggregate (cost=2.60..2.64 rows=3 width=80) |
| Group Key: t_3.supplier_id, t_3.client_id, t_3.user_id, t_3.contact_id |
| -> Seq Scan on tbl_erp_other_collect_tickets t_3 (cost=0.00..2.55 rows=4 width=21) |
| Filter: ((bank_settle_at IS NULL) AND (status = 2)) |
| -> Hash (cost=6.24..6.24 rows=52 width=68) |
| -> Subquery Scan on cos (cost=4.94..6.24 rows=52 width=68) |
| -> HashAggregate (cost=4.94..5.72 rows=52 width=76) |
| Group Key: t_4.supplier_id, t_4.client_id, t_4.contact_id |
| -> Seq Scan on tbl_erp_cost_tickets t_4 (cost=0.00..4.03 rows=73 width=21) |
| Filter: (status = 2) |
| -> Hash (cost=124.27..124.27 rows=56 width=44) |
| -> Subquery Scan on sales_contract (cost=123.01..124.27 rows=56 width=44) |
| -> HashAggregate (cost=123.01..123.71 rows=56 width=44) |
| Group Key: t_5.client_id |
| -> Seq Scan on tbl_sales_contracts t_5 (cost=0.00..122.56 rows=60 width=7) |
| Filter: (build_by_project AND (client_id IS NOT NULL) AND (erp_un_settle_amount <> '0'::numeric)) |
| -> Subquery Scan on "*SELECT* 2" (cost=227.87..275.51 rows=657 width=440) |
| -> HashAggregate (cost=227.87..265.65 rows=657 width=384) |
| Group Key: s_1.id |
| -> Hash Left Join (cost=156.23..198.31 rows=657 width=336) |
| Hash Cond: (s_1.id = purchase_contract.supplier_id) |
| -> Hash Left Join (cost=30.25..70.60 rows=657 width=296) |
| Hash Cond: (s_1.id = cos_1.supplier_id) |
| -> Hash Left Join (cost=23.37..60.73 rows=657 width=232) |
| Hash Cond: (s_1.id = "*SELECT* 1_2".supplier_id) |
| -> Hash Left Join (cost=15.51..50.11 rows=657 width=168) |
| Hash Cond: (s_1.id = oc_1.supplier_id) |
| -> Hash Left Join (cost=12.06..44.10 rows=657 width=104) |
| Hash Cond: (s_1.id = ap_1.supplier_id) |
| -> Seq Scan on tbl_suppliers s_1 (cost=0.00..29.57 rows=657 width=72) |
| -> Hash (cost=12.04..12.04 rows=1 width=36) |
| -> Subquery Scan on ap_1 (cost=12.01..12.04 rows=1 width=36) |
| -> GroupAggregate (cost=12.01..12.04 rows=1 width=40) |
| Group Key: t_6.supplier_id, t_6.client_id |
| -> Sort (cost=12.01..12.02 rows=1 width=40) |
| Sort Key: t_6.supplier_id, t_6.client_id |
| -> Seq Scan on tbl_erp_advance_payment_tickets t_6 (cost=0.00..12.00 rows=1 width=40) |
| Filter: (is_payment_settle AND (status = 2)) |
| -> Hash (cost=3.32..3.32 rows=10 width=68) |
| -> Subquery Scan on oc_1 (cost=3.07..3.32 rows=10 width=68) |
| -> HashAggregate (cost=3.07..3.22 rows=10 width=80) |
| Group Key: t_7.supplier_id, t_7.client_id, t_7.user_id, t_7.contact_id |
| -> Seq Scan on tbl_erp_other_collect_tickets t_7 (cost=0.00..2.55 rows=35 width=25) |
| Filter: ((bank_settle_at IS NOT NULL) AND (status = 2)) |
| -> Hash (cost=7.50..7.50 rows=29 width=68) |
| -> Append (cost=4.18..7.50 rows=29 width=68) |
| -> Subquery Scan on "*SELECT* 1_2" (cost=4.18..4.83 rows=26 width=68) |
| -> HashAggregate (cost=4.18..4.57 rows=26 width=80) |
| Group Key: t_8.supplier_id, t_8.client_id, t_8.user_id, t_8.contact_id |
| -> Seq Scan on tbl_erp_other_payment_tickets t_8 (cost=0.00..3.55 rows=42 width=26) |
| Filter: (status = 2) |
| -> Subquery Scan on "*SELECT* 2_2" (cost=2.60..2.67 rows=3 width=68) |
| -> HashAggregate (cost=2.60..2.64 rows=3 width=80) |
| Group Key: t_9.supplier_id, t_9.client_id, t_9.user_id, t_9.contact_id |
| -> Seq Scan on tbl_erp_other_collect_tickets t_9 (cost=0.00..2.55 rows=4 width=21) |
| Filter: ((bank_settle_at IS NULL) AND (status = 2)) |
| -> Hash (cost=6.24..6.24 rows=52 width=68) |
| -> Subquery Scan on cos_1 (cost=4.94..6.24 rows=52 width=68) |
| -> HashAggregate (cost=4.94..5.72 rows=52 width=76) |
| Group Key: t_10.supplier_id, t_10.client_id, t_10.contact_id |
| -> Seq Scan on tbl_erp_cost_tickets t_10 (cost=0.00..4.03 rows=73 width=21) |
| Filter: (status = 2) |
| -> Hash (cost=125.22..125.22 rows=60 width=44) |
| -> Subquery Scan on purchase_contract (cost=123.87..125.22 rows=60 width=44) |
| -> HashAggregate (cost=123.87..124.62 rows=60 width=44) |
| Group Key: t_11.supplier_id |
| -> Seq Scan on tbl_purchase_contracts t_11 (cost=0.00..123.40 rows=63 width=7) |
| Filter: ((NOT is_draft) AND (NOT is_refuse) AND (supplier_id IS NOT NULL) AND (NOT is_draft) AND (NOT is_refuse) AND (erp_un_settle_amount <> '0'::numeric)) |
| -> Subquery Scan on "*SELECT* 3" (cost=32.46..39.66 rows=144 width=400) |
| -> HashAggregate (cost=32.46..36.78 rows=144 width=288) |
| Group Key: u.id |
| -> Hash Left Join (cost=11.31..29.22 rows=144 width=160) |
| Hash Cond: (u.id = "*SELECT* 1_3".user_id) |
| Filter: ((oc_2.user_id IS NOT NULL) OR ("*SELECT* 1_3".user_id IS NOT NULL)) |
| -> Hash Left Join (cost=3.45..20.53 rows=144 width=100) |
| Hash Cond: (u.id = oc_2.user_id) |
| -> Seq Scan on tbl_users u (cost=0.00..16.44 rows=144 width=32) |
| -> Hash (cost=3.32..3.32 rows=10 width=68) |
| -> Subquery Scan on oc_2 (cost=3.07..3.32 rows=10 width=68) |
| -> HashAggregate (cost=3.07..3.22 rows=10 width=80) |
| Group Key: t_12.supplier_id, t_12.client_id, t_12.user_id, t_12.contact_id |
| -> Seq Scan on tbl_erp_other_collect_tickets t_12 (cost=0.00..2.55 rows=35 width=25) |
| Filter: ((bank_settle_at IS NOT NULL) AND (status = 2)) |
| -> Hash (cost=7.50..7.50 rows=29 width=68) |
| -> Append (cost=4.18..7.50 rows=29 width=68) |
| -> Subquery Scan on "*SELECT* 1_3" (cost=4.18..4.83 rows=26 width=68) |
| -> HashAggregate (cost=4.18..4.57 rows=26 width=80) |
| Group Key: t_13.supplier_id, t_13.client_id, t_13.user_id, t_13.contact_id |
| -> Seq Scan on tbl_erp_other_payment_tickets t_13 (cost=0.00..3.55 rows=42 width=26) |
| Filter: (status = 2) |
| -> Subquery Scan on "*SELECT* 2_3" (cost=2.60..2.67 rows=3 width=68) |
| -> HashAggregate (cost=2.60..2.64 rows=3 width=80) |
| Group Key: t_14.supplier_id, t_14.client_id, t_14.user_id, t_14.contact_id |
| -> Seq Scan on tbl_erp_other_collect_tickets t_14 (cost=0.00..2.55 rows=4 width=21) |
| Filter: ((bank_settle_at IS NULL) AND (status = 2)) |
| -> Subquery Scan on "*SELECT* 4" (cost=19.70..827.37 rows=4784 width=400) |
| -> GroupAggregate (cost=19.70..731.69 rows=4784 width=288) |
| Group Key: co.id |
| -> Merge Left Join (cost=19.70..384.85 rows=4784 width=224) |
| Merge Cond: (co.id = cos_2.contact_id) |
| -> Merge Left Join (cost=11.98..364.39 rows=4784 width=160) |
| Merge Cond: (co.id = "*SELECT* 1_4".contact_id) |
| Filter: ((oc_3.contact_id IS NOT NULL) OR ("*SELECT* 1_4".contact_id IS NOT NULL)) |
| -> Merge Left Join (cost=3.77..343.80 rows=4784 width=100) |
| Merge Cond: (co.id = oc_3.contact_id) |
| -> Index Scan using tbl_contacts_pkey on tbl_contacts co (cost=0.28..328.19 rows=4784 width=32) |
| -> Sort (cost=3.49..3.52 rows=10 width=68) |
| Sort Key: oc_3.contact_id |
| -> Subquery Scan on oc_3 (cost=3.07..3.32 rows=10 width=68) |
| -> HashAggregate (cost=3.07..3.22 rows=10 width=80) |
| Group Key: t_15.supplier_id, t_15.client_id, t_15.user_id, t_15.contact_id |
| -> Seq Scan on tbl_erp_other_collect_tickets t_15 (cost=0.00..2.55 rows=35 width=25) |
| Filter: ((bank_settle_at IS NOT NULL) AND (status = 2)) |
| -> Sort (cost=8.20..8.27 rows=29 width=68) |
| Sort Key: "*SELECT* 1_4".contact_id |
| -> Append (cost=4.18..7.50 rows=29 width=68) |
| -> Subquery Scan on "*SELECT* 1_4" (cost=4.18..4.83 rows=26 width=68) |
| -> HashAggregate (cost=4.18..4.57 rows=26 width=80) |
| Group Key: t_16.supplier_id, t_16.client_id, t_16.user_id, t_16.contact_id |
| -> Seq Scan on tbl_erp_other_payment_tickets t_16 (cost=0.00..3.55 rows=42 width=26) |
| Filter: (status = 2) |
| -> Subquery Scan on "*SELECT* 2_4" (cost=2.60..2.67 rows=3 width=68) |
| -> HashAggregate (cost=2.60..2.64 rows=3 width=80) |
| Group Key: t_17.supplier_id, t_17.client_id, t_17.user_id, t_17.contact_id |
| -> Seq Scan on tbl_erp_other_collect_tickets t_17 (cost=0.00..2.55 rows=4 width=21) |
| Filter: ((bank_settle_at IS NULL) AND (status = 2)) |
| -> Sort (cost=7.72..7.85 rows=52 width=68) |
| Sort Key: cos_2.contact_id |
| -> Subquery Scan on cos_2 (cost=4.94..6.24 rows=52 width=68) |
| -> HashAggregate (cost=4.94..5.72 rows=52 width=76) |
| Group Key: t_18.supplier_id, t_18.client_id, t_18.contact_id |
| -> Seq Scan on tbl_erp_cost_tickets t_18 (cost=0.00..4.03 rows=73 width=21) |
| Filter: (status = 2) |