Aggregate (cost=27255.95..27255.96 rows=1 width=8) |
-> Sort (cost=27151.23..27168.68 rows=6981 width=1074) |
Sort Key: (CASE WHEN (tmp1.budgets IS NULL) THEN '0'::numeric ELSE tmp1.budgets END) DESC, c.created_at DESC |
-> Group (cost=21352.63..23412.02 rows=6981 width=1074) |
Group Key: c.id, (CASE WHEN (tmp1.budgets IS NULL) THEN '0'::numeric ELSE tmp1.budgets END), (CASE WHEN (tmp1.profits IS NULL) THEN '0'::numeric ELSE tmp1.profits END), (CASE WHEN (tmp1.count IS NULL) THEN '0'::bigint ELSE tmp1.count END), (CASE WHEN ((tmp1.budgets IS NULL) OR (tmp1.budgets = '0'::numeric)) THEN '0'::numeric ELSE (tmp1.profits / tmp1.budgets) END), (CASE WHEN (tmp2.budgets IS NULL) THEN '0'::numeric ELSE tmp2.budgets END), (CASE WHEN (tmp2.count IS NULL) THEN '0'::bigint ELSE tmp2.count END), (CASE WHEN (tmp3.budgets IS NULL) THEN '0'::numeric ELSE tmp3.budgets END), (CASE WHEN (tmp3.count IS NULL) THEN '0'::bigint ELSE tmp3.count END), (CASE WHEN (tmp4.pre_sales_counts IS NULL) THEN '0'::bigint ELSE tmp4.pre_sales_counts END), (CASE WHEN (tmp5.implement_counts IS NULL) THEN '0'::bigint ELSE tmp5.implement_counts END), (CASE WHEN (tmp4.pre_sales_times IS NOT NULL) THEN (date_part('epoch'::text, tmp4.pre_sales_times) / '3600'::double precision) ELSE '0'::double precision END), (CASE WHEN (tmp5.implement_times IS NOT NULL) THEN (date_part('epoch'::text, tmp5.implement_times) / '3600'::double precision) ELSE '0'::double precision END), (CASE WHEN (tmp7.work_times IS NOT NULL) THEN tmp7.work_times ELSE '00:00:00'::interval END), (CASE WHEN (tmp7.work_count IS NOT NULL) THEN tmp7.work_count ELSE '0'::bigint END), tmp1.last_bargain_date, (CASE WHEN (tmp8.reimbursement_amount IS NOT NULL) THEN tmp8.reimbursement_amount ELSE '0'::numeric END), (CASE WHEN (tmp9.points IS NOT NULL) THEN tmp9.points ELSE '0'::numeric END), tmp1.count, ci.id, ct.id, (CASE WHEN (c.client_class IS NOT NULL) THEN (((((CASE WHEN (cc.contact_base > 0) THEN floor((CASE WHEN (c.contact_count > cc.contact_base) THEN '15'::bigint ELSE ((c.contact_count * 15) / cc.contact_base) END)::double precision) ELSE '15'::double precision END + floor((((c.client_base_info_count * 15) / 9))::double precision)) + CASE WHEN (cc.visit_base > 0) THEN floor(CASE WHEN ((c.visit_count)::double precision > ceil((CASE WHEN (date_part('year'::text, now()) = date_part('year'::text, ((c.created_at)::date)::timestamp without time zone)) THEN ((((now())::date - (c.created_at)::date) + 1))::double precision ELSE '221'::double precision END / (cc.visit_base)::double precision))) THEN '20'::double precision ELSE (((c.visit_count * 20))::double precision / ceil((CASE WHEN (date_part('year'::text, now()) = date_part('year'::text, ((c.created_at)::date)::timestamp without time zone)) THEN ((((now())::date - (c.created_at)::date) + 1))::double precision ELSE '221'::double precision END / (cc.visit_base)::double precision))) END) ELSE '20'::double precision END) + CASE WHEN (cc.cooperate_base > 0) THEN floor((CASE WHEN (c.cooperate_count > cc.cooperate_base) THEN '20'::bigint ELSE ((c.cooperate_count * 20) / cc.cooperate_base) END)::double precision) ELSE '20'::double precision END) + CASE WHEN (cc.case_pre_sales_base > 0) THEN floor((CASE WHEN (c.case_pre_sales_count > cc.case_pre_sales_base) THEN '15'::bigint ELSE ((c.case_pre_sales_count * 15) / cc.case_pre_sales_base) END)::double precision) ELSE '15'::double precision END) + CASE WHEN (cc.case_implement_base > 0) THEN floor((CASE WHEN (c.case_implement_count > cc.case_implement_base) THEN '15'::bigint ELSE ((c.case_implement_count * 15) / cc.case_implement_base) END)::double precision) ELSE '15'::double precision END) ELSE NULL::double precision END), (CASE WHEN (tmp1.collected IS NULL) THEN '0'::numeric ELSE tmp1.collected END), (CASE WHEN (tmp1.un_collected IS NULL) THEN '0'::numeric ELSE tmp1.un_collected END), (CASE WHEN (tmp10.invoices IS NULL) THEN '0'::numeric ELSE tmp10.invoices END), (CASE WHEN (tmp10.un_invoices IS NULL) THEN '0'::numeric ELSE tmp10.un_invoices END), (CASE WHEN (tmp11.count IS NULL) THEN '0'::bigint ELSE tmp11.count END), (CASE WHEN (tmp12.budgets IS NULL) THEN '0'::numeric ELSE tmp12.budgets END), (CASE WHEN (tmp1.used_clients IS NULL) THEN '0'::bigint ELSE tmp1.used_clients END), (CASE WHEN (tmp13.budgets IS NULL) THEN '0'::numeric ELSE tmp13.budgets END), (CASE WHEN (tmp13.profits IS NULL) THEN '0'::numeric ELSE tmp13.profits END), (CASE WHEN (tmp14.work_times IS NOT NULL) THEN tmp14.work_times ELSE '00:00:00'::interval END), (CASE WHEN (tmp14.work_count IS NOT NULL) THEN tmp14.work_count ELSE '0'::bigint END), (CASE WHEN (tmp15.work_times IS NOT NULL) THEN tmp15.work_times ELSE '00:00:00'::interval END), (CASE WHEN (tmp15.work_count IS NOT NULL) THEN tmp15.work_count ELSE '0'::bigint END), (CASE WHEN (tmp16.work_times IS NOT NULL) THEN tmp16.work_times ELSE '00:00:00'::interval END), (CASE WHEN (tmp16.work_count IS NOT NULL) THEN tmp16.work_count ELSE '0'::bigint END), (CASE WHEN (tmp17.work_times IS NOT NULL) THEN tmp17.work_times ELSE '00:00:00'::interval END), (CASE WHEN (tmp17.work_count IS NOT NULL) THEN tmp17.work_count ELSE '0'::bigint END), (CASE WHEN (tmp18.work_times IS NOT NULL) THEN tmp18.work_times ELSE '00:00:00'::interval END), (CASE WHEN (tmp18.work_count IS NOT NULL) THEN tmp18.work_count ELSE '0'::bigint END) |
-> Sort (cost=21352.63..21370.08 rows=6981 width=1041) |
Sort Key: c.id, (CASE WHEN (tmp1.budgets IS NULL) THEN '0'::numeric ELSE tmp1.budgets END) DESC, (CASE WHEN (tmp1.profits IS NULL) THEN '0'::numeric ELSE tmp1.profits END), (CASE WHEN (tmp1.count IS NULL) THEN '0'::bigint ELSE tmp1.count END), (CASE WHEN ((tmp1.budgets IS NULL) OR (tmp1.budgets = '0'::numeric)) THEN '0'::numeric ELSE (tmp1.profits / tmp1.budgets) END), (CASE WHEN (tmp2.budgets IS NULL) THEN '0'::numeric ELSE tmp2.budgets END), (CASE WHEN (tmp2.count IS NULL) THEN '0'::bigint ELSE tmp2.count END), (CASE WHEN (tmp3.budgets IS NULL) THEN '0'::numeric ELSE tmp3.budgets END), (CASE WHEN (tmp3.count IS NULL) THEN '0'::bigint ELSE tmp3.count END), (CASE WHEN (tmp4.pre_sales_counts IS NULL) THEN '0'::bigint ELSE tmp4.pre_sales_counts END), (CASE WHEN (tmp5.implement_counts IS NULL) THEN '0'::bigint ELSE tmp5.implement_counts END), (CASE WHEN (tmp4.pre_sales_times IS NOT NULL) THEN (date_part('epoch'::text, tmp4.pre_sales_times) / '3600'::double precision) ELSE '0'::double precision END), (CASE WHEN (tmp5.implement_times IS NOT NULL) THEN (date_part('epoch'::text, tmp5.implement_times) / '3600'::double precision) ELSE '0'::double precision END), (CASE WHEN (tmp7.work_times IS NOT NULL) THEN tmp7.work_times ELSE '00:00:00'::interval END), (CASE WHEN (tmp7.work_count IS NOT NULL) THEN tmp7.work_count ELSE '0'::bigint END), tmp1.last_bargain_date, (CASE WHEN (tmp8.reimbursement_amount IS NOT NULL) THEN tmp8.reimbursement_amount ELSE '0'::numeric END), (CASE WHEN (tmp9.points IS NOT NULL) THEN tmp9.points ELSE '0'::numeric END), tmp1.count, ci.id, ct.id, (CASE WHEN (c.client_class IS NOT NULL) THEN (((((CASE WHEN (cc.contact_base > 0) THEN floor((CASE WHEN (c.contact_count > cc.contact_base) THEN '15'::bigint ELSE ((c.contact_count * 15) / cc.contact_base) END)::double precision) ELSE '15'::double precision END + floor((((c.client_base_info_count * 15) / 9))::double precision)) + CASE WHEN (cc.visit_base > 0) THEN floor(CASE WHEN ((c.visit_count)::double precision > ceil((CASE WHEN (date_part('year'::text, now()) = date_part('year'::text, ((c.created_at)::date)::timestamp without time zone)) THEN ((((now())::date - (c.created_at)::date) + 1))::double precision ELSE '221'::double precision END / (cc.visit_base)::double precision))) THEN '20'::double precision ELSE (((c.visit_count * 20))::double precision / ceil((CASE WHEN (date_part('year'::text, now()) = date_part('year'::text, ((c.created_at)::date)::timestamp without time zone)) THEN ((((now())::date - (c.created_at)::date) + 1))::double precision ELSE '221'::double precision END / (cc.visit_base)::double precision))) END) ELSE '20'::double precision END) + CASE WHEN (cc.cooperate_base > 0) THEN floor((CASE WHEN (c.cooperate_count > cc.cooperate_base) THEN '20'::bigint ELSE ((c.cooperate_count * 20) / cc.cooperate_base) END)::double precision) ELSE '20'::double precision END) + CASE WHEN (cc.case_pre_sales_base > 0) THEN floor((CASE WHEN (c.case_pre_sales_count > cc.case_pre_sales_base) THEN '15'::bigint ELSE ((c.case_pre_sales_count * 15) / cc.case_pre_sales_base) END)::double precision) ELSE '15'::double precision END) + CASE WHEN (cc.case_implement_base > 0) THEN floor((CASE WHEN (c.case_implement_count > cc.case_implement_base) THEN '15'::bigint ELSE ((c.case_implement_count * 15) / cc.case_implement_base) END)::double precision) ELSE '15'::double precision END) ELSE NULL::double precision END), (CASE WHEN (tmp1.collected IS NULL) THEN '0'::numeric ELSE tmp1.collected END), (CASE WHEN (tmp1.un_collected IS NULL) THEN '0'::numeric ELSE tmp1.un_collected END), (CASE WHEN (tmp10.invoices IS NULL) THEN '0'::numeric ELSE tmp10.invoices END), (CASE WHEN (tmp10.un_invoices IS NULL) THEN '0'::numeric ELSE tmp10.un_invoices END), (CASE WHEN (tmp11.count IS NULL) THEN '0'::bigint ELSE tmp11.count END), (CASE WHEN (tmp12.budgets IS NULL) THEN '0'::numeric ELSE tmp12.budgets END), (CASE WHEN (tmp1.used_clients IS NULL) THEN '0'::bigint ELSE tmp1.used_clients END), (CASE WHEN (tmp13.budgets IS NULL) THEN '0'::numeric ELSE tmp13.budgets END), (CASE WHEN (tmp13.profits IS NULL) THEN '0'::numeric ELSE tmp13.profits END), (CASE WHEN (tmp14.work_times IS NOT NULL) THEN tmp14.work_times ELSE '00:00:00'::interval END), (CASE WHEN (tmp14.work_count IS NOT NULL) THEN tmp14.work_count ELSE '0'::bigint END), (CASE WHEN (tmp15.work_times IS NOT NULL) THEN tmp15.work_times ELSE '00:00:00'::interval END), (CASE WHEN (tmp15.work_count IS NOT NULL) THEN tmp15.work_count ELSE '0'::bigint END), (CASE WHEN (tmp16.work_times IS NOT NULL) THEN tmp16.work_times ELSE '00:00:00'::interval END), (CASE WHEN (tmp16.work_count IS NOT NULL) THEN tmp16.work_count ELSE '0'::bigint END), (CASE WHEN (tmp17.work_times IS NOT NULL) THEN tmp17.work_times ELSE '00:00:00'::interval END), (CASE WHEN (tmp17.work_count IS NOT NULL) THEN tmp17.work_count ELSE '0'::bigint END), (CASE WHEN (tmp18.work_times IS NOT NULL) THEN tmp18.work_times ELSE '00:00:00'::interval END), (CASE WHEN (tmp18.work_count IS NOT NULL) THEN tmp18.work_count ELSE '0'::bigint END) |
-> Hash Left Join (cost=16002.11..17707.92 rows=6981 width=1041) |
Hash Cond: (ca.engineer_id = egr.engineer_id) |
-> Hash Right Join (cost=16000.50..16283.93 rows=6981 width=1105) |
Hash Cond: (cas.client_id = c.id) |
-> Hash Right Join (cost=346.33..530.04 rows=7976 width=8) |
Hash Cond: (ca.case_id = cas.id) |
-> Seq Scan on tbl_case_assignments ca (cost=0.00..162.76 rows=7976 width=8) |
-> Hash (cost=247.26..247.26 rows=7926 width=8) |
-> Seq Scan on tbl_cases cas (cost=0.00..247.26 rows=7926 width=8) |
-> Hash (cost=15632.33..15632.33 rows=1747 width=1101) |
-> Hash Left Join (cost=15207.52..15632.33 rows=1747 width=1101) |
Hash Cond: (c.client_type = ct.id) |
-> Hash Left Join (cost=15206.39..15623.47 rows=1747 width=955) |
Hash Cond: (c.client_industry = ci.id) |
-> Hash Left Join (cost=15204.85..15616.57 rows=1747 width=809) |
Hash Cond: (c.client_class = cc.id) |
-> Hash Left Join (cost=15203.76..15608.01 rows=1747 width=769) |
Hash Cond: (c.id = tmp18.client_id) |
-> Hash Left Join (cost=13466.22..13865.88 rows=1747 width=745) |
Hash Cond: (c.id = tmp17.client_id) |
-> Hash Left Join (cost=11728.69..12123.75 rows=1747 width=721) |
Hash Cond: (c.id = tmp16.client_id) |
-> Hash Left Join (cost=9989.13..10379.59 rows=1747 width=697) |
Hash Cond: (c.id = tmp15.client_id) |
-> Hash Left Join (cost=8211.22..8597.09 rows=1747 width=673) |
Hash Cond: (c.id = tmp14.client_id) |
-> Hash Left Join (cost=6104.34..6485.61 rows=1747 width=649) |
Hash Cond: (c.id = tmp13.client_id) |
-> Hash Left Join (cost=5784.02..6160.69 rows=1747 width=585) |
Hash Cond: (c.id = tmp12.client_id) |
-> Hash Left Join (cost=5440.81..5812.89 rows=1747 width=553) |
Hash Cond: (c.id = tmp11.client_id) |
-> Hash Left Join (cost=5095.56..5463.04 rows=1747 width=545) |
Hash Cond: (c.id = tmp10.client_id) |
-> Hash Left Join (cost=4733.65..5096.53 rows=1747 width=481) |
Hash Cond: (c.id = tmp9.client_id) |
-> Hash Left Join (cost=3827.48..4185.77 rows=1747 width=449) |
Hash Cond: (c.id = tmp8.client_id) |
-> Hash Left Join (cost=3554.98..3908.67 rows=1747 width=417) |
Hash Cond: (c.id = tmp7.client_id) |
-> Hash Left Join (cost=1881.36..2230.45 rows=1747 width=393) |
Hash Cond: ((c.id = csrr.client_id) AND (c.sales_rep = csrr.sales_rep)) |
-> Hash Left Join (cost=1720.69..2034.37 rows=1747 width=393) |
Hash Cond: (c.id = tmp5.client_id) |
-> Hash Left Join (cost=1245.80..1554.88 rows=1747 width=369) |
Hash Cond: (c.id = tmp4.client_id) |
-> Hash Left Join (cost=1110.94..1415.43 rows=1747 width=345) |
Hash Cond: (c.id = tmp3.client_id) |
-> Hash Left Join (cost=799.55..1099.44 rows=1747 width=305) |
Hash Cond: (c.id = tmp2.client_id) |
-> Hash Left Join (cost=488.90..784.19 rows=1747 width=265) |
Hash Cond: (c.id = tmp1.client_id) |
-> Hash Left Join (cost=11.86..302.55 rows=1747 width=117) |
Hash Cond: (c.sales_rep = sgr.sales_id) |
-> Seq Scan on tbl_clients c (cost=9.75..284.88 rows=1747 width=117) |
Filter: ((NOT deleted) AND ((sales_rep = ANY ('{1001,5049,5301,5022,5209,5026,5293,5309,5356,5329,5299,5303,5302,5332,5047,1026,5096,5070,5448,5420,1029,5037,5087,1008,5048,5043,5045,5230,5031,5088,5208,1003,5294,5357,5044,1030,5076,5300,5027,5089,5311,5066,5069,5364,1009,5295,1013,5128,5203,1025,5032,5075,1004,5072,5033,5359,5412,5409,5229,1005,5304,5449,5358,1006,5093}'::integer[])) OR (sales_rep IS NULL) OR (hashed SubPlan 1))) |
SubPlan 1 |
-> Seq Scan on tbl_user_visit_clients (cost=0.00..9.75 rows=1 width=4) |
Filter: (user_id = 1001) |
-> Hash (cost=1.49..1.49 rows=49 width=4) |
-> Seq Scan on tbl_sales_group_relationships sgr (cost=0.00..1.49 rows=49 width=4) |
-> Hash (cost=466.97..466.97 rows=806 width=152) |
-> Subquery Scan on tmp1 (cost=392.15..466.97 rows=806 width=152) |
-> GroupAggregate (cost=392.15..458.91 rows=806 width=152) |
Group Key: p.client_id |
-> Sort (cost=392.15..396.05 rows=1558 width=30) |
Sort Key: p.client_id |
-> Seq Scan on tbl_projects p (cost=0.00..309.54 rows=1558 width=30) |
Filter: (project_status = 3) |
-> Hash (cost=310.44..310.44 rows=17 width=44) |
-> Subquery Scan on tmp2 (cost=309.88..310.44 rows=17 width=44) |
-> GroupAggregate (cost=309.88..310.27 rows=17 width=44) |
Group Key: p_1.client_id |
-> Sort (cost=309.88..309.93 rows=17 width=13) |
Sort Key: p_1.client_id |
-> Seq Scan on tbl_projects p_1 (cost=0.00..309.54 rows=17 width=13) |
Filter: (project_status = 1) |
-> Hash (cost=311.06..311.06 rows=27 width=44) |
-> Subquery Scan on tmp3 (cost=310.18..311.06 rows=27 width=44) |
-> GroupAggregate (cost=310.18..310.79 rows=27 width=44) |
Group Key: p_2.client_id |
-> Sort (cost=310.18..310.25 rows=27 width=13) |
Sort Key: p_2.client_id |
-> Seq Scan on tbl_projects p_2 (cost=0.00..309.54 rows=27 width=13) |
Filter: (project_status = 2) |
-> Hash (cost=130.96..130.96 rows=312 width=28) |
-> Subquery Scan on tmp4 (cost=124.72..130.96 rows=312 width=28) |
-> HashAggregate (cost=124.72..127.84 rows=312 width=28) |
Group Key: ps.client_id |
-> Hash Left Join (cost=1.61..108.99 rows=1573 width=24) |
Hash Cond: (ps.created_by = egr_1.engineer_id) |
-> Seq Scan on tbl_pre_sales ps (cost=0.00..85.75 rows=1573 width=28) |
Filter: (NOT is_draft) |
-> Hash (cost=1.27..1.27 rows=27 width=4) |
-> Seq Scan on tbl_engineer_group_relationships egr_1 (cost=0.00..1.27 rows=27 width=4) |
-> Hash (cost=471.85..471.85 rows=243 width=28) |
-> Subquery Scan on tmp5 (cost=466.99..471.85 rows=243 width=28) |
-> HashAggregate (cost=466.99..469.42 rows=243 width=28) |
Group Key: ir.client_id |
-> Hash Left Join (cost=1.61..402.00 rows=6499 width=24) |
Hash Cond: (ir.created_by = egr_2.engineer_id) |
-> Seq Scan on tbl_implement_records ir (cost=0.00..311.03 rows=6499 width=28) |
Filter: (NOT is_draft) |
-> Hash (cost=1.27..1.27 rows=27 width=4) |
-> Seq Scan on tbl_engineer_group_relationships egr_2 (cost=0.00..1.27 rows=27 width=4) |
-> Hash (cost=140.64..140.64 rows=1336 width=8) |
-> Hash Join (cost=73.04..140.64 rows=1336 width=8) |
Hash Cond: (csrr.id = "ANY_subquery".max) |
-> Seq Scan on tbl_client_sales_rep_rels csrr (cost=0.00..45.72 rows=2672 width=12) |
-> Hash (cost=70.54..70.54 rows=200 width=4) |
-> HashAggregate (cost=68.54..70.54 rows=200 width=4) |
Group Key: "ANY_subquery".max |
-> Subquery Scan on "ANY_subquery" (cost=50.45..66.53 rows=804 width=4) |
-> HashAggregate (cost=50.45..58.49 rows=804 width=8) |
Group Key: csrrs.client_id |
-> Seq Scan on tbl_client_sales_rep_rels csrrs (cost=0.00..45.72 rows=946 width=8) |
Filter: (end_at IS NULL) |
-> Hash (cost=1667.47..1667.47 rows=492 width=28) |
-> Subquery Scan on tmp7 (cost=1657.63..1667.47 rows=492 width=28) |
-> HashAggregate (cost=1657.63..1662.55 rows=492 width=28) |
Group Key: wl.client_id |
-> Seq Scan on tbl_work_logs wl (cost=0.00..1651.38 rows=625 width=24) |
Filter: ((NOT is_draft) AND (location_in_id IS NOT NULL) AND (location_out_id IS NOT NULL) AND (client_id IS NOT NULL)) |
-> Hash (cost=267.19..267.19 rows=425 width=36) |
-> Subquery Scan on tmp8 (cost=257.62..267.19 rows=425 width=36) |
-> HashAggregate (cost=257.62..262.94 rows=425 width=36) |
Group Key: r.client_id |
-> Seq Scan on tbl_reimbursements r (cost=0.00..221.11 rows=7302 width=9) |
Filter: (status = ANY ('{2,3}'::integer[])) |
-> Hash (cost=903.67..903.67 rows=200 width=36) |
-> Subquery Scan on tmp9 (cost=899.17..903.67 rows=200 width=36) |
-> HashAggregate (cost=899.17..901.67 rows=200 width=36) |
Group Key: c_1.client_id |
-> HashAggregate (cost=681.20..780.28 rows=7926 width=40) |
Group Key: c_1.id |
-> Hash Left Join (cost=347.94..641.32 rows=7976 width=16) |
Hash Cond: (ca_1.engineer_id = egr_3.engineer_id) |
-> Hash Right Join (cost=346.33..530.04 rows=7976 width=20) |
Hash Cond: (ca_1.case_id = c_1.id) |
-> Seq Scan on tbl_case_assignments ca_1 (cost=0.00..162.76 rows=7976 width=16) |
-> Hash (cost=247.26..247.26 rows=7926 width=8) |
-> Seq Scan on tbl_cases c_1 (cost=0.00..247.26 rows=7926 width=8) |
-> Hash (cost=1.27..1.27 rows=27 width=4) |
-> Seq Scan on tbl_engineer_group_relationships egr_3 (cost=0.00..1.27 rows=27 width=4) |
-> Hash (cost=359.42..359.42 rows=200 width=68) |
-> Subquery Scan on tmp10 (cost=354.42..359.42 rows=200 width=68) |
-> HashAggregate (cost=354.42..357.42 rows=200 width=68) |
Group Key: sc.client_id |
-> HashAggregate (cost=298.98..318.78 rows=1584 width=47) |
Group Key: sc.id |
-> Hash Right Join (cost=246.64..289.81 rows=1834 width=21) |
Hash Cond: (sci.contract_id = sc.id) |
-> Seq Scan on tbl_sales_contract_invoices sci (cost=0.00..38.34 rows=1834 width=10) |
-> Hash (cost=226.84..226.84 rows=1584 width=15) |
-> Seq Scan on tbl_sales_contracts sc (cost=0.00..226.84 rows=1584 width=15) |
-> Hash (cost=334.33..334.33 rows=874 width=12) |
-> Subquery Scan on tmp11 (cost=316.85..334.33 rows=874 width=12) |
-> HashAggregate (cost=316.85..325.59 rows=874 width=44) |
Group Key: p_3.client_id |
-> Seq Scan on tbl_projects p_3 (cost=0.00..302.23 rows=2923 width=8) |
-> Hash (cost=333.62..333.62 rows=767 width=36) |
-> Subquery Scan on tmp12 (cost=316.36..333.62 rows=767 width=36) |
-> HashAggregate (cost=316.36..325.95 rows=767 width=44) |
Group Key: p_4.client_id |
-> Seq Scan on tbl_projects p_4 (cost=0.00..309.54 rows=1365 width=9) |
Filter: (project_status <> 3) |
-> Hash (cost=319.78..319.78 rows=43 width=68) |
-> Subquery Scan on tmp13 (cost=318.05..319.78 rows=43 width=68) |
-> GroupAggregate (cost=318.05..319.35 rows=43 width=68) |
Group Key: p_5.client_id |
-> Sort (cost=318.05..318.16 rows=44 width=14) |
Sort Key: p_5.client_id |
-> Seq Scan on tbl_projects p_5 (cost=0.00..316.85 rows=44 width=14) |
Filter: ((project_status = 1) OR (project_status = 2)) |
-> Hash (cost=2091.74..2091.74 rows=1211 width=28) |
-> Subquery Scan on tmp14 (cost=2067.52..2091.74 rows=1211 width=28) |
-> HashAggregate (cost=2067.52..2079.63 rows=1211 width=28) |
Group Key: wl_1.client_id |
-> Seq Scan on tbl_work_logs wl_1 (cost=0.00..1737.47 rows=33005 width=24) |
Filter: ((NOT is_draft) AND (scenario_id = 1)) |
-> Hash (cost=1767.59..1767.59 rows=826 width=28) |
-> Subquery Scan on tmp15 (cost=1751.07..1767.59 rows=826 width=28) |
-> HashAggregate (cost=1751.07..1759.33 rows=826 width=28) |
Group Key: wl_2.client_id |
-> Seq Scan on tbl_work_logs wl_2 (cost=0.00..1737.47 rows=1359 width=24) |
Filter: ((NOT is_draft) AND (scenario_id = 2)) |
-> Hash (cost=1739.19..1739.19 rows=30 width=28) |
-> Subquery Scan on tmp16 (cost=1738.21..1739.19 rows=30 width=28) |
-> GroupAggregate (cost=1738.21..1738.89 rows=30 width=28) |
Group Key: wl_3.client_id |
-> Sort (cost=1738.21..1738.29 rows=30 width=24) |
Sort Key: wl_3.client_id |
-> Seq Scan on tbl_work_logs wl_3 (cost=0.00..1737.47 rows=30 width=24) |
Filter: ((NOT is_draft) AND (scenario_id = 3)) |
-> Hash (cost=1737.52..1737.52 rows=1 width=28) |
-> Subquery Scan on tmp17 (cost=1737.48..1737.52 rows=1 width=28) |
-> GroupAggregate (cost=1737.48..1737.51 rows=1 width=28) |
Group Key: wl_4.client_id |
-> Sort (cost=1737.48..1737.49 rows=1 width=24) |
Sort Key: wl_4.client_id |
-> Seq Scan on tbl_work_logs wl_4 (cost=0.00..1737.47 rows=1 width=24) |
Filter: ((NOT is_draft) AND (scenario_id = 4)) |
-> Hash (cost=1737.52..1737.52 rows=1 width=28) |
-> Subquery Scan on tmp18 (cost=1737.48..1737.52 rows=1 width=28) |
-> GroupAggregate (cost=1737.48..1737.51 rows=1 width=28) |
Group Key: wl_5.client_id |
-> Sort (cost=1737.48..1737.49 rows=1 width=24) |
Sort Key: wl_5.client_id |
-> Seq Scan on tbl_work_logs wl_5 (cost=0.00..1737.47 rows=1 width=24) |
Filter: ((NOT is_draft) AND (scenario_id = 5)) |
-> Hash (cost=1.04..1.04 rows=4 width=44) |
-> Seq Scan on tbl_client_classes cc (cost=0.00..1.04 rows=4 width=44) |
-> Hash (cost=1.24..1.24 rows=24 width=150) |
-> Seq Scan on tbl_client_industries ci (cost=0.00..1.24 rows=24 width=150) |
-> Hash (cost=1.06..1.06 rows=6 width=150) |
-> Seq Scan on tbl_client_types ct (cost=0.00..1.06 rows=6 width=150) |
-> Hash (cost=1.27..1.27 rows=27 width=4) |
-> Seq Scan on tbl_engineer_group_relationships egr (cost=0.00..1.27 rows=27 width=4) |