| Aggregate (cost=664.77..664.78 rows=1 width=8) |
| -> Sort (cost=664.71..664.72 rows=4 width=452) |
| Sort Key: sub.updated_at DESC |
| -> Subquery Scan on sub (cost=267.52..664.67 rows=4 width=452) |
| -> Append (cost=267.52..664.63 rows=4 width=452) |
| -> Subquery Scan on "*SELECT* 1" (cost=267.52..272.93 rows=1 width=443) |
| -> GroupAggregate (cost=267.52..272.91 rows=1 width=387) |
| Group Key: s.id |
| -> Nested Loop Left Join (cost=267.52..272.81 rows=1 width=343) |
| Join Filter: (t_4.client_id = s.id) |
| -> Nested Loop Left Join (cost=144.51..147.84 rows=1 width=303) |
| Join Filter: (t_3.client_id = s.id) |
| -> Nested Loop Left Join (cost=139.57..140.95 rows=1 width=239) |
| Join Filter: (t_2.client_id = s.id) |
| -> Nested Loop Left Join (cost=135.39..135.79 rows=1 width=175) |
| Join Filter: (t_1.client_id = s.id) |
| -> Merge Left Join (cost=132.26..132.28 rows=1 width=111) |
| Merge Cond: (s.id = ap.client_id) |
| -> Sort (cost=120.20..120.21 rows=1 width=79) |
| Sort Key: s.id |
| -> Seq Scan on tbl_clients s (cost=0.00..120.19 rows=1 width=79) |
| Filter: ((NOT deleted) AND (((name)::text ~~* '%bjhl%'::text) OR (pinyin_shortcut ~~* '%bjhl%'::text))) |
| -> Sort (cost=12.05..12.06 rows=1 width=36) |
| Sort Key: ap.client_id |
| -> 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)) |
| -> HashAggregate (cost=3.13..3.28 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=39 width=25) |
| Filter: (status = 2) |
| -> 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) |
| -> HashAggregate (cost=4.94..5.72 rows=52 width=76) |
| Group Key: t_3.supplier_id, t_3.client_id, t_3.contact_id |
| -> Seq Scan on tbl_erp_cost_tickets t_3 (cost=0.00..4.03 rows=73 width=21) |
| Filter: (status = 2) |
| -> HashAggregate (cost=123.01..123.71 rows=56 width=44) |
| Group Key: t_4.client_id |
| -> Seq Scan on tbl_sales_contracts t_4 (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=181.00..186.57 rows=1 width=440) |
| -> GroupAggregate (cost=181.00..186.56 rows=1 width=384) |
| Group Key: s_1.id |
| -> Nested Loop Left Join (cost=181.00..186.46 rows=1 width=336) |
| Join Filter: (t_9.supplier_id = s_1.id) |
| -> Nested Loop Left Join (cost=57.13..60.49 rows=1 width=296) |
| Join Filter: (t_8.supplier_id = s_1.id) |
| -> Nested Loop Left Join (cost=52.19..53.60 rows=1 width=232) |
| Join Filter: (t_7.supplier_id = s_1.id) |
| -> Nested Loop Left Join (cost=48.01..48.44 rows=1 width=168) |
| Join Filter: (t_6.supplier_id = s_1.id) |
| -> Merge Left Join (cost=44.88..44.93 rows=1 width=104) |
| Merge Cond: (s_1.id = t_5.supplier_id) |
| -> Sort (cost=32.87..32.87 rows=1 width=72) |
| Sort Key: s_1.id |
| -> Seq Scan on tbl_suppliers s_1 (cost=0.00..32.86 rows=1 width=72) |
| Filter: (((name)::text ~~* '%bjhl%'::text) OR (pinyin_shortcut ~~* '%bjhl%'::text)) |
| -> Materialize (cost=12.01..12.05 rows=1 width=36) |
| -> GroupAggregate (cost=12.01..12.04 rows=1 width=40) |
| Group Key: t_5.supplier_id, t_5.client_id |
| -> Sort (cost=12.01..12.02 rows=1 width=40) |
| Sort Key: t_5.supplier_id, t_5.client_id |
| -> Seq Scan on tbl_erp_advance_payment_tickets t_5 (cost=0.00..12.00 rows=1 width=40) |
| Filter: (is_payment_settle AND (status = 2)) |
| -> HashAggregate (cost=3.13..3.28 rows=10 width=80) |
| Group Key: t_6.supplier_id, t_6.client_id, t_6.user_id, t_6.contact_id |
| -> Seq Scan on tbl_erp_other_collect_tickets t_6 (cost=0.00..2.55 rows=39 width=25) |
| Filter: (status = 2) |
| -> HashAggregate (cost=4.18..4.57 rows=26 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_payment_tickets t_7 (cost=0.00..3.55 rows=42 width=26) |
| Filter: (status = 2) |
| -> HashAggregate (cost=4.94..5.72 rows=52 width=76) |
| Group Key: t_8.supplier_id, t_8.client_id, t_8.contact_id |
| -> Seq Scan on tbl_erp_cost_tickets t_8 (cost=0.00..4.03 rows=73 width=21) |
| Filter: (status = 2) |
| -> HashAggregate (cost=123.87..124.62 rows=60 width=44) |
| Group Key: t_9.supplier_id |
| -> Seq Scan on tbl_purchase_contracts t_9 (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=25.53..25.60 rows=1 width=400) |
| -> GroupAggregate (cost=25.53..25.58 rows=1 width=288) |
| Group Key: u.id |
| -> Sort (cost=25.53..25.53 rows=1 width=160) |
| Sort Key: u.id |
| -> Hash Right Join (cost=25.22..25.52 rows=1 width=160) |
| Hash Cond: (t_10.user_id = u.id) |
| Filter: ((t_10.user_id IS NOT NULL) OR (t_11.user_id IS NOT NULL)) |
| -> HashAggregate (cost=3.13..3.28 rows=10 width=80) |
| Group Key: t_10.supplier_id, t_10.client_id, t_10.user_id, t_10.contact_id |
| -> Seq Scan on tbl_erp_other_collect_tickets t_10 (cost=0.00..2.55 rows=39 width=25) |
| Filter: (status = 2) |
| -> Hash (cost=22.07..22.07 rows=1 width=100) |
| -> Hash Right Join (cost=21.35..22.07 rows=1 width=100) |
| Hash Cond: (t_11.user_id = u.id) |
| -> HashAggregate (cost=4.18..4.57 rows=26 width=80) |
| Group Key: t_11.supplier_id, t_11.client_id, t_11.user_id, t_11.contact_id |
| -> Seq Scan on tbl_erp_other_payment_tickets t_11 (cost=0.00..3.55 rows=42 width=26) |
| Filter: (status = 2) |
| -> Hash (cost=17.16..17.16 rows=1 width=32) |
| -> Seq Scan on tbl_users u (cost=0.00..17.16 rows=1 width=32) |
| Filter: (((name)::text ~~* '%bjhl%'::text) OR (pinyin_shortcut ~~* '%bjhl%'::text)) |
| -> Subquery Scan on "*SELECT* 4" (cost=176.44..179.52 rows=1 width=400) |
| -> GroupAggregate (cost=176.44..179.50 rows=1 width=288) |
| Group Key: co.id |
| -> Nested Loop Left Join (cost=176.44..179.43 rows=1 width=224) |
| Join Filter: (t_14.contact_id = co.id) |
| -> Nested Loop Left Join (cost=171.50..172.54 rows=1 width=160) |
| Join Filter: (t_13.contact_id = co.id) |
| Filter: ((oc.contact_id IS NOT NULL) OR (t_13.contact_id IS NOT NULL)) |
| -> Merge Left Join (cost=167.32..167.39 rows=1 width=100) |
| Merge Cond: (co.id = oc.contact_id) |
| -> Sort (cost=163.77..163.77 rows=1 width=32) |
| Sort Key: co.id |
| -> Seq Scan on tbl_contacts co (cost=0.00..163.76 rows=1 width=32) |
| Filter: (((name)::text ~~* '%bjhl%'::text) OR (pinyin_shortcut ~~* '%bjhl%'::text)) |
| -> Sort (cost=3.55..3.58 rows=10 width=68) |
| Sort Key: oc.contact_id |
| -> Subquery Scan on oc (cost=3.13..3.38 rows=10 width=68) |
| -> HashAggregate (cost=3.13..3.28 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=39 width=25) |
| Filter: (status = 2) |
| -> 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) |
| -> HashAggregate (cost=4.94..5.72 rows=52 width=76) |
| Group Key: t_14.supplier_id, t_14.client_id, t_14.contact_id |
| -> Seq Scan on tbl_erp_cost_tickets t_14 (cost=0.00..4.03 rows=73 width=21) |
| Filter: (status = 2) |