Загрузка данных
Nested Loop Anti Join (cost=57795.73..1814420.12 rows=121510 width=8)
Output: s.id, death_info.death_date
Join Filter: (o.effective_date <= p.report_date)
CTE latest_death_info
-> Result (cost=0.42..57790.33 rows=634009 width=16)
Output: a.individual_id, a.death_date, a.version
-> Unique (cost=0.42..57790.33 rows=634009 width=16)
Output: a.id, a.number, a.date, a.death_date, a.death_info_date, a.death_certificate_date, a.death_certificate_number, a.death_info_certificate_code, a.comment, a.accepted, a.rejected, a.canceled, a.version, a.agent_id, a.individual_id, a.individual_document_id, a.death_certificate_place, a.person_death_registration_id, a.person_id, a.death_info_received_type_code, a.ops_transfer_register_id, a.source_document_info, a.is_svo, a.previous_death_info_id, a.is_not_death_date, a.death_date_month, a.death_date_year, a.transfered_balance_to_sr
-> Index Scan using adi_last_by_individual_idx on ourpension.application_death_info a (cost=0.42..55594.82 rows=878205 width=16)
Output: a.id, a.number, a.date, a.death_date, a.death_info_date, a.death_certificate_date, a.death_certificate_number, a.death_info_certificate_code, a.comment, a.accepted, a.rejected, a.canceled, a.version, a.agent_id, a.individual_id, a.individual_document_id, a.death_certificate_place, a.person_death_registration_id, a.person_id, a.death_info_received_type_code, a.ops_transfer_register_id, a.source_document_info, a.is_svo, a.previous_death_info_id, a.is_not_death_date, a.death_date_month, a.death_date_year, a.transfered_balance_to_sr
InitPlan 2
-> Result (cost=0.00..0.01 rows=1 width=1)
Output: (NULLIF(current_setting('app.user_id'::text, true), ''::text) IS NULL)
InitPlan 4
-> Result (cost=1.02..1.03 rows=1 width=1)
Output: (InitPlan 3).col1
InitPlan 3
-> Seq Scan on ourpension.user_group ug (cost=0.00..1.02 rows=1 width=0)
Filter: (ug.user_id = (NULLIF(current_setting('app.user_id'::text, true), ''::text))::bigint)
-> Nested Loop (cost=2.93..923462.50 rows=131961 width=12)
Output: death_info.death_date, p.report_date, s.id
Inner Unique: true
-> Nested Loop (cost=0.43..211876.92 rows=277417 width=16)
Output: death_info.death_date, p.report_date, s.id, s.contract_id
-> Nested Loop (cost=0.00..20606.30 rows=211336 width=12)
Output: death_info.death_date, death_info.individual_id, p.report_date
Join Filter: (death_info.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
-> CTE Scan on latest_death_info death_info (cost=0.00..12680.18 rows=634009 width=8)
Output: death_info.individual_id, death_info.death_date
-> Index Scan using sharer_individual_id_idx on ourpension.sharer s (cost=0.43..0.90 rows=1 width=12)
Output: s.id, s.annulled, s.approved, s.created, s.init_order_date, s.init_order_number, s.version, s.annulled_agent_id, s.approved_agent_id, s.contract_id, s.created_agent_id, s.individual_id, s.sharer, s.bank_details_id, s.number, s.close_date, s.closed, s.closed_agent_id, s.closed_reason_id, s.pension_program_id, s.inheritance_type_code, s.investor_pension, s.first_payment_persent, s.retiree, s.service_length, s.dismiss_date, s.district_k, s.monthly_salary, s.periodicity_code, s.payout_duration, s.open_date, s.npo_pension_type_id, s.comment, s.sharer_id_1c, s.contract_id_1c, s.person_id, s.scheme_id, s.not_displayed_in_lkk, s.code_1c, s.entity_id, s.inheritance_on_accum, s.inheritance_on_pay
Index Cond: (s.individual_id = death_info.individual_id)
-> Index Scan using contract_pkey on ourpension.contract c (cost=2.50..2.57 rows=1 width=4)
Output: c.id
Index Cond: (c.id = s.contract_id)
Filter: (((c.service_type)::text = 'OPS'::text) AND CASE WHEN (InitPlan 2).col1 THEN true WHEN (InitPlan 4).col1 THEN (ANY (c.id = (hashed SubPlan 5).col1)) ELSE (NOT (ANY (c.id = (hashed SubPlan 6).col1))) END)
SubPlan 5
-> Nested Loop (cost=0.00..1.03 rows=1 width=8)
Output: a_1.contract_id
Join Filter: (ug_1.group_id = a_1.group_id)
-> Seq Scan on ourpension.user_group ug_1 (cost=0.00..1.02 rows=1 width=8)
Output: ug_1.user_id, ug_1.group_id, ug_1.created_at
Filter: (ug_1.user_id = (NULLIF(current_setting('app.user_id'::text, true), ''::text))::bigint)
-> Seq Scan on ourpension.rbac_contract_access a_1 (cost=0.00..0.00 rows=1 width=16)
Output: a_1.group_id, a_1.contract_id
SubPlan 6
-> Nested Loop (cost=0.00..1.02 rows=1 width=8)
Output: a_2.contract_id
Inner Unique: true
Join Filter: (a_2.group_id = g.id)
-> Seq Scan on ourpension.rbac_contract_access a_2 (cost=0.00..0.00 rows=1 width=16)
Output: a_2.group_id, a_2.contract_id
-> Seq Scan on ourpension.individual_groups g (cost=0.00..1.01 rows=1 width=4)
Output: g.id
Filter: g.hidden_from_external
-> Nested Loop (cost=1.43..3.09 rows=291 width=8)
Output: d.sharer_id, o.effective_date
Inner Unique: true
-> Nested Loop (cost=1.00..2.20 rows=2 width=16)
Output: d.ops_transfer_register_id, d.sharer_id, o.ops_transfer_register_id, o.effective_date
-> Index Scan using ops_transfer_details_sharer_id on back_office.ops_transfer_details d (cost=0.43..0.48 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.id)
-> Index Scan using idx_operation_transfer_register_id on back_office.operation o (cost=0.57..0.85 rows=1 width=8)
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)
-> Index Only Scan using ops_transfer_register_pk on back_office.ops_transfer_register tr (cost=0.42..0.45 rows=1 width=4)
Output: tr.id
Index Cond: (tr.id = d.ops_transfer_register_id)
Query Identifier: 7289528502626984040