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


CTE Scan on result r  (cost=13166003.27..13170011.97 rows=200435 width=1144)
  CTE result
    ->  Result  (cost=12774653.93..13166003.27 rows=200435 width=670)
          ->  Sort  (cost=12774653.93..12775155.02 rows=200435 width=1024)
                Sort Key: ((td.canceled IS NOT NULL)), td.version DESC
                ->  Nested Loop  (cost=27632.60..12695611.20 rows=200435 width=1024)
                      ->  Seq Scan on npf360_settings  (cost=0.00..1.30 rows=1 width=516)
                            Filter: ((name)::text = 'TESSA_API'::text)
                      ->  Nested Loop Left Join  (cost=27632.60..12666045.74 rows=200435 width=803)
                            ->  Nested Loop Left Join  (cost=27632.16..12655085.42 rows=200435 width=793)
                                  ->  Nested Loop Left Join  (cost=27631.87..12650070.32 rows=200435 width=797)
                                        ->  Hash Left Join  (cost=27570.85..415796.14 rows=200435 width=781)
                                              Hash Cond: (atc.information_source_id = info.id)
                                              ->  Nested Loop Left Join  (cost=27569.58..415082.91 rows=200435 width=367)
                                                    ->  Nested Loop Left Join  (cost=27569.29..410069.91 rows=200435 width=317)
                                                          ->  Nested Loop Left Join  (cost=27568.85..74245.78 rows=200435 width=271)
                                                                ->  Nested Loop Left Join  (cost=21581.84..46210.92 rows=200435 width=188)
                                                                      ->  Hash Left Join  (cost=21581.39..40865.02 rows=200435 width=138)
                                                                            Hash Cond: (td.application_termination_contract_id = atc.id)
                                                                            ->  Seq Scan on year_tax_deduction td  (cost=0.00..18757.47 rows=200435 width=121)
                                                                                  Filter: ((type)::text <> 'NONE'::text)
                                                                            ->  Hash  (cost=17406.73..17406.73 rows=333973 width=21)
                                                                                  ->  Seq Scan on application_termination_contract atc  (cost=0.00..17406.73 rows=333973 width=21)
                                                                      ->  Memoize  (cost=0.45..1.59 rows=1 width=58)
                                                                            Cache Key: atc.application_personal_data_individual_id
                                                                            Cache Mode: logical
                                                                            ->  Index Scan using application_personal_data_individual_id_pk on application_personal_data_individual apdi  (cost=0.44..1.58 rows=1 width=58)
                                                                                  Index Cond: (id = atc.application_personal_data_individual_id)
                                                                ->  Hash Right Join  (cost=5987.01..5987.11 rows=1 width=83)
                                                                      Hash Cond: ((('NPO'::text) = (contract.service_type)::text) AND ((0) = contract.client_type))
                                                                      ->  Append  (cost=0.00..0.06 rows=4 width=68)
                                                                            ->  Result  (cost=0.00..0.01 rows=1 width=68)
                                                                            ->  Result  (cost=0.00..0.01 rows=1 width=68)
                                                                            ->  Result  (cost=0.00..0.01 rows=1 width=68)
                                                                            ->  Result  (cost=0.00..0.01 rows=1 width=68)
                                                                      ->  Hash  (cost=5987.00..5987.00 rows=1 width=59)
                                                                            ->  Nested Loop Left Join  (cost=5984.71..5987.00 rows=1 width=59)
                                                                                  ->  Nested Loop Left Join  (cost=5984.27..5986.50 rows=1 width=28)
                                                                                        ->  Limit  (cost=5983.84..5983.84 rows=1 width=230)
                                                                                              ->  Sort  (cost=5983.84..5983.84 rows=1 width=230)
                                                                                                    Sort Key: application_termination_contract_data.id DESC
                                                                                                    ->  Seq Scan on application_termination_contract_data  (cost=0.00..5983.82 rows=1 width=230)
                                                                                                          Filter: (application_termination_contract_id = atc.id)
                                                                                        ->  Index Scan using sharer_pkey on sharer sh  (cost=0.43..2.65 rows=1 width=28)
                                                                                              Index Cond: (id = application_termination_contract_data.sharer_id)
                                                                                  ->  Index Scan using contract_pkey on contract  (cost=0.43..0.49 rows=1 width=39)
                                                                                        Index Cond: (id = sh.contract_id)
                                                          ->  Index Scan using individual_pkey on individual ind  (cost=0.43..1.68 rows=1 width=54)
                                                                Index Cond: (id = COALESCE(td.individual_id, apdi.individual_id))
                                                    ->  Memoize  (cost=0.30..0.31 rows=1 width=58)
                                                          Cache Key: td.agent_id
                                                          Cache Mode: logical
                                                          ->  Index Scan using agent_pkey on agent a  (cost=0.29..0.30 rows=1 width=58)
                                                                Index Cond: (id = td.agent_id)
                                              ->  Hash  (cost=1.12..1.12 rows=12 width=422)
                                                    ->  Seq Scan on information_source info  (cost=0.00..1.12 rows=12 width=422)
                                        ->  Limit  (cost=61.02..61.02 rows=1 width=902)
                                              ->  Sort  (cost=61.02..61.15 rows=53 width=902)
                                                    Sort Key: fns_reference_request_journal.request_date DESC
                                                    ->  Index Scan using ix_fns_ref_req_journal_contract_number on fns_reference_request_journal  (cost=0.43..60.75 rows=53 width=902)
                                                          Index Cond: (contract_number = (contract.number)::text)
                                  ->  Memoize  (cost=0.29..2.51 rows=1 width=8)
                                        Cache Key: fns_reference_request_journal.model_file_to_verification_id
                                        Cache Mode: logical
                                        ->  Index Only Scan using idx_model_file_register on model_file_to_verification mfc  (cost=0.28..2.50 rows=1 width=8)
                                              Index Cond: (id = fns_reference_request_journal.model_file_to_verification_id)
                            ->  Memoize  (cost=0.44..2.57 rows=1 width=18)
                                  Cache Key: mfc.register_id
                                  Cache Mode: logical
                                  ->  Index Scan using table_name_pkey on smev_register sr  (cost=0.43..2.56 rows=1 width=18)
                                        Index Cond: (id = mfc.register_id)
          SubPlan 2
            ->  Index Scan using ix_fns_ref_req_journal_response_received on fns_reference_request_journal fj  (cost=0.43..1.55 rows=1 width=12)
                  Index Cond: (response_received = true)