Загрузка данных
Insert on report.dia_rops (cost=13889855.11..13889859.86 rows=0 width=0)
-> Subquery Scan on "*SELECT*" (cost=13889855.11..13889859.86 rows=1 width=765)
Output: "*SELECT*".nextval, "*SELECT*".insurance_number, "*SELECT*".ops, "*SELECT*".ops_id, "*SELECT*".dps_l, "*SELECT*".dps_l_id, "*SELECT*".dps_g, "*SELECT*".dps_g_id, "*SELECT*".dps_mk, "*SELECT*".dps_mk_id, "*SELECT*".balance, "*SELECT*".currval, NULL::character varying(200), "*SELECT*".death_date, "*SELECT*".number, "*SELECT*".id
-> Nested Loop (cost=13889855.11..13889859.82 rows=1 width=343)
Output: nextval('report.dia_rops_id_sequence'::regclass), currval('report.dia_register_id_sequence'::regclass), i.insurance_number, s.number, a_2.death_date, (sum("*SELECT* 1".ops)), (sum("*SELECT* 1".ops_id)), (sum("*SELECT* 1".dps_l)), (sum("*SELECT* 1".dps_l_id)), (sum("*SELECT* 1".dps_g)), (sum("*SELECT* 1".dps_g_id)), (sum("*SELECT* 1".dps_mk)), (sum("*SELECT* 1".dps_mk_id)), (sum("*SELECT* 1".balance)), s.id
InitPlan 1
-> Result (cost=0.00..0.01 rows=1 width=1)
Output: (NULLIF(current_setting('app.user_id'::text, true), ''::text) IS NULL)
InitPlan 3
-> Result (cost=1.76..1.77 rows=1 width=1)
Output: (InitPlan 2).col1
InitPlan 2
-> Index Only Scan using user_group_pkey on ourpension.user_group ug (cost=0.16..1.76 rows=1 width=0)
Index Cond: (ug.user_id = (NULLIF(current_setting('app.user_id'::text, true), ''::text))::bigint)
-> Nested Loop (cost=13889852.90..13889855.37 rows=1 width=327)
Output: (sum("*SELECT* 1".ops)), (sum("*SELECT* 1".ops_id)), (sum("*SELECT* 1".dps_l)), (sum("*SELECT* 1".dps_l_id)), (sum("*SELECT* 1".dps_g)), (sum("*SELECT* 1".dps_g_id)), (sum("*SELECT* 1".dps_mk)), (sum("*SELECT* 1".dps_mk_id)), (sum("*SELECT* 1".balance)), s.number, s.id, s.individual_id, i.insurance_number
Inner Unique: true
-> Nested Loop (cost=13889845.56..13889847.91 rows=1 width=312)
Output: (sum("*SELECT* 1".ops)), (sum("*SELECT* 1".ops_id)), (sum("*SELECT* 1".dps_l)), (sum("*SELECT* 1".dps_l_id)), (sum("*SELECT* 1".dps_g)), (sum("*SELECT* 1".dps_g_id)), (sum("*SELECT* 1".dps_mk)), (sum("*SELECT* 1".dps_mk_id)), (sum("*SELECT* 1".balance)), s.number, s.id, s.individual_id
Inner Unique: true
-> GroupAggregate (cost=13889845.12..13889845.25 rows=1 width=292)
Output: "*SELECT* 1".sharer_id, sum("*SELECT* 1".ops), sum("*SELECT* 1".ops_id), sum("*SELECT* 1".dps_g), sum("*SELECT* 1".dps_g_id), sum("*SELECT* 1".dps_l), sum("*SELECT* 1".dps_l_id), sum("*SELECT* 1".dps_mk), sum("*SELECT* 1".dps_mk_id), sum("*SELECT* 1".balance)
Group Key: "*SELECT* 1".sharer_id
Filter: (sum("*SELECT* 1".balance) <> '0'::numeric)
-> Sort (cost=13889845.12..13889845.13 rows=2 width=292)
Output: "*SELECT* 1".sharer_id, "*SELECT* 1".ops, "*SELECT* 1".ops_id, "*SELECT* 1".dps_g, "*SELECT* 1".dps_g_id, "*SELECT* 1".dps_l, "*SELECT* 1".dps_l_id, "*SELECT* 1".dps_mk, "*SELECT* 1".dps_mk_id, "*SELECT* 1".balance
Sort Key: "*SELECT* 1".sharer_id
-> Append (cost=6944961.14..13889845.11 rows=2 width=292)
-> Subquery Scan on "*SELECT* 1" (cost=6944961.14..6944961.25 rows=1 width=292)
Output: "*SELECT* 1".sharer_id, "*SELECT* 1".ops, "*SELECT* 1".ops_id, "*SELECT* 1".dps_g, "*SELECT* 1".dps_g_id, "*SELECT* 1".dps_l, "*SELECT* 1".dps_l_id, "*SELECT* 1".dps_mk, "*SELECT* 1".dps_mk_id, "*SELECT* 1".balance
-> GroupAggregate (cost=6944961.14..6944961.24 rows=1 width=292)
Output: da.owner_sharer_id, sum(t.value), sum(CASE WHEN ((dat.mnemonics)::text = ANY ('{ОПС,"ОПС ГВ","ОПС КП","Р ПП ОПС"}'::text[])) THEN t.value ELSE '0'::numeric END), sum(CASE WHEN ((dat.mnemonics)::text = ANY ('{"ОПС ИД","ОПС ФР","Р ПП ОПС ИД"}'::text[])) THEN t.value ELSE '0'::numeric END), sum(CASE WHEN ((dat.mnemonics)::text = ANY ('{"ДПС Г","ДПС Г ГВ","ДПС Г КП","Р ПП ДПС Г"}'::text[])) THEN t.value ELSE '0'::numeric END), sum(CASE WHEN ((dat.mnemonics)::text = ANY ('{"ДПС Г ИД","ДПС Г ФР","Р ПП ДПС Г ИД"}'::text[])) THEN t.value ELSE '0'::numeric END), sum(CASE WHEN ((dat.mnemonics)::text = ANY ('{"ДПС Л","ДПС Л ГВ","ДПС Л КП","Р ПП ДПС Л"}'::text[])) THEN t.value ELSE '0'::numeric END), sum(CASE WHEN ((dat.mnemonics)::text = ANY ('{"ДПС Л ИД","ДПС Л ФР","Р ПП ДПС Л ИД"}'::text[])) THEN t.value ELSE '0'::numeric END), sum(CASE WHEN ((dat.mnemonics)::text = ANY ('{"ДПС МК","ДПС МК ГВ","ДПС МК КП","Р ПП ДПС МК"}'::text[])) THEN t.value ELSE '0'::numeric END), sum(CASE WHEN ((dat.mnemonics)::text = ANY ('{"ДПС МК ИД","ДПС МК ФР","Р ПП ДПС МК ИД"}'::text[])) THEN t.value ELSE '0'::numeric END)
Group Key: da.owner_sharer_id
InitPlan 6
-> Result (cost=0.00..0.01 rows=1 width=1)
Output: (NULLIF(current_setting('app.user_id'::text, true), ''::text) IS NULL)
InitPlan 8
-> Result (cost=1.76..1.77 rows=1 width=1)
Output: (InitPlan 7).col1
InitPlan 7
-> Index Only Scan using user_group_pkey on ourpension.user_group ug_3 (cost=0.16..1.76 rows=1 width=0)
Index Cond: (ug_3.user_id = (NULLIF(current_setting('app.user_id'::text, true), ''::text))::bigint)
-> Sort (cost=6944959.36..6944959.36 rows=1 width=33)
Output: da.owner_sharer_id, t.value, dat.mnemonics
Sort Key: da.owner_sharer_id
-> Hash Join (cost=2313366.32..6944959.35 rows=1 width=33)
Output: da.owner_sharer_id, t.value, dat.mnemonics
Inner Unique: true
Hash Cond: (ca.account_type_id = cat.id)
-> Nested Loop (cost=2313361.38..6944954.37 rows=11 width=37)
Output: da.owner_sharer_id, dat.mnemonics, t.value, ca.account_type_id
Inner Unique: true
-> Nested Loop (cost=2313360.81..6944942.94 rows=11 width=37)
Output: da.owner_sharer_id, dat.mnemonics, t.value, t.credit_account_id
-> Nested Loop Left Join (cost=2313360.39..6944620.39 rows=1 width=31)
Output: da.owner_sharer_id, da.id, dat.mnemonics
Filter: (d.sharer_id IS NULL)
-> Nested Loop (cost=2313358.96..6329260.93 rows=404435 width=39)
Output: s_1.id, p.report_date, da.owner_sharer_id, da.id, dat.mnemonics
Join Filter: (a.death_date <= p.report_date)
-> Seq Scan on report.dia_param p (cost=0.00..1.01 rows=1 width=4)
Output: p.report_date, p.unload_perconal_data, p."user", p.register_kind
-> Nested Loop (cost=2313358.96..6314093.62 rows=1213304 width=39)
Output: s_1.id, a.death_date, da.owner_sharer_id, da.id, dat.mnemonics
-> Hash Join (cost=2313358.54..3083671.72 rows=1213304 width=39)
Output: s_1.individual_id, s_1.id, da.owner_sharer_id, da.id, dat.mnemonics
Hash Cond: (s_1.id = da.owner_sharer_id)
-> Hash Join (cost=1365085.96..2006847.12 rows=6979675 width=8)
Output: s_1.individual_id, s_1.id
Inner Unique: true
Hash Cond: (s_1.contract_id = c.id)
-> Seq Scan on ourpension.sharer s_1 (cost=0.00..431323.95 rows=14679695 width=12)
Output: s_1.individual_id, s_1.id, s_1.contract_id
-> Hash (cost=1245198.79..1245198.79 rows=7307373 width=4)
Output: c.id
-> Seq Scan on ourpension.contract c (cost=6.83..1245198.79 rows=7307373 width=4)
Output: c.id
Filter: (((c.service_type)::text = 'OPS'::text) AND CASE WHEN (InitPlan 6).col1 THEN true WHEN (InitPlan 8).col1 THEN (ANY (c.id = (hashed SubPlan 9).col1)) ELSE (NOT (ANY (c.id = (hashed SubPlan 10).col1))) END)
SubPlan 9
-> Nested Loop (cost=0.16..3.77 rows=1 width=8)
Output: a_5.contract_id
Join Filter: (ug_4.group_id = a_5.group_id)
-> Index Only Scan using user_group_pkey on ourpension.user_group ug_4 (cost=0.16..1.76 rows=1 width=8)
Output: ug_4.user_id, ug_4.group_id
Index Cond: (ug_4.user_id = (NULLIF(current_setting('app.user_id'::text, true), ''::text))::bigint)
-> Seq Scan on ourpension.rbac_contract_access a_5 (cost=0.00..2.00 rows=1 width=16)
Output: a_5.group_id, a_5.contract_id
SubPlan 10
-> Nested Loop (cost=0.00..3.06 rows=1 width=8)
Output: a_6.contract_id
Inner Unique: true
Join Filter: (a_6.group_id = g.id)
-> Seq Scan on ourpension.rbac_contract_access a_6 (cost=0.00..2.00 rows=1 width=16)
Output: a_6.group_id, a_6.contract_id
-> Seq Scan on ourpension.individual_groups g (cost=0.00..1.03 rows=2 width=4)
Output: g.id
Filter: g.hidden_from_external
-> Hash (cost=896606.98..896606.98 rows=2671968 width=31)
Output: da.owner_sharer_id, da.id, dat.mnemonics
-> Hash Join (cost=17.19..896606.98 rows=2671968 width=31)
Output: da.owner_sharer_id, da.id, dat.mnemonics
Inner Unique: true
Hash Cond: (da.account_type_id = dat.id)
-> Seq Scan on back_office.account da (cost=0.00..772033.16 rows=47045716 width=12)
Output: da.id, da.operation_id, da.account_type_id, da.owner_contract_id, da.owner_sharer_id, da.owner_individual_id, da.owner_entity_id, da.version
-> Hash (cost=16.84..16.84 rows=28 width=27)
Output: dat.mnemonics, dat.id
-> Index Only Scan using account_type_mnemonics_idx1 on back_office.account_type dat (cost=0.27..16.84 rows=28 width=27)
Output: dat.mnemonics, dat.id
Index Cond: (dat.mnemonics = ANY ('{ОПС,"ОПС ГВ","ОПС КП","Р ПП ОПС","ОПС ИД","ОПС ФР","Р ПП ОПС ИД","ДПС Г","ДПС Г ГВ","ДПС Г КП","Р ПП ДПС Г","ДПС Г ИД","ДПС Г ФР","Р ПП ДПС Г ИД","ДПС Л","ДПС Л ГВ","ДПС Л КП","Р ПП ДПС Л","ДПС Л ИД","ДПС Л ФР","Р ПП ДПС Л ИД","ДПС МК","ДПС МК ГВ","ДПС МК КП","Р ПП ДПС МК","ДПС МК ИД","ДПС МК ФР","Р ПП ДПС МК ИД"}'::text[]))
-> Limit (cost=0.42..2.64 rows=1 width=12)
Output: a.death_date, a.version
-> Index Scan using adi_last_by_individual_idx on ourpension.application_death_info a (cost=0.42..2.64 rows=1 width=12)
Output: a.death_date, a.version
Index Cond: (a.individual_id = s_1.individual_id)
-> Limit (cost=1.43..1.51 rows=1 width=4)
Output: d.sharer_id
-> Nested Loop (cost=1.43..9.82 rows=97 width=4)
Output: d.sharer_id
Inner Unique: true
Join Filter: (d.ops_transfer_register_id = tr.id)
-> Nested Loop (cost=1.00..9.36 rows=1 width=12)
Output: d.sharer_id, d.ops_transfer_register_id, o.ops_transfer_register_id
-> Index Scan using ops_transfer_details_sharer_id on back_office.ops_transfer_details d (cost=0.43..3.77 rows=2 width=8)
Output: d.ops_transfer_register_id, d.sharer_id, d.ops_fixing_id, d.new_insurer, d.previos_insurer, d.transfer_type, d.transfer_reason, d.pension_type, d.smev_uier_id, d.new_insurer_inn, d.balance, d.balance_sv, d.balance_dsv, d.balance_vr, d.balance_sofn, d.balance_msk, d.revenue, d.revenue_sv, d.revenue_dsv, d.revenue_vr, d.revenue_sofn, d.revenue_msk, d.transfer, d.transfer_sv, d.transfer_dsv, d.transfer_vr, d.transfer_sofn, d.transfer_msk, d.version, d.transfer_revenue_sv, d.transfer_revenue_dsv, d.transfer_revenue_vr, d.transfer_revenue_sofn, d.transfer_revenue_msk, d.transfer_revenue, d.fund_id, d.reserve, d.fund_bank_payment_type_id, d.entity_id
Index Cond: (d.sharer_id = s_1.id)
-> Index Scan using idx_operation_transfer_register_id on back_office.operation o (cost=0.57..2.79 rows=1 width=4)
Output: o.id, o.operation_type_id, o.author_agent_id, o.approver_agent_id, o.remover_agent_id, o.operation_date, o.effective_date, o.created, o.approved, o.deleted, o.query_datasource_file_id, o.version, o.period_date, o.comment, o.ops_payment_decision_id, o.payment_order_register_id, o.investment_revenue_calculation_id, o.pension_calculation_id, o.inheritance_calculation_id, o.termination_contract_calculation_id, o.payment_register_id, o.payment_return_id, o.inherited_payment_id, o.ops_assignee_decision_id, o.ops_payment_register_id, o.ops_fixing_id, o.ops_transfer_register_id, o.ops_payment_return_id, o.operation_document_id, o.revoked, o.revoker_agent_id, o.compensation_calculation_id, o.resumption_id, o.overpayment_return_id, o.inheritance_pension_calculation_id, o.ops_court_decision_id, o.ops_income_payment_order_id_1c, o.ops_deposit_enrollment_operation_id_1c, o.ops_transfer_to_reserve_id_1c, o.ops_payment_decision_id_1c, o.ops_transfer_to_assignee_reserve_id_1c, o.ops_investment_revenue_enrollment_id_1c, o.pension_charge_from_reserve_id_1c, o.ops_assignee_decision_id_1c, o.assignee_charge_from_reserve_id_1c, o.ops_transfer_operation_id_1c, o.ops_transfer_register_id_1c, o.ops_payment_register_hash_id_1c, o.ops_payment_register_operation_id_1c, o.ops_payment_return_hash_id_1c, o.ops_payment_return_operation_id_1c, o.ops_transfer_from_rops_operation_hash_id_1c, o.ops_correction_pfr_operation_hash_id_1c, o.ops_transfers_between_accounts_operation_hash_id_1c, o.ops_transfers_to_fund_reserve_pair_operation_hash_id_1c, o.ops_transfers_to_fund_reserve_single_operation_hash_id_1c, o.ops_misgrading_adjustment_operation_hash_id_1c, o.ops_manual_temporary_operation_hash_id_1c, o.ops_pension_savings_enrollment_operation_hash_id_1c, o.ops_income_from_own_funds_operation_hash_id_1c, o.ops_compensation_from_own_funds_operation_hash_id_1c, o.ops_commission_np_from_fund_reserve_operation_hash_id_1c, o.ops_return_from_fund_reserve_operation_id, o.ops_termination_pension_payments_operation_hash_id_1c, o.id_1c, o."incoming_order_id_1с", o.pension_calculation_id_1c, o.termination_contract_calculation_id_1c, o."inheritance_calculation_id_1с", o.payment_order_number, o.date_order_number, o.payment_return_id_1c, o.death_info_id, o.ops_transfer_pds_operation_hash_id_1c, o.npo_fixing_id, o.insurance_reserve_register_id, o.pds_payment_decision_id, o.accrual_repurchase_payments_inheritors_details_id, o.accrual_repurchase_amount_payments_details_id, o.pds_assignee_decision_id, o.ops_recovery_enrollment_operation_hash_id_1c
Index Cond: (o.ops_transfer_register_id = d.ops_transfer_register_id)
Filter: ((o.approved IS NOT NULL) AND (o.effective_date <= p.report_date))
-> Index Only Scan using ops_transfer_register_pk on back_office.ops_transfer_register tr (cost=0.42..0.44 rows=1 width=4)
Output: tr.id
Index Cond: (tr.id = o.ops_transfer_register_id)
-> Append (cost=0.42..313.67 rows=888 width=14)
-> Index Scan using transaction_2000_debit_account_id_effective_date_idx on back_office.transaction_2000 t_1 (cost=0.42..1.51 rows=4 width=14)
Output: t_1.value, t_1.debit_account_id, t_1.credit_account_id
Index Cond: (t_1.debit_account_id = da.id)
-> Index Scan using transaction_2001_debit_account_id_effective_date_idx on back_office.transaction_2001 t_2 (cost=0.29..1.91 rows=6 width=14)
Output: t_2.value, t_2.debit_account_id, t_2.credit_account_id
Index Cond: (t_2.debit_account_id = da.id)
-> Index Scan using transaction_2002_debit_account_id_effective_date_idx on back_office.transaction_2002 t_3 (cost=0.29..1.86 rows=6 width=14)
Output: t_3.value, t_3.debit_account_id, t_3.credit_account_id
Index Cond: (t_3.debit_account_id = da.id)
-> Index Scan using transaction_2003_debit_account_id_effective_date_idx on back_office.transaction_2003 t_4 (cost=0.42..2.15 rows=7 width=14)
Output: t_4.value, t_4.debit_account_id, t_4.credit_account_id
Index Cond: (t_4.debit_account_id = da.id)
-> Index Scan using transaction_2004_debit_account_id_effective_date_idx on back_office.transaction_2004 t_5 (cost=0.42..1.91 rows=6 width=14)
Output: t_5.value, t_5.debit_account_id, t_5.credit_account_id
Index Cond: (t_5.debit_account_id = da.id)
-> Index Scan using transaction_2005_debit_account_id_effective_date_idx on back_office.transaction_2005 t_6 (cost=0.43..5.54 rows=21 width=13)
Output: t_6.value, t_6.debit_account_id, t_6.credit_account_id
Index Cond: (t_6.debit_account_id = da.id)
-> Index Scan using transaction_2006_debit_account_id_effective_date_idx on back_office.transaction_2006 t_7 (cost=0.43..6.73 rows=26 width=14)
Output: t_7.value, t_7.debit_account_id, t_7.credit_account_id
Index Cond: (t_7.debit_account_id = da.id)
-> Index Scan using transaction_2007_debit_account_id_effective_date_idx on back_office.transaction_2007 t_8 (cost=0.43..7.46 rows=29 width=13)
Output: t_8.value, t_8.debit_account_id, t_8.credit_account_id
Index Cond: (t_8.debit_account_id = da.id)
-> Index Scan using transaction_2008_debit_account_id_effective_date_idx on back_office.transaction_2008 t_9 (cost=0.43..7.46 rows=29 width=14)
Output: t_9.value, t_9.debit_account_id, t_9.credit_account_id
Index Cond: (t_9.debit_account_id = da.id)
-> Index Scan using transaction_2009_debit_account_id_effective_date_idx on back_office.transaction_2009 t_10 (cost=0.43..7.69 rows=30 width=14)
Output: t_10.value, t_10.debit_account_id, t_10.credit_account_id
Index Cond: (t_10.debit_account_id = da.id)
-> Index Scan using transaction_2010_debit_account_id_effective_date_idx on back_office.transaction_2010 t_11 (cost=0.43..7.44 rows=29 width=14)
Output: t_11.value, t_11.debit_account_id, t_11.credit_account_id
Index Cond: (t_11.debit_account_id = da.id)
-> Index Scan using transaction_2011_01_debit_account_id_effective_date_idx on back_office.transaction_2011_01 t_12 (cost=0.42..1.33 rows=3 width=14)
Output: t_12.value, t_12.debit_account_id, t_12.credit_account_id
Index Cond: (t_12.debit_account_id = da.id)
-> Index Scan using transaction_2011_02_debit_account_id_effective_date_idx on back_office.transaction_2011_02 t_13 (cost=0.42..1.32 rows=3 width=14)
Output: t_13.value, t_13.debit_account_id, t_13.credit_account_id
Index Cond: (t_13.debit_account_id = da.id)
-> Index Scan using transaction_2011_03_debit_account_id_effective_date_idx on back_office.transaction_2011_03 t_14 (cost=0.43..1.24 rows=3 width=14)
Output: t_14.value, t_14.debit_account_id, t_14.credit_account_id
Index Cond: (t_14.debit_account_id = da.id)
-> Index Scan using transaction_2011_04_debit_account_id_effective_date_idx on back_office.transaction_2011_04 t_15 (cost=0.42..1.33 rows=3 width=14)
Output: t_15.value, t_15.debit_account_id, t_15.credit_account_id
Index Cond: (t_15.debit_account_id = da.id)
-> Index Scan using transaction_2011_05_debit_account_id_effective_date_idx on back_office.transaction_2011_05 t_16 (cost=0.43..1.34 rows=3 width=13)
Output: t_16.value, t_16.debit_account_id, t_16.credit_account_id
Index Cond: (t_16.debit_account_id = da.id)
-> Index Scan using transaction_2011_06_debit_account_id_effective_date_idx on back_office.transaction_2011_06 t_17 (cost=0.42..1.33 rows=3 width=14)
Output: t_17.value, t_17.debit_account_id, t_17.credit_account_id
Index Cond: (t_17.debit_account_id = da.id)
-> Index Scan using transaction_2011_07_debit_account_id_effective_date_idx on back_office.transaction_2011_07 t_18 (cost=0.42..1.33 rows=3 width=13)
Output: t_18.value, t_18.debit_account_id, t_18.credit_account_id
Index Cond: (t_18.debit_account_id = da.id)
-> Index Scan using transaction_2011_08_debit_account_id_effective_date_idx on back_office.transaction_2011_08 t_19 (cost=0.42..1.33 rows=3 width=14)
Output: t_19.value, t_19.debit_account_id, t_19.credit_account_id
Index Cond: (t_19.debit_account_id = da.id)
-> Index Scan using transaction_2011_09_debit_account_id_effective_date_idx on back_office.transaction_2011_09 t_20 (cost=0.43..1.34 rows=3 width=13)
Output: t_20.value, t_20.debit_account_id, t_20.credit_account_id
Index Cond: (t_20.debit_account_id = da.id)
-> Index Scan using transaction_2011_10_debit_account_id_effective_date_idx on back_office.transaction_2011_10 t_21 (cost=0.42..1.34 rows=3 width=14)
Output: t_21.value, t_21.debit_account_id, t_21.credit_account_id
Index Cond: (t_21.debit_account_id = da.id)
-> Index Scan using transaction_2011_11_debit_account_id_effective_date_idx on back_office.transaction_2011_11 t_22 (cost=0.43..1.34 rows=3 width=13)
Output: t_22.value, t_22.debit_account_id, t_22.credit_account_id
Index Cond: (t_22.debit_account_id = da.id)