Загрузка данных


                      ->  Index Scan using transaction_2025_02_debit_account_id_effective_date_value_idx on transaction_2025_02 t_393  (cost=0.42..29.01 rows=18 width=14)
                            Index Cond: (debit_account_id = ANY (r_1.ids))
                      ->  Index Scan using transaction_2025_03_debit_account_id_effective_date_value_idx on transaction_2025_03 t_394  (cost=0.42..29.73 rows=18 width=14)
                            Index Cond: (debit_account_id = ANY (r_1.ids))
                      ->  Index Scan using transaction_2025_04_debit_account_id_effective_date_value_idx on transaction_2025_04 t_395  (cost=0.42..31.02 rows=23 width=14)
                            Index Cond: (debit_account_id = ANY (r_1.ids))
                      ->  Index Scan using transaction_2025_05_debit_account_id_effective_date_value_idx on transaction_2025_05 t_396  (cost=0.42..35.23 rows=20 width=13)
                            Index Cond: (debit_account_id = ANY (r_1.ids))
                      ->  Index Scan using transaction_2025_06_debit_account_id_effective_date_value_idx on transaction_2025_06 t_397  (cost=0.42..30.54 rows=19 width=14)
                            Index Cond: (debit_account_id = ANY (r_1.ids))
                      ->  Index Scan using transaction_2025_07_debit_account_id_effective_date_value_idx on transaction_2025_07 t_398  (cost=0.42..31.33 rows=21 width=14)
                            Index Cond: (debit_account_id = ANY (r_1.ids))
                      ->  Index Scan using transaction_2025_08_debit_account_id_effective_date_value_idx on transaction_2025_08 t_399  (cost=0.42..30.35 rows=19 width=14)
                            Index Cond: (debit_account_id = ANY (r_1.ids))
                      ->  Index Scan using transaction_2025_09_debit_account_id_effective_date_value_idx on transaction_2025_09 t_400  (cost=0.42..26.29 rows=16 width=14)
                            Index Cond: (debit_account_id = ANY (r_1.ids))
                      ->  Index Scan using transaction_2025_10_debit_account_id_effective_date_value_idx on transaction_2025_10 t_401  (cost=0.42..30.25 rows=19 width=14)
                            Index Cond: (debit_account_id = ANY (r_1.ids))
                      ->  Index Scan using transaction_2025_11_debit_account_id_effective_date_value_idx on transaction_2025_11 t_402  (cost=0.42..30.35 rows=19 width=14)
                            Index Cond: (debit_account_id = ANY (r_1.ids))
                      ->  Index Scan using transaction_2025_12_debit_account_id_effective_date_idx on transaction_2025_12 t_403  (cost=0.44..98.64 rows=100 width=14)
                            Index Cond: (debit_account_id = ANY (r_1.ids))
                      ->  Index Scan using transaction_2026_01_debit_account_id_effective_date_value_idx on transaction_2026_01 t_404  (cost=0.42..26.03 rows=13 width=14)
                            Index Cond: (debit_account_id = ANY (r_1.ids))
                      ->  Index Scan using transaction_2026_02_debit_account_id_effective_date_value_idx on transaction_2026_02 t_405  (cost=0.42..30.03 rows=19 width=14)
                            Index Cond: (debit_account_id = ANY (r_1.ids))
                      ->  Index Scan using transaction_2026_03_debit_account_id_effective_date_value_idx on transaction_2026_03 t_406  (cost=0.43..30.18 rows=16 width=15)
                            Index Cond: (debit_account_id = ANY (r_1.ids))
                      ->  Index Scan using transaction_2026_04_debit_account_id_effective_date_value_idx on transaction_2026_04 t_407  (cost=0.42..29.64 rows=19 width=14)
                            Index Cond: (debit_account_id = ANY (r_1.ids))
                      ->  Index Scan using transaction_2026_05_debit_account_id_effective_date_value_idx on transaction_2026_05 t_408  (cost=0.42..30.05 rows=19 width=14)
                            Index Cond: (debit_account_id = ANY (r_1.ids))
                      ->  Index Scan using transaction_2026_06_debit_account_id_effective_date_value_idx on transaction_2026_06 t_409  (cost=0.42..30.13 rows=19 width=14)
                            Index Cond: (debit_account_id = ANY (r_1.ids))
                      ->  Index Scan using transaction_2026_07_debit_account_id_effective_date_value_idx on transaction_2026_07 t_410  (cost=0.42..32.19 rows=19 width=14)
                            Index Cond: (debit_account_id = ANY (r_1.ids))
                      ->  Index Scan using transaction_2026_08_debit_account_id_effective_date_value_idx on transaction_2026_08 t_411  (cost=0.42..24.72 rows=10 width=15)
                            Index Cond: (debit_account_id = ANY (r_1.ids))
                      ->  Index Scan using transaction_2026_09_debit_account_id_effective_date_value_idx on transaction_2026_09 t_412  (cost=0.42..26.36 rows=10 width=14)
                            Index Cond: (debit_account_id = ANY (r_1.ids))
                      ->  Index Scan using transaction_2026_10_debit_account_id_effective_date_idx on transaction_2026_10 t_413  (cost=0.29..25.05 rows=10 width=15)
                            Index Cond: (debit_account_id = ANY (r_1.ids))
                      ->  Seq Scan on transaction_2026_11 t_414  (cost=0.00..2.85 rows=9 width=15)
                            Filter: (debit_account_id = ANY (r_1.ids))
                      ->  Seq Scan on transaction_2026_12 t_415  (cost=0.00..0.00 rows=1 width=30)
                            Filter: (debit_account_id = ANY (r_1.ids))
                      ->  Seq Scan on transaction_2027_01 t_416  (cost=0.00..0.00 rows=1 width=30)
                            Filter: (debit_account_id = ANY (r_1.ids))
                      ->  Seq Scan on transaction_2027_02 t_417  (cost=0.00..0.00 rows=1 width=30)
                            Filter: (debit_account_id = ANY (r_1.ids))
                      ->  Seq Scan on transaction_2027_03 t_418  (cost=0.00..0.00 rows=1 width=30)
                            Filter: (debit_account_id = ANY (r_1.ids))
                      ->  Seq Scan on transaction_2027_04 t_419  (cost=0.00..0.00 rows=1 width=30)
                            Filter: (debit_account_id = ANY (r_1.ids))
                      ->  Seq Scan on transaction_2027_05 t_420  (cost=0.00..0.00 rows=1 width=30)
                            Filter: (debit_account_id = ANY (r_1.ids))
                      ->  Seq Scan on transaction_2027_06 t_421  (cost=0.00..0.00 rows=1 width=30)
                            Filter: (debit_account_id = ANY (r_1.ids))
                      ->  Seq Scan on transaction_2027_07 t_422  (cost=0.00..0.00 rows=1 width=30)
                            Filter: (debit_account_id = ANY (r_1.ids))
                      ->  Seq Scan on transaction_2027_08 t_423  (cost=0.00..0.00 rows=1 width=30)
                            Filter: (debit_account_id = ANY (r_1.ids))
  InitPlan 9
    ->  Result  (cost=0.00..0.01 rows=1 width=1)
  InitPlan 11
    ->  Result  (cost=1.02..1.03 rows=1 width=1)
          InitPlan 10
            ->  Seq Scan on user_group ug_2  (cost=0.00..1.02 rows=1 width=0)
                  Filter: (user_id = (NULLIF(current_setting('app.user_id'::text, true), ''::text))::bigint)
  ->  Nested Loop  (cost=1648231.65..1816887.76 rows=16818 width=327)
        ->  Nested Loop  (cost=1648229.11..1727504.85 rows=33635 width=312)
              ->  GroupAggregate  (cost=1648228.67..1651524.56 rows=33635 width=292)
                    Group Key: a.owner_sharer_id
                    Filter: (sum(m.signed_value) <> '0'::numeric)
                    ->  Sort  (cost=1648228.67..1648313.18 rows=33804 width=59)
                          Sort Key: a.owner_sharer_id
                          ->  Hash Join  (cost=438026.24..1645685.78 rows=33804 width=59)
                                Hash Cond: (m.account_id = a.id)
                                ->  CTE Scan on reserve_movements m  (cost=0.00..1016691.80 rows=50834590 width=36)
                                ->  Hash  (cost=437635.45..437635.45 rows=31263 width=31)
                                      ->  Hash Join  (cost=18.37..437635.45 rows=31263 width=31)
                                            Hash Cond: (a.account_type_id = at.id)
                                            ->  Nested Loop  (cost=0.56..436201.31 rows=534826 width=12)
                                                  ->  CTE Scan on ops_sharer s_1  (cost=0.00..2430.20 rows=121510 width=4)
                                                  ->  Index Scan using idx_account_owner_sharer_id on account a  (cost=0.56..3.53 rows=4 width=12)
                                                        Index Cond: (owner_sharer_id = s_1.id)
                                            ->  Hash  (cost=17.45..17.45 rows=28 width=27)
                                                  ->  Bitmap Heap Scan on account_type at  (cost=3.03..17.45 rows=28 width=27)
                                                        Recheck Cond: ((mnemonics)::text = ANY ('{ОПС,"ОПС ГВ","ОПС КП","Р ПП ОПС","ОПС ИД","ОПС ФР","Р ПП ОПС ИД","ДПС Г","ДПС Г ГВ","ДПС Г КП","Р ПП ДПС Г","ДПС Г ИД","ДПС Г ФР","Р ПП ДПС Г ИД","ДПС Л","ДПС Л ГВ","ДПС Л КП","Р ПП ДПС Л","ДПС Л ИД","ДПС Л ФР","Р ПП ДПС Л ИД","ДПС МК","ДПС МК ГВ","ДПС МК КП","Р ПП ДПС МК","ДПС МК ИД","ДПС МК ФР","Р ПП ДПС МК ИД"}'::text[]))
                                                        ->  Bitmap Index Scan on account_type_mnemonics_idx1  (cost=0.00..2.96 rows=28 width=0)
                                                              Index Cond: ((mnemonics)::text = ANY ('{ОПС,"ОПС ГВ","ОПС КП","Р ПП ОПС","ОПС ИД","ОПС ФР","Р ПП ОПС ИД","ДПС Г","ДПС Г ГВ","ДПС Г КП","Р ПП ДПС Г","ДПС Г ИД","ДПС Г ФР","Р ПП ДПС Г ИД","ДПС Л","ДПС Л ГВ","ДПС Л КП","Р ПП ДПС Л","ДПС Л ИД","ДПС Л ФР","Р ПП ДПС Л ИД","ДПС МК","ДПС МК ГВ","ДПС МК КП","Р ПП ДПС МК","ДПС МК ИД","ДПС МК ФР","Р ПП ДПС МК ИД"}'::text[]))
              ->  Index Scan using sharer_pkey on sharer s  (cost=0.43..2.25 rows=1 width=24)
                    Index Cond: (id = a.owner_sharer_id)
        ->  Index Scan using individual_pkey on individual i  (cost=2.54..2.66 rows=1 width=19)
              Index Cond: (id = s.individual_id)
              Filter: CASE WHEN (InitPlan 9).col1 THEN true WHEN (InitPlan 11).col1 THEN (ANY (id = (hashed SubPlan 12).col1)) ELSE (NOT (ANY (id = (hashed SubPlan 13).col1))) END
              SubPlan 12
                ->  Unique  (cost=2.09..2.10 rows=2 width=8)
                      ->  Sort  (cost=2.09..2.09 rows=2 width=8)
                            Sort Key: a_6.individual_id
                            ->  Append  (cost=0.00..2.08 rows=2 width=8)
                                  ->  Nested Loop  (cost=0.00..1.03 rows=1 width=8)
                                        Join Filter: (ug_3.group_id = a_6.group_id)
                                        ->  Seq Scan on user_group ug_3  (cost=0.00..1.02 rows=1 width=8)
                                              Filter: (user_id = (NULLIF(current_setting('app.user_id'::text, true), ''::text))::bigint)
                                        ->  Seq Scan on group_individual_access a_6  (cost=0.00..0.00 rows=1 width=16)
                                  ->  Nested Loop  (cost=0.00..1.03 rows=1 width=8)
                                        Join Filter: (ug_4.group_id = a_7.group_id)
                                        ->  Seq Scan on user_group ug_4  (cost=0.00..1.02 rows=1 width=8)
                                              Filter: (user_id = (NULLIF(current_setting('app.user_id'::text, true), ''::text))::bigint)
                                        ->  Seq Scan on group_contract_access a_7  (cost=0.00..0.00 rows=1 width=16)
                                              Filter: (individual_id IS NOT NULL)
              SubPlan 13
                ->  Seq Scan on rbac_public_hidden_individual  (cost=0.00..0.00 rows=1 width=8)
  ->  Limit  (cost=0.42..2.64 rows=1 width=12)
        ->  Index Scan using adi_last_by_individual_idx on application_death_info a_1  (cost=0.42..2.64 rows=1 width=12)
              Index Cond: (individual_id = s.individual_id)