explain.depesz.com

PostgreSQL's explain analyze made readable

Result: MPBY

Settings
# exclusive inclusive rows x rows loops node
1. 0.001 6,089.349 ↑ 1.0 21 1

Limit (cost=1,485,755.38..1,485,755.43 rows=21 width=718) (actual time=6,089.346..6,089.349 rows=21 loops=1)

  • Output: s.id, s.begin_dt, s.issue_dt, (CASE WHEN ((state.code)::text = '3'::text) THEN (SubPlan 1) ELSE NULL::integer END), (CASE WHEN ((state.code)::text = ANY ('{3,5}'::text[])) THEN COALESCE((SubPlan 2), (SubPlan 3)) ELSE NULL::text END), (CASE WHEN ((SubPlan 4) OR ((state.code)::text = '3'::text)) THEN s.end_dt ELSE NULL::date END), (CASE WHEN (s.type_id = 1) THEN s.days ELSE sickdoc.get_sickdoc_days_count(s.id) END), (((s.parent_id IS NOT NULL) AND ((type.code)::text <> '3'::text))), (((type.code)::text = '3'::text)), (((state.code)::text = '5'::text)), (((state.code)::text = '3'::text)), ((((SubPlan 5) AND ((state.code)::text = '3'::text)) OR (SubPlan 6))), (((state.code)::text = '2'::text)), (((state.code)::text = '1'::text)), ((se.disability_reason_id = 5)), s.clinic_id, ($11), s.workplace_id, ((SubPlan 9)), (COALESCE((SubPlan 10), (SubPlan 11))), s.clinic_id, s.registered_clinic_id, (COALESCE((SubPlan 12), s.print_clinic)), s_continue.number, s_continue.id, ((s_continue.id IS NOT NULL)), (((s.clinic_id IS NOT NULL) AND (s_continue.clinic_id IS NOT NULL) AND (s.clinic_id = s_continue.clinic_id))), (sickdoc.sickdoc_has_max_available_count_of_periods(s.id)), kind.code, s.parent_id, s.individual_id, (concat(individual.surname, ((' '::text || "left"((individual.name)::text, 1)) || '.'::text), ((' '::text || "left"(CASE WHEN (btrim((individual.patr_name)::text) = ANY ('{"",NULL}'::text[])) THEN NULL::text ELSE btrim((individual.patr_name)::text) END, 1)) || '.'::text), ((' ('::text || to_char((individual.birth_dt)::timestamp with time zone, 'DD.MM.YYYY'::text)) || ')'::text))), individual.gender_id, (CASE WHEN (individual.birth_dt IS NULL) THEN NULL::double precision ELSE date_part('year'::text, age((('now'::cstring)::date)::timestamp with time zone, (individual.birth_dt)::timestamp with time zone)) END), (NULL::unknown), (NULL::unknown), s.ready_to_work_dt, s.ready_to_work_other_id, (CASE WHEN (COALESCE(s.is_eln, false) AND ((COALESCE(s.fss_state_code, ''::character varying))::text = ''::text)) THEN 'request'::text WHEN (COALESCE(s.is_eln, false) AND ((COALESCE(s.fss_state_code, ''::character varying))::text = ANY ('{010,020}'::text[])) AND (s.end_dt < ('now'::cstring)::date)) THEN 'expired'::text WHEN (COALESCE(s.is_eln, false) AND ((COALESCE(s.fss_state_code, ''::character varying))::text = ANY ('{010,020}'::text[]))) THEN 'opened'::text WHEN (COALESCE(s.is_eln, false) AND ((COALESCE(s.fss_state_code, ''::character varying))::text = '030'::text)) THEN 'closed'::text WHEN (COALESCE(s.is_eln, false) AND ((COALESCE(s.fss_state_code, ''::character varying))::text = '090'::text)) THEN 'annulled'::text WHEN ((NOT COALESCE(s.is_eln, false)) AND ((state.code)::text = ANY ('{1,2}'::text[])) AND (s.end_dt < ('now'::cstring)::date)) THEN 'expired'::text WHEN ((NOT COALESCE(s.is_eln, false)) AND ((state.code)::text = '1'::text)) THEN 'request'::text WHEN ((NOT COALESCE(s.is_eln, false)) AND ((state.code)::text = '2'::text)) THEN 'opened'::text WHEN ((NOT COALESCE(s.is_eln, false)) AND ((state.code)::text = '3'::text)) THEN 'closed'::text WHEN ((NOT COALESCE(s.is_eln, false)) AND ((state.code)::text = '4'::text)) THEN 'expired'::text WHEN ((NOT COALESCE(s.is_eln, false)) AND ((state.code)::text = '5'::text)) THEN 'annulled'::text ELSE NULL::text END), ((COALESCE(s.is_eln, false) AND ((COALESCE(s.fss_state_code, ''::character varying))::text <> ALL ('{"",090}'::text[])))), s.number, s.workplace_id, (COALESCE(s.workplace_print, (SubPlan 13))), s.workplace_type_id, ((s.number IS NULL)), s.workplace_type_id, ((s.workplace_type_id = 1)), s.transfer_from_clinic, (COALESCE((s.clinic_id <> 164), true)), ((s.registered_clinic_id = 164)), ((s.type_id = 1)), ((s.type_id = 2)), ((s.type_id = 3)), ((((rwo.code)::text = '31'::text) OR ((rwo.code)::text = '37'::text))), s.journal_id, s.state_id, (COALESCE(s.is_eln, false)), ((SubPlan 14)), s.fss_state_code, (((COALESCE(s.fss_state_code, ''::character varying))::text = '030'::text)), (((COALESCE(s.fss_state_code, ''::character varying))::text = '040'::text)), (((COALESCE(s.fss_state_code, ''::character varying))::text = '090'::text)), (((COALESCE(s.fss_state_code, ''::character varying))::text <> ''::text)), fss_request_state.id, fss_request_state.name, ("substring"(regexp_replace((fss_request.stacktrace)::text, '(Найдены.*Дополнительная информация: [\r\n])'::text, ''::text), 0, 399)), (COALESCE(s.is_from_fss, false)), (NULL::unknown), (NULL::unknown), (CASE WHEN (s.is_eln AND ((SubPlan 15) OR (((((s.hospital_from_dt IS NOT NULL) OR (s.hospital_to_dt IS NOT NULL)) AND (s.issue_dt >= COALESCE(s.hospital_from_dt, '-infinity'::date)) AND (s.issue_dt <= (COALESCE(s.hospital_to_dt, ('now'::cstring)::date) + '2 days'::interval))) OR (s.issue_dt <= s.begin_dt) OR (SubPlan 16)) IS FALSE) OR (((alternatives: SubPlan 17 or hashed SubPlan 18) OR ((s.issue_dt + '2 days'::interval) >= ('now'::cstring)::date) OR (SubPlan 19) OR (SubPlan 20) OR (NOT (SubPlan 21))) IS FALSE) OR (((5 = se.disability_reason_edited_id) OR ((5 = se.disability_reason_id) AND (se.disability_reason_edited_id IS NULL)) OR (SubPlan 22)) IS FALSE))) THEN 'Да'::text ELSE 'Нет'::text END), (CASE WHEN ((alternatives: SubPlan 23 or hashed SubPlan 24) OR ((state.code)::text = '3'::text)) THEN s.end_dt ELSE NULL::date END)
  • Buffers: shared hit=1785022
2.          

Initplan (forLimit)

3. 0.002 0.002 ↑ 1.0 1 1

Result (cost=0.01..0.02 rows=1 width=0) (actual time=0.002..0.002 rows=1 loops=1)

  • Output: $10
4.          

Initplan (forResult)

5. 0.000 0.000 ↓ 0.0 0 1

Result (cost=0.00..0.01 rows=1 width=0) (actual time=0.000..0.000 rows=0 loops=1)

  • One-Time Filter: false
6. 52.536 6,089.346 ↑ 319.2 21 1

Sort (cost=1,485,755.36..1,485,772.11 rows=6,703 width=718) (actual time=6,089.345..6,089.346 rows=21 loops=1)

  • Output: s.id, s.begin_dt, s.issue_dt, (CASE WHEN ((state.code)::text = '3'::text) THEN (SubPlan 1) ELSE NULL::integer END), (CASE WHEN ((state.code)::text = ANY ('{3,5}'::text[])) THEN COALESCE((SubPlan 2), (SubPlan 3)) ELSE NULL::text END), (CASE WHEN ((SubPlan 4) OR ((state.code)::text = '3'::text)) THEN s.end_dt ELSE NULL::date END), (CASE WHEN (s.type_id = 1) THEN s.days ELSE sickdoc.get_sickdoc_days_count(s.id) END), (((s.parent_id IS NOT NULL) AND ((type.code)::text <> '3'::text))), (((type.code)::text = '3'::text)), (((state.code)::text = '5'::text)), (((state.code)::text = '3'::text)), ((((SubPlan 5) AND ((state.code)::text = '3'::text)) OR (SubPlan 6))), (((state.code)::text = '2'::text)), (((state.code)::text = '1'::text)), ((se.disability_reason_id = 5)), s.clinic_id, ($11), s.workplace_id, ((SubPlan 9)), (COALESCE((SubPlan 10), (SubPlan 11))), s.clinic_id, s.registered_clinic_id, (COALESCE((SubPlan 12), s.print_clinic)), s_continue.number, s_continue.id, ((s_continue.id IS NOT NULL)), (((s.clinic_id IS NOT NULL) AND (s_continue.clinic_id IS NOT NULL) AND (s.clinic_id = s_continue.clinic_id))), (sickdoc.sickdoc_has_max_available_count_of_periods(s.id)), kind.code, s.parent_id, s.individual_id, (concat(individual.surname, ((' '::text || "left"((individual.name)::text, 1)) || '.'::text), ((' '::text || "left"(CASE WHEN (btrim((individual.patr_name)::text) = ANY ('{"",NULL}'::text[])) THEN NULL::text ELSE btrim((individual.patr_name)::text) END, 1)) || '.'::text), ((' ('::text || to_char((individual.birth_dt)::timestamp with time zone, 'DD.MM.YYYY'::text)) || ')'::text))), individual.gender_id, (CASE WHEN (individual.birth_dt IS NULL) THEN NULL::double precision ELSE date_part('year'::text, age((('now'::cstring)::date)::timestamp with time zone, (individual.birth_dt)::timestamp with time zone)) END), (NULL::unknown), (NULL::unknown), s.ready_to_work_dt, s.ready_to_work_other_id, (CASE WHEN (COALESCE(s.is_eln, false) AND ((COALESCE(s.fss_state_code, ''::character varying))::text = ''::text)) THEN 'request'::text WHEN (COALESCE(s.is_eln, false) AND ((COALESCE(s.fss_state_code, ''::character varying))::text = ANY ('{010,020}'::text[])) AND (s.end_dt < ('now'::cstring)::date)) THEN 'expired'::text WHEN (COALESCE(s.is_eln, false) AND ((COALESCE(s.fss_state_code, ''::character varying))::text = ANY ('{010,020}'::text[]))) THEN 'opened'::text WHEN (COALESCE(s.is_eln, false) AND ((COALESCE(s.fss_state_code, ''::character varying))::text = '030'::text)) THEN 'closed'::text WHEN (COALESCE(s.is_eln, false) AND ((COALESCE(s.fss_state_code, ''::character varying))::text = '090'::text)) THEN 'annulled'::text WHEN ((NOT COALESCE(s.is_eln, false)) AND ((state.code)::text = ANY ('{1,2}'::text[])) AND (s.end_dt < ('now'::cstring)::date)) THEN 'expired'::text WHEN ((NOT COALESCE(s.is_eln, false)) AND ((state.code)::text = '1'::text)) THEN 'request'::text WHEN ((NOT COALESCE(s.is_eln, false)) AND ((state.code)::text = '2'::text)) THEN 'opened'::text WHEN ((NOT COALESCE(s.is_eln, false)) AND ((state.code)::text = '3'::text)) THEN 'closed'::text WHEN ((NOT COALESCE(s.is_eln, false)) AND ((state.code)::text = '4'::text)) THEN 'expired'::text WHEN ((NOT COALESCE(s.is_eln, false)) AND ((state.code)::text = '5'::text)) THEN 'annulled'::text ELSE NULL::text END), ((COALESCE(s.is_eln, false) AND ((COALESCE(s.fss_state_code, ''::character varying))::text <> ALL ('{"",090}'::text[])))), s.number, s.workplace_id, (COALESCE(s.workplace_print, (SubPlan 13))), s.workplace_type_id, ((s.number IS NULL)), s.workplace_type_id, ((s.workplace_type_id = 1)), s.transfer_from_clinic, (COALESCE((s.clinic_id <> 164), true)), ((s.registered_clinic_id = 164)), ((s.type_id = 1)), ((s.type_id = 2)), ((s.type_id = 3)), ((((rwo.code)::text = '31'::text) OR ((rwo.code)::text = '37'::text))), s.journal_id, s.state_id, (COALESCE(s.is_eln, false)), ((SubPlan 14)), s.fss_state_code, (((COALESCE(s.fss_state_code, ''::character varying))::text = '030'::text)), (((COALESCE(s.fss_state_code, ''::character varying))::text = '040'::text)), (((COALESCE(s.fss_state_code, ''::character varying))::text = '090'::text)), (((COALESCE(s.fss_state_code, ''::character varying))::text <> ''::text)), fss_request_state.id, fss_request_state.name, ("substring"(regexp_replace((fss_request.stacktrace)::text, '(Найдены.*Дополнительная информация: [\r\n])'::text, ''::text), 0, 399)), (COALESCE(s.is_from_fss, false)), (NULL::unknown), (NULL::unknown), (CASE WHEN (s.is_eln AND ((SubPlan 15) OR (((((s.hospital_from_dt IS NOT NULL) OR (s.hospital_to_dt IS NOT NULL)) AND (s.issue_dt >= COALESCE(s.hospital_from_dt, '-infinity'::date)) AND (s.issue_dt <= (COALESCE(s.hospital_to_dt, ('now'::cstring)::date) + '2 days'::interval))) OR (s.issue_dt <= s.begin_dt) OR (SubPlan 16)) IS FALSE) OR (((alternatives: SubPlan 17 or hashed SubPlan 18) OR ((s.issue_dt + '2 days'::interval) >= ('now'::cstring)::date) OR (SubPlan 19) OR (SubPlan 20) OR (NOT (SubPlan 21))) IS FALSE) OR (((5 = se.disability_reason_edited_id) OR ((5 = se.disability_reason_id) AND (se.disability_reason_edited_id IS NULL)) OR (SubPlan 22)) IS FALSE))) THEN 'Да'::text ELSE 'Нет'::text END), (CASE WHEN ((alternatives: SubPlan 23 or hashed SubPlan 24) OR ((state.code)::text = '3'::text)) THEN s.end_dt ELSE NULL::date END)
  • Sort Key: (CASE WHEN ((alternatives: SubPlan 23 or hashed SubPlan 24) OR ((state.code)::text = '3'::text)) THEN s.end_dt ELSE NULL::date END) DESC
  • Sort Method: top-N heapsort Memory: 30kB
  • Buffers: shared hit=1785022
7. 1,806.327 6,036.810 ↓ 3.0 19,913 1

Merge Left Join (cost=88,235.14..1,485,574.63 rows=6,703 width=718) (actual time=544.969..6,036.810 rows=19,913 loops=1)

  • Output: s.id, s.begin_dt, s.issue_dt, CASE WHEN ((state.code)::text = '3'::text) THEN (SubPlan 1) ELSE NULL::integer END, CASE WHEN ((state.code)::text = ANY ('{3,5}'::text[])) THEN COALESCE((SubPlan 2), (SubPlan 3)) ELSE NULL::text END, CASE WHEN ((SubPlan 4) OR ((state.code)::text = '3'::text)) THEN s.end_dt ELSE NULL::date END, CASE WHEN (s.type_id = 1) THEN s.days ELSE sickdoc.get_sickdoc_days_count(s.id) END, ((s.parent_id IS NOT NULL) AND ((type.code)::text <> '3'::text)), ((type.code)::text = '3'::text), ((state.code)::text = '5'::text), ((state.code)::text = '3'::text), (((SubPlan 5) AND ((state.code)::text = '3'::text)) OR (SubPlan 6)), ((state.code)::text = '2'::text), ((state.code)::text = '1'::text), (se.disability_reason_id = 5), s.clinic_id, $11, s.workplace_id, (SubPlan 9), COALESCE((SubPlan 10), (SubPlan 11)), s.clinic_id, s.registered_clinic_id, COALESCE((SubPlan 12), s.print_clinic), s_continue.number, s_continue.id, (s_continue.id IS NOT NULL), ((s.clinic_id IS NOT NULL) AND (s_continue.clinic_id IS NOT NULL) AND (s.clinic_id = s_continue.clinic_id)), sickdoc.sickdoc_has_max_available_count_of_periods(s.id), kind.code, s.parent_id, s.individual_id, concat(individual.surname, ((' '::text || "left"((individual.name)::text, 1)) || '.'::text), ((' '::text || "left"(CASE WHEN (btrim((individual.patr_name)::text) = ANY ('{"",NULL}'::text[])) THEN NULL::text ELSE btrim((individual.patr_name)::text) END, 1)) || '.'::text), ((' ('::text || to_char((individual.birth_dt)::timestamp with time zone, 'DD.MM.YYYY'::text)) || ')'::text)), individual.gender_id, CASE WHEN (individual.birth_dt IS NULL) THEN NULL::double precision ELSE date_part('year'::text, age((('now'::cstring)::date)::timestamp with time zone, (individual.birth_dt)::timestamp with time zone)) END, NULL::unknown, NULL::unknown, s.ready_to_work_dt, s.ready_to_work_other_id, CASE WHEN (COALESCE(s.is_eln, false) AND ((COALESCE(s.fss_state_code, ''::character varying))::text = ''::text)) THEN 'request'::text WHEN (COALESCE(s.is_eln, false) AND ((COALESCE(s.fss_state_code, ''::character varying))::text = ANY ('{010,020}'::text[])) AND (s.end_dt < ('now'::cstring)::date)) THEN 'expired'::text WHEN (COALESCE(s.is_eln, false) AND ((COALESCE(s.fss_state_code, ''::character varying))::text = ANY ('{010,020}'::text[]))) THEN 'opened'::text WHEN (COALESCE(s.is_eln, false) AND ((COALESCE(s.fss_state_code, ''::character varying))::text = '030'::text)) THEN 'closed'::text WHEN (COALESCE(s.is_eln, false) AND ((COALESCE(s.fss_state_code, ''::character varying))::text = '090'::text)) THEN 'annulled'::text WHEN ((NOT COALESCE(s.is_eln, false)) AND ((state.code)::text = ANY ('{1,2}'::text[])) AND (s.end_dt < ('now'::cstring)::date)) THEN 'expired'::text WHEN ((NOT COALESCE(s.is_eln, false)) AND ((state.code)::text = '1'::text)) THEN 'request'::text WHEN ((NOT COALESCE(s.is_eln, false)) AND ((state.code)::text = '2'::text)) THEN 'opened'::text WHEN ((NOT COALESCE(s.is_eln, false)) AND ((state.code)::text = '3'::text)) THEN 'closed'::text WHEN ((NOT COALESCE(s.is_eln, false)) AND ((state.code)::text = '4'::text)) THEN 'expired'::text WHEN ((NOT COALESCE(s.is_eln, false)) AND ((state.code)::text = '5'::text)) THEN 'annulled'::text ELSE NULL::text END, (COALESCE(s.is_eln, false) AND ((COALESCE(s.fss_state_code, ''::character varying))::text <> ALL ('{"",090}'::text[]))), s.number, s.workplace_id, COALESCE(s.workplace_print, (SubPlan 13)), s.workplace_type_id, (s.number IS NULL), s.workplace_type_id, (s.workplace_type_id = 1), s.transfer_from_clinic, COALESCE((s.clinic_id <> 164), true), (s.registered_clinic_id = 164), (s.type_id = 1), (s.type_id = 2), (s.type_id = 3), (((rwo.code)::text = '31'::text) OR ((rwo.code)::text = '37'::text)), s.journal_id, s.state_id, COALESCE(s.is_eln, false), (SubPlan 14), s.fss_state_code, ((COALESCE(s.fss_state_code, ''::character varying))::text = '030'::text), ((COALESCE(s.fss_state_code, ''::character varying))::text = '040'::text), ((COALESCE(s.fss_state_code, ''::character varying))::text = '090'::text), ((COALESCE(s.fss_state_code, ''::character varying))::text <> ''::text), fss_request_state.id, fss_request_state.name, "substring"(regexp_replace((fss_request.stacktrace)::text, '(Найдены.*Дополнительная информация: [\r\n])'::text, ''::text), 0, 399), COALESCE(s.is_from_fss, false), NULL::unknown, NULL::unknown, CASE WHEN (s.is_eln AND ((SubPlan 15) OR (((((s.hospital_from_dt IS NOT NULL) OR (s.hospital_to_dt IS NOT NULL)) AND (s.issue_dt >= COALESCE(s.hospital_from_dt, '-infinity'::date)) AND (s.issue_dt <= (COALESCE(s.hospital_to_dt, ('now'::cstring)::date) + '2 days'::interval))) OR (s.issue_dt <= s.begin_dt) OR (SubPlan 16)) IS FALSE) OR (((alternatives: SubPlan 17 or hashed SubPlan 18) OR ((s.issue_dt + '2 days'::interval) >= ('now'::cstring)::date) OR (SubPlan 19) OR (SubPlan 20) OR (NOT (SubPlan 21))) IS FALSE) OR (((5 = se.disability_reason_edited_id) OR ((5 = se.disability_reason_id) AND (se.disability_reason_edited_id IS NULL)) OR (SubPlan 22)) IS FALSE))) THEN 'Да'::text ELSE 'Нет'::text END, CASE WHEN ((alternatives: SubPlan 23 or hashed SubPlan 24) OR ((state.code)::text = '3'::text)) THEN s.end_dt ELSE NULL::date END
  • Merge Cond: (s.id = s_continue.parent_id)
  • Buffers: shared hit=1785022
8. 34.464 713.410 ↓ 3.0 19,913 1

Merge Left Join (cost=82,387.64..88,377.04 rows=6,703 width=698) (actual time=401.121..713.410 rows=19,913 loops=1)

  • Output: s.id, s.begin_dt, s.issue_dt, s.end_dt, s.type_id, s.days, s.parent_id, s.clinic_id, s.workplace_id, s.registered_clinic_id, s.print_clinic, s.individual_id, s.ready_to_work_dt, s.ready_to_work_other_id, s.is_eln, s.fss_state_code, s.number, s.workplace_print, s.workplace_type_id, s.transfer_from_clinic, s.journal_id, s.state_id, s.is_from_fss, s.hospital_from_dt, s.hospital_to_dt, se.disability_reason_id, se.disability_reason_edited_id, kind.code, individual.surname, individual.name, individual.patr_name, individual.birth_dt, individual.gender_id, state.code, type.code, rwo.code, fss_request.stacktrace, fss_request_state.id, fss_request_state.name
  • Merge Cond: (s.id = fss_request.sicklist_n2o_id)
  • Buffers: shared hit=91701
9. 26.329 249.092 ↓ 3.0 19,913 1

Sort (cost=54,769.85..54,786.61 rows=6,703 width=230) (actual time=241.667..249.092 rows=19,913 loops=1)

  • Output: s.id, s.begin_dt, s.issue_dt, s.end_dt, s.type_id, s.days, s.parent_id, s.clinic_id, s.workplace_id, s.registered_clinic_id, s.print_clinic, s.individual_id, s.ready_to_work_dt, s.ready_to_work_other_id, s.is_eln, s.fss_state_code, s.number, s.workplace_print, s.workplace_type_id, s.transfer_from_clinic, s.journal_id, s.state_id, s.is_from_fss, s.hospital_from_dt, s.hospital_to_dt, se.disability_reason_id, se.disability_reason_edited_id, kind.code, individual.surname, individual.name, individual.patr_name, individual.birth_dt, individual.gender_id, state.code, type.code, rwo.code
  • Sort Key: s.id
  • Sort Method: quicksort Memory: 6040kB
  • Buffers: shared hit=84914
10. 7.372 222.763 ↓ 3.0 19,913 1

Hash Left Join (cost=5,230.28..54,343.85 rows=6,703 width=230) (actual time=41.169..222.763 rows=19,913 loops=1)

  • Output: s.id, s.begin_dt, s.issue_dt, s.end_dt, s.type_id, s.days, s.parent_id, s.clinic_id, s.workplace_id, s.registered_clinic_id, s.print_clinic, s.individual_id, s.ready_to_work_dt, s.ready_to_work_other_id, s.is_eln, s.fss_state_code, s.number, s.workplace_print, s.workplace_type_id, s.transfer_from_clinic, s.journal_id, s.state_id, s.is_from_fss, s.hospital_from_dt, s.hospital_to_dt, se.disability_reason_id, se.disability_reason_edited_id, kind.code, individual.surname, individual.name, individual.patr_name, individual.birth_dt, individual.gender_id, state.code, type.code, rwo.code
  • Hash Cond: (s.ready_to_work_other_id = rwo.id)
  • Buffers: shared hit=84914
11. 7.317 215.385 ↓ 3.0 19,913 1

Nested Loop Left Join (cost=5,229.12..54,310.62 rows=6,703 width=227) (actual time=41.157..215.385 rows=19,913 loops=1)

  • Output: s.id, s.begin_dt, s.issue_dt, s.end_dt, s.type_id, s.days, s.parent_id, s.clinic_id, s.workplace_id, s.registered_clinic_id, s.print_clinic, s.individual_id, s.ready_to_work_dt, s.ready_to_work_other_id, s.is_eln, s.fss_state_code, s.number, s.workplace_print, s.workplace_type_id, s.transfer_from_clinic, s.journal_id, s.state_id, s.is_from_fss, s.hospital_from_dt, s.hospital_to_dt, se.disability_reason_id, se.disability_reason_edited_id, kind.code, individual.surname, individual.name, individual.patr_name, individual.birth_dt, individual.gender_id, state.code, type.code
  • Buffers: shared hit=84913
12. 7.012 108.503 ↓ 3.0 19,913 1

Hash Left Join (cost=5,228.69..8,900.56 rows=6,703 width=169) (actual time=41.130..108.503 rows=19,913 loops=1)

  • Output: s.id, s.begin_dt, s.issue_dt, s.end_dt, s.type_id, s.days, s.parent_id, s.clinic_id, s.workplace_id, s.registered_clinic_id, s.print_clinic, s.individual_id, s.ready_to_work_dt, s.ready_to_work_other_id, s.is_eln, s.fss_state_code, s.number, s.workplace_print, s.workplace_type_id, s.transfer_from_clinic, s.journal_id, s.state_id, s.is_from_fss, s.hospital_from_dt, s.hospital_to_dt, se.disability_reason_id, se.disability_reason_edited_id, kind.code, state.code, type.code
  • Hash Cond: (s.type_id = type.id)
  • Buffers: shared hit=5136
13. 6.477 101.484 ↓ 3.0 19,913 1

Hash Join (cost=5,227.62..8,807.32 rows=6,703 width=167) (actual time=41.109..101.484 rows=19,913 loops=1)

  • Output: s.id, s.begin_dt, s.issue_dt, s.end_dt, s.type_id, s.days, s.parent_id, s.clinic_id, s.workplace_id, s.registered_clinic_id, s.print_clinic, s.individual_id, s.ready_to_work_dt, s.ready_to_work_other_id, s.is_eln, s.fss_state_code, s.number, s.workplace_print, s.workplace_type_id, s.transfer_from_clinic, s.journal_id, s.state_id, s.is_from_fss, s.hospital_from_dt, s.hospital_to_dt, se.disability_reason_id, se.disability_reason_edited_id, kind.code, state.code
  • Hash Cond: (s.state_id = state.id)
  • Buffers: shared hit=5135
14. 41.860 94.996 ↓ 3.0 19,913 1

Hash Join (cost=5,226.51..8,714.05 rows=6,703 width=165) (actual time=41.089..94.996 rows=19,913 loops=1)

  • Output: s.id, s.begin_dt, s.issue_dt, s.end_dt, s.type_id, s.days, s.parent_id, s.clinic_id, s.workplace_id, s.registered_clinic_id, s.print_clinic, s.individual_id, s.ready_to_work_dt, s.ready_to_work_other_id, s.is_eln, s.fss_state_code, s.number, s.workplace_print, s.workplace_type_id, s.transfer_from_clinic, s.journal_id, s.state_id, s.is_from_fss, s.hospital_from_dt, s.hospital_to_dt, se.disability_reason_id, se.disability_reason_edited_id, kind.code
  • Hash Cond: (se.id = s.id)
  • Buffers: shared hit=5134
15. 12.123 12.123 ↑ 1.0 124,819 1

Seq Scan on sickdoc.sickdoc_extended se (cost=0.00..2,949.64 rows=125,564 width=12) (actual time=0.001..12.123 rows=124,819 loops=1)

  • Output: se.id, se.address_id, se.disability_from_dt, se.disability_reason_edited_id, se.disability_reason_ext_id, se.disability_reason_id, se.disability_to_dt, se.family_member_1_id, se.family_member_2_id, se.is_disability_group_changed, se.is_early_pregnancy_register, se.mse_emp, se.mse_examination_dt, se.mse_org_id, se.mse_referral_dt, se.mse_register_dt, se.on_placement_service, se.regimen_id, se.regimen_violation_doctor_id, se.regimen_violation_dt, se.regimen_violation_id, se.sanatorium_id, se.sanatorium_ogrn_code, se.voucher_code, se.aud_who, se.aud_when, se.aud_source, se.aud_who_create, se.aud_when_create, se.aud_source_create, se.family_member_1_relation_id_lsd, se.family_member_1_age_lsd, se.family_member_1_age_month_lsd, se.family_member_1_name_lsd, se.family_member_2_relation_id_lsd, se.family_member_2_age_lsd, se.family_member_2_age_month_lsd, se.family_member_2_name_lsd, se.disability_group
  • Buffers: shared hit=1694
16. 8.022 41.013 ↓ 3.0 19,913 1

Hash (cost=5,142.72..5,142.72 rows=6,703 width=157) (actual time=41.013..41.013 rows=19,913 loops=1)

  • Output: s.id, s.begin_dt, s.issue_dt, s.end_dt, s.type_id, s.days, s.parent_id, s.clinic_id, s.workplace_id, s.registered_clinic_id, s.print_clinic, s.individual_id, s.ready_to_work_dt, s.ready_to_work_other_id, s.is_eln, s.fss_state_code, s.number, s.workplace_print, s.workplace_type_id, s.transfer_from_clinic, s.journal_id, s.state_id, s.is_from_fss, s.hospital_from_dt, s.hospital_to_dt, kind.code
  • Buckets: 32768 (originally 8192) Batches: 1 (originally 1) Memory Usage: 2916kB
  • Buffers: shared hit=3440
17. 11.192 32.991 ↓ 3.0 19,913 1

Hash Join (cost=1.05..5,142.72 rows=6,703 width=157) (actual time=0.020..32.991 rows=19,913 loops=1)

  • Output: s.id, s.begin_dt, s.issue_dt, s.end_dt, s.type_id, s.days, s.parent_id, s.clinic_id, s.workplace_id, s.registered_clinic_id, s.print_clinic, s.individual_id, s.ready_to_work_dt, s.ready_to_work_other_id, s.is_eln, s.fss_state_code, s.number, s.workplace_print, s.workplace_type_id, s.transfer_from_clinic, s.journal_id, s.state_id, s.is_from_fss, s.hospital_from_dt, s.hospital_to_dt, kind.code
  • Hash Cond: (s.kind_id = kind.id)
  • Buffers: shared hit=3440
18. 21.795 21.795 ↑ 1.0 19,913 1

Seq Scan on sickdoc.sickdoc s (cost=0.00..4,999.24 rows=20,108 width=163) (actual time=0.010..21.795 rows=19,913 loops=1)

  • Output: s.id, s.begin_dt, s.case_id, s.clinic_id, s.days, s.end_dt, s.final_diagnosis_id, s.hospital_from_dt, s.hospital_to_dt, s.individual_id, s.initial_diagnosis_id, s.issue_dt, s.journal_id, s.kind_id, s.number, s.parent_id, s.ready_to_work_dt, s.ready_to_work_other_dt, s.ready_to_work_other_id, s.registrator_id, s.state_id, s.transfer_to_o_clinic, s.transfer_from_clinic, s.workplace_id, s.workplace_print, s.workplace_type_id, s.type_id, s.aud_who, s.aud_when, s.aud_source, s.aud_who_create, s.aud_when_create, s.aud_source_create, s.md_sicklist_id, s.registered_clinic_id, s.is_eln, s.is_print, s.range_id, s.ln_result_signature, s.hospital_breach_signature, s.fss_state_code, s.eln_hash, s.annual_reason_id, s.fss_annual_reason_comment, s.fss_annual_reason_id, s.print_clinic, s.parent_number_print, s.main_job_print_number, s.is_from_fss, s.print_clinic_ogrn, s.print_clinic_address
  • Filter: (s.clinic_id = 164)
  • Rows Removed by Filter: 104906
  • Buffers: shared hit=3439
19. 0.000 0.004 ↑ 1.0 1 1

Hash (cost=1.04..1.04 rows=1 width=6) (actual time=0.004..0.004 rows=1 loops=1)

  • Output: kind.code, kind.id
  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=1
20. 0.004 0.004 ↑ 1.0 1 1

Seq Scan on sickdoc.rf_kind kind (cost=0.00..1.04 rows=1 width=6) (actual time=0.003..0.004 rows=1 loops=1)

  • Output: kind.code, kind.id
  • Filter: ((kind.code)::text = '1'::text)
  • Rows Removed by Filter: 2
  • Buffers: shared hit=1
21. 0.004 0.011 ↑ 1.0 5 1

Hash (cost=1.05..1.05 rows=5 width=6) (actual time=0.011..0.011 rows=5 loops=1)

  • Output: state.code, state.id
  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=1
22. 0.007 0.007 ↑ 1.0 5 1

Seq Scan on public.md_sicklist_state state (cost=0.00..1.05 rows=5 width=6) (actual time=0.005..0.007 rows=5 loops=1)

  • Output: state.code, state.id
  • Buffers: shared hit=1
23. 0.003 0.007 ↑ 1.0 3 1

Hash (cost=1.03..1.03 rows=3 width=6) (actual time=0.007..0.007 rows=3 loops=1)

  • Output: type.code, type.id
  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=1
24. 0.004 0.004 ↑ 1.0 3 1

Seq Scan on public.md_sicklist_type type (cost=0.00..1.03 rows=3 width=6) (actual time=0.003..0.004 rows=3 loops=1)

  • Output: type.code, type.id
  • Buffers: shared hit=1
25. 99.565 99.565 ↑ 1.0 1 19,913

Index Scan using pim_individual_pk on public.pim_individual individual (cost=0.43..6.76 rows=1 width=62) (actual time=0.004..0.005 rows=1 loops=19,913)

  • Output: individual.id, individual.birth_dt, individual.death_dt, individual.has_citizenship, individual.name, individual.patr_name, individual.surname, individual.gender_id, individual.nationality_id, individual.list_identity_doc, individual.list_oms_doc, individual.list_job_org, individual.list_reg_name, individual.list_snils, individual.list_uid, individual.aud_who, individual.aud_when, individual.aud_source, individual.aud_who_create, individual.aud_when_create, individual.aud_source_create, individual.birth_place, individual.age_year, individual.age_month, individual.age_day, individual.list_main_contact
  • Index Cond: (individual.id = s.individual_id)
  • Buffers: shared hit=79777
26. 0.004 0.006 ↑ 1.0 7 1

Hash (cost=1.07..1.07 rows=7 width=7) (actual time=0.006..0.006 rows=7 loops=1)

  • Output: rwo.code, rwo.id
  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=1
27. 0.002 0.002 ↑ 1.0 7 1

Seq Scan on public.md_sl_readytowork_other rwo (cost=0.00..1.07 rows=7 width=7) (actual time=0.002..0.002 rows=7 loops=1)

  • Output: rwo.code, rwo.id
  • Buffers: shared hit=1
28. 14.137 429.854 ↓ 53.5 56,569 1

Materialize (cost=27,617.79..34,561.57 rows=1,058 width=472) (actual time=159.445..429.854 rows=56,569 loops=1)

  • Output: fss_request.stacktrace, fss_request.sicklist_n2o_id, fss_request_state.id, fss_request_state.name
  • Buffers: shared hit=6787
29. 62.159 415.717 ↓ 53.5 56,569 1

Nested Loop Left Join (cost=27,617.79..34,558.93 rows=1,058 width=472) (actual time=159.438..415.717 rows=56,569 loops=1)

  • Output: fss_request.stacktrace, fss_request.sicklist_n2o_id, fss_request_state.id, fss_request_state.name
  • Join Filter: (fss_request_state.id = fss_request.state_id)
  • Rows Removed by Join Filter: 169707
  • Buffers: shared hit=6787
30. 24.018 353.558 ↓ 53.5 56,569 1

Subquery Scan on fss_request (cost=27,617.79..34,494.40 rows=1,058 width=447) (actual time=159.411..353.558 rows=56,569 loops=1)

  • Output: fss_request.id, fss_request.uid, fss_request.type_id, fss_request.state_id, fss_request.initiator_id, fss_request.org_id, fss_request.eln_number, fss_request.eln_number_range, fss_request.create_dt, fss_request.receive_resp_dt, fss_request.request_text, fss_request.response_text, fss_request.stacktrace, fss_request.platform, fss_request.sicklist_n2o_id, fss_request.params, fss_request.aud_who, fss_request.aud_when, fss_request.aud_source, fss_request.aud_who_create, fss_request.aud_when_create, fss_request.aud_source_create, fss_request.rn
  • Filter: (fss_request.rn = 1)
  • Rows Removed by Filter: 111869
  • Buffers: shared hit=6786
31. 132.238 329.540 ↑ 1.3 168,438 1

WindowAgg (cost=27,617.79..31,849.55 rows=211,588 width=455) (actual time=159.393..329.540 rows=168,438 loops=1)

  • Output: NULL::integer, NULL::character varying, NULL::integer, r.state_id, NULL::integer, NULL::integer, NULL::character varying, NULL::character varying, r.create_dt, NULL::timestamp without time zone, NULL::character varying, NULL::character varying, r.stacktrace, NULL::integer, r.sicklist_n2o_id, NULL::json, NULL::character varying, NULL::timestamp without time zone, NULL::character varying, NULL::character varying, NULL::timestamp without time zone, NULL::character varying, row_number() OVER (?)
  • Buffers: shared hit=6786
32. 139.111 197.302 ↑ 1.3 168,438 1

Sort (cost=27,617.79..28,146.76 rows=211,588 width=455) (actual time=159.371..197.302 rows=168,438 loops=1)

  • Output: r.create_dt, r.sicklist_n2o_id, r.state_id, r.stacktrace
  • Sort Key: r.sicklist_n2o_id, r.create_dt DESC NULLS LAST
  • Sort Method: quicksort Memory: 33785kB
  • Buffers: shared hit=6786
33. 58.191 58.191 ↑ 1.1 196,181 1

Seq Scan on sickdoc.fss_request r (cost=0.00..8,901.88 rows=211,588 width=455) (actual time=0.005..58.191 rows=196,181 loops=1)

  • Output: r.create_dt, r.sicklist_n2o_id, r.state_id, r.stacktrace
  • Buffers: shared hit=6786
34. 0.000 0.000 ↑ 1.0 4 56,569

Materialize (cost=0.00..1.06 rows=4 width=29) (actual time=0.000..0.000 rows=4 loops=56,569)

  • Output: fss_request_state.id, fss_request_state.name
  • Buffers: shared hit=1
35. 0.014 0.014 ↑ 1.0 4 1

Seq Scan on sickdoc.fss_request_state (cost=0.00..1.04 rows=4 width=29) (actual time=0.014..0.014 rows=4 loops=1)

  • Output: fss_request_state.id, fss_request_state.name
  • Buffers: shared hit=1
36. 6.553 87.312 ↓ 184.0 11,407 1

Materialize (cost=5,847.51..6,221.73 rows=62 width=24) (actual time=46.340..87.312 rows=11,407 loops=1)

  • Output: s_continue.id, s_continue.begin_dt, s_continue.case_id, s_continue.clinic_id, s_continue.days, s_continue.end_dt, s_continue.final_diagnosis_id, s_continue.hospital_from_dt, s_continue.hospital_to_dt, s_continue.individual_id, s_continue.initial_diagnosis_id, s_continue.issue_dt, s_continue.journal_id, s_continue.kind_id, s_continue.number, s_continue.parent_id, s_continue.ready_to_work_dt, s_continue.ready_to_work_other_dt, s_continue.ready_to_work_other_id, s_continue.registrator_id, s_continue.state_id, s_continue.transfer_to_o_clinic, s_continue.transfer_from_clinic, s_continue.workplace_id, s_continue.workplace_print, s_continue.workplace_type_id, s_continue.type_id, s_continue.aud_who, s_continue.aud_when, s_continue.aud_source, s_continue.aud_who_create, s_continue.aud_when_create, s_continue.aud_source_create, s_continue.md_sicklist_id, s_continue.registered_clinic_id, s_continue.is_eln, s_continue.is_print, s_continue.range_id, s_continue.ln_result_signature, s_continue.hospital_breach_signature, s_continue.fss_state_code, s_continue.eln_hash, s_continue.annual_reason_id, s_continue.fss_annual_reason_comment, s_continue.fss_annual_reason_id, s_continue.print_clinic, s_continue.parent_number_print, s_continue.main_job_print_number, s_continue.is_from_fss, s_continue.print_clinic_ogrn, s_continue.print_clinic_address, s_continue.rn
  • Buffers: shared hit=3439
37. 4.181 80.759 ↓ 184.0 11,407 1

Subquery Scan on s_continue (cost=5,847.51..6,221.58 rows=62 width=24) (actual time=46.337..80.759 rows=11,407 loops=1)

  • Output: s_continue.id, s_continue.begin_dt, s_continue.case_id, s_continue.clinic_id, s_continue.days, s_continue.end_dt, s_continue.final_diagnosis_id, s_continue.hospital_from_dt, s_continue.hospital_to_dt, s_continue.individual_id, s_continue.initial_diagnosis_id, s_continue.issue_dt, s_continue.journal_id, s_continue.kind_id, s_continue.number, s_continue.parent_id, s_continue.ready_to_work_dt, s_continue.ready_to_work_other_dt, s_continue.ready_to_work_other_id, s_continue.registrator_id, s_continue.state_id, s_continue.transfer_to_o_clinic, s_continue.transfer_from_clinic, s_continue.workplace_id, s_continue.workplace_print, s_continue.workplace_type_id, s_continue.type_id, s_continue.aud_who, s_continue.aud_when, s_continue.aud_source, s_continue.aud_who_create, s_continue.aud_when_create, s_continue.aud_source_create, s_continue.md_sicklist_id, s_continue.registered_clinic_id, s_continue.is_eln, s_continue.is_print, s_continue.range_id, s_continue.ln_result_signature, s_continue.hospital_breach_signature, s_continue.fss_state_code, s_continue.eln_hash, s_continue.annual_reason_id, s_continue.fss_annual_reason_comment, s_continue.fss_annual_reason_id, s_continue.print_clinic, s_continue.parent_number_print, s_continue.main_job_print_number, s_continue.is_from_fss, s_continue.print_clinic_ogrn, s_continue.print_clinic_address, s_continue.rn
  • Filter: (s_continue.rn = 1)
  • Rows Removed by Filter: 17
  • Buffers: shared hit=3439
38. 26.240 76.578 ↑ 1.1 11,424 1

WindowAgg (cost=5,847.51..6,065.71 rows=12,469 width=24) (actual time=46.323..76.578 rows=11,424 loops=1)

  • Output: c.id, NULL::date, NULL::integer, c.clinic_id, NULL::integer, NULL::date, NULL::integer, NULL::date, NULL::date, NULL::integer, NULL::integer, NULL::date, NULL::integer, NULL::integer, c.number, c.parent_id, NULL::date, NULL::date, NULL::integer, NULL::integer, NULL::integer, NULL::boolean, NULL::boolean, NULL::integer, NULL::character varying, NULL::integer, NULL::integer, NULL::character varying, NULL::timestamp without time zone, NULL::character varying, NULL::character varying, NULL::timestamp without time zone, NULL::character varying, NULL::integer, NULL::integer, NULL::boolean, NULL::boolean, NULL::integer, NULL::character varying, NULL::character varying, NULL::character varying, NULL::character varying, NULL::integer, NULL::character varying, NULL::integer, NULL::character varying(200), NULL::character varying(20), NULL::character varying(20), NULL::boolean, NULL::character varying(255), NULL::character varying(2000), row_number() OVER (?)
  • Buffers: shared hit=3439
39. 7.781 50.338 ↑ 1.1 11,424 1

Sort (cost=5,847.51..5,878.68 rows=12,469 width=24) (actual time=46.306..50.338 rows=11,424 loops=1)

  • Output: c.parent_id, c.id, c.clinic_id, c.number
  • Sort Key: c.parent_id
  • Sort Method: quicksort Memory: 1334kB
  • Buffers: shared hit=3439
40. 42.557 42.557 ↑ 1.0 12,161 1

Seq Scan on sickdoc.sickdoc c (cost=0.00..4,999.24 rows=12,469 width=24) (actual time=0.008..42.557 rows=12,161 loops=1)

  • Output: c.parent_id, c.id, c.clinic_id, c.number
  • Filter: (c.type_id = 2)
  • Rows Removed by Filter: 112658
  • Buffers: shared hit=3439
41.          

SubPlan (forMerge Left Join)

42. 13.275 146.025 ↑ 1.0 1 13,275

Limit (cost=8.50..8.50 rows=1 width=8) (actual time=0.011..0.011 rows=1 loops=13,275)

  • Output: p.issued_employee_id, p.from_dt
  • Buffers: shared hit=65635
43. 53.100 132.750 ↑ 2.0 1 13,275

Sort (cost=8.50..8.50 rows=2 width=8) (actual time=0.010..0.010 rows=1 loops=13,275)

  • Output: p.issued_employee_id, p.from_dt
  • Sort Key: p.from_dt DESC
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=65635
44. 79.650 79.650 ↑ 1.0 2 13,275

Index Scan using period_sickdoc_id_ix on sickdoc.period p (cost=0.42..8.49 rows=2 width=8) (actual time=0.005..0.006 rows=2 loops=13,275)

  • Output: p.issued_employee_id, p.from_dt
  • Index Cond: (p.sickdoc_id = s.id)
  • Buffers: shared hit=65635
45. 13.549 596.156 ↑ 1.0 1 13,549

Limit (cost=37.74..37.74 rows=1 width=105) (actual time=0.044..0.044 rows=1 loops=13,549)

  • Output: (concat(i.surname, ((' '::text || "left"((i.name)::text, 1)) || '.'::text), ((' '::text || "left"((i.patr_name)::text, 1)) || '.'::text), (', '::text || (pp.name)::text))), p_1.from_dt
  • Buffers: shared hit=423283
46. 27.098 582.607 ↑ 2.0 1 13,549

Sort (cost=37.74..37.74 rows=2 width=105) (actual time=0.043..0.043 rows=1 loops=13,549)

  • Output: (concat(i.surname, ((' '::text || "left"((i.name)::text, 1)) || '.'::text), ((' '::text || "left"((i.patr_name)::text, 1)) || '.'::text), (', '::text || (pp.name)::text))), p_1.from_dt
  • Sort Key: p_1.from_dt DESC
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=423283
47. 120.689 555.509 ↑ 1.0 2 13,549

Nested Loop (cost=1.72..37.73 rows=2 width=105) (actual time=0.024..0.041 rows=2 loops=13,549)

  • Output: concat(i.surname, ((' '::text || "left"((i.name)::text, 1)) || '.'::text), ((' '::text || "left"((i.patr_name)::text, 1)) || '.'::text), (', '::text || (pp.name)::text)), p_1.from_dt
  • Buffers: shared hit=423283
48. 26.472 325.176 ↑ 1.0 2 13,549

Nested Loop (cost=1.29..26.62 rows=2 width=59) (actual time=0.015..0.024 rows=2 loops=13,549)

  • Output: p_1.from_dt, pp.name, e.individual_id
  • Buffers: shared hit=313639
49. 40.021 243.882 ↑ 1.0 2 13,549

Nested Loop (cost=1.00..25.89 rows=2 width=59) (actual time=0.011..0.018 rows=2 loops=13,549)

  • Output: p_1.from_dt, ep.employee_id, pp.name
  • Buffers: shared hit=231331
50. 26.156 149.039 ↑ 1.0 2 13,549

Nested Loop (cost=0.71..25.12 rows=2 width=12) (actual time=0.007..0.011 rows=2 loops=13,549)

  • Output: p_1.from_dt, ep.position_id, ep.employee_id
  • Buffers: shared hit=149098
51. 40.647 40.647 ↑ 1.0 2 13,549

Index Scan using period_sickdoc_id_ix on sickdoc.period p_1 (cost=0.42..8.49 rows=2 width=8) (actual time=0.002..0.003 rows=2 loops=13,549)

  • Output: p_1.id, p_1.clinic_id, p_1.from_dt, p_1.issued_employee_id, p_1.issued_employee_position, p_1.sickdoc_id, p_1.step_id, p_1.to_dt, p_1.witness_employee_id, p_1.witness_employee_position, p_1.aud_who, p_1.aud_when, p_1.aud_source, p_1.aud_who_create, p_1.aud_when_create, p_1.aud_source_create, p_1.signature_num, p_1.doctor_signature, p_1.chairman_signature, p_1.is_sent_to_fss, p_1.witness_employee_print, p_1.issued_employee_print
  • Index Cond: (p_1.sickdoc_id = s.id)
  • Buffers: shared hit=66865
52. 82.236 82.236 ↑ 1.0 1 27,412

Index Scan using pim_employee_position_pk on public.pim_employee_position ep (cost=0.29..8.31 rows=1 width=12) (actual time=0.003..0.003 rows=1 loops=27,412)

  • Output: ep.id, ep.dismissal_order_code, ep.start_date, ep.hiring_order_code, ep.rate, ep.end_date, ep.dismissal_reason_id, ep.employee_id, ep.employment_type_id, ep.hiring_type_id, ep.position_id, ep.position_type_id, ep.unit_id, ep.code, ep.aud_who, ep.aud_when, ep.aud_source, ep.aud_who_create, ep.aud_when_create, ep.aud_source_create, ep.pref_prescription, ep.extra_payment, ep.target_training, ep.leaving_reason_id
  • Index Cond: (ep.id = p_1.issued_employee_id)
  • Buffers: shared hit=82233
53. 54.822 54.822 ↑ 1.0 1 27,411

Index Scan using pim_position_pk on public.pim_position pp (cost=0.29..0.37 rows=1 width=55) (actual time=0.002..0.002 rows=1 loops=27,411)

  • Output: pp.id, pp.code, pp.start_date, pp.name, pp.end_date, pp.department_id, pp.organization_id, pp.role_id, pp.speciality_id, pp.rate, pp.aud_who, pp.aud_when, pp.aud_source, pp.aud_who_create, pp.aud_when_create, pp.aud_source_create, pp.pref_prescription, pp.payment_fond, pp.staff_event1, pp.staff_event2
  • Index Cond: (pp.id = ep.position_id)
  • Buffers: shared hit=82233
54. 54.822 54.822 ↑ 1.0 1 27,411

Index Scan using pim_employee_pk on public.pim_employee e (cost=0.29..0.36 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=27,411)

  • Output: e.id, e.note, e.number, e.photo, e.callup_subject_id, e.individual_id, e.organization_id, e.is_dismissed, e.employment_dt, e.dismissal_dt, e.aud_who, e.aud_when, e.aud_source, e.aud_who_create, e.aud_when_create, e.aud_source_create, e.accreditation_id
  • Index Cond: (e.id = ep.employee_id)
  • Buffers: shared hit=82308
55. 109.644 109.644 ↑ 1.0 1 27,411

Index Scan using pim_individual_pk on public.pim_individual i (cost=0.43..5.52 rows=1 width=54) (actual time=0.004..0.004 rows=1 loops=27,411)

  • Output: i.id, i.birth_dt, i.death_dt, i.has_citizenship, i.name, i.patr_name, i.surname, i.gender_id, i.nationality_id, i.list_identity_doc, i.list_oms_doc, i.list_job_org, i.list_reg_name, i.list_snils, i.list_uid, i.aud_who, i.aud_when, i.aud_source, i.aud_who_create, i.aud_when_create, i.aud_source_create, i.birth_place, i.age_year, i.age_month, i.age_day, i.list_main_contact
  • Index Cond: (i.id = e.individual_id)
  • Buffers: shared hit=109644
56. 0.000 0.000 ↓ 0.0 0

Limit (cost=8.51..8.51 rows=1 width=45) (never executed)

  • Output: ((((p_2.issued_employee_print)::text || ' '::text) || (p_2.issued_employee_position)::text)), p_2.from_dt
57. 0.000 0.000 ↓ 0.0 0

Sort (cost=8.51..8.51 rows=2 width=45) (never executed)

  • Output: ((((p_2.issued_employee_print)::text || ' '::text) || (p_2.issued_employee_position)::text)), p_2.from_dt
  • Sort Key: p_2.from_dt DESC
58. 0.000 0.000 ↓ 0.0 0

Index Scan using period_sickdoc_id_ix on sickdoc.period p_2 (cost=0.42..8.50 rows=2 width=45) (never executed)

  • Output: (((p_2.issued_employee_print)::text || ' '::text) || (p_2.issued_employee_position)::text), p_2.from_dt
  • Index Cond: (p_2.sickdoc_id = s.id)
59. 39.826 99.565 ↑ 1.0 1 19,913

Aggregate (cost=8.46..8.47 rows=1 width=0) (actual time=0.005..0.005 rows=1 loops=19,913)

  • Output: (count(1) > 1)
  • Buffers: shared hit=63236
60. 59.739 59.739 ↑ 1.0 2 19,913

Index Only Scan using period_sickdoc_id_ix on sickdoc.period (cost=0.42..8.46 rows=2 width=0) (actual time=0.003..0.003 rows=2 loops=19,913)

  • Output: period.sickdoc_id
  • Index Cond: (period.sickdoc_id = s.id)
  • Heap Fetches: 3501
  • Buffers: shared hit=63236
61. 59.739 59.739 ↑ 1.0 1 19,913

Seq Scan on public.md_sl_disability_reason _sdr (cost=0.00..1.19 rows=1 width=3) (actual time=0.002..0.003 rows=1 loops=19,913)

  • Output: ((_sdr.code)::text = '05'::text)
  • Filter: (_sdr.id = se.disability_reason_id)
  • Rows Removed by Filter: 14
  • Buffers: shared hit=19913
62. 39.826 39.826 ↑ 1.0 1 19,913

Seq Scan on public.md_sl_disability_reason _sdr_1 (cost=0.00..1.19 rows=1 width=3) (actual time=0.001..0.002 rows=1 loops=19,913)

  • Output: ((_sdr_1.code)::text <> '05'::text)
  • Filter: (_sdr_1.id = se.disability_reason_id)
  • Rows Removed by Filter: 14
  • Buffers: shared hit=19913
63. 19.913 179.217 ↑ 1.0 1 19,913

Limit (cost=8.50..8.50 rows=1 width=8) (actual time=0.009..0.009 rows=1 loops=19,913)

  • Output: p_3.issued_employee_id, p_3.from_dt
  • Buffers: shared hit=94077
64. 79.652 159.304 ↑ 2.0 1 19,913

Sort (cost=8.50..8.50 rows=2 width=8) (actual time=0.008..0.008 rows=1 loops=19,913)

  • Output: p_3.issued_employee_id, p_3.from_dt
  • Sort Key: p_3.from_dt
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=94077
65. 79.652 79.652 ↑ 1.0 2 19,913

Index Scan using period_sickdoc_id_ix on sickdoc.period p_3 (cost=0.42..8.49 rows=2 width=8) (actual time=0.003..0.004 rows=2 loops=19,913)

  • Output: p_3.issued_employee_id, p_3.from_dt
  • Index Cond: (p_3.sickdoc_id = s.id)
  • Buffers: shared hit=94077
66. 19.913 696.955 ↑ 1.0 1 19,913

Limit (cost=37.74..37.74 rows=1 width=105) (actual time=0.035..0.035 rows=1 loops=19,913)

  • Output: (concat(i_1.surname, ((' '::text || "left"((i_1.name)::text, 1)) || '.'::text), ((' '::text || "left"((i_1.patr_name)::text, 1)) || '.'::text), (', '::text || (pp_1.name)::text))), p_4.from_dt
  • Buffers: shared hit=541423
67. 39.826 677.042 ↑ 2.0 1 19,913

Sort (cost=37.74..37.74 rows=2 width=105) (actual time=0.034..0.034 rows=1 loops=19,913)

  • Output: (concat(i_1.surname, ((' '::text || "left"((i_1.name)::text, 1)) || '.'::text), ((' '::text || "left"((i_1.patr_name)::text, 1)) || '.'::text), (', '::text || (pp_1.name)::text))), p_4.from_dt
  • Sort Key: p_4.from_dt
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=541423
68. 155.663 637.216 ↑ 1.0 2 19,913

Nested Loop (cost=1.72..37.73 rows=2 width=105) (actual time=0.019..0.032 rows=2 loops=19,913)

  • Output: concat(i_1.surname, ((' '::text || "left"((i_1.name)::text, 1)) || '.'::text), ((' '::text || "left"((i_1.patr_name)::text, 1)) || '.'::text), (', '::text || (pp_1.name)::text)), p_4.from_dt
  • Buffers: shared hit=541423
69. 30.761 378.347 ↑ 1.0 2 19,913

Nested Loop (cost=1.29..26.62 rows=2 width=59) (actual time=0.012..0.019 rows=2 loops=19,913)

  • Output: p_4.from_dt, pp_1.name, e_1.individual_id
  • Buffers: shared hit=403815
70. 30.761 278.782 ↑ 1.0 2 19,913

Nested Loop (cost=1.00..25.89 rows=2 width=59) (actual time=0.009..0.014 rows=2 loops=19,913)

  • Output: p_4.from_dt, ep_1.employee_id, pp_1.name
  • Buffers: shared hit=300489
71. 47.536 179.217 ↑ 1.0 2 19,913

Nested Loop (cost=0.71..25.12 rows=2 width=12) (actual time=0.006..0.009 rows=2 loops=19,913)

  • Output: p_4.from_dt, ep_1.position_id, ep_1.employee_id
  • Buffers: shared hit=197283
72. 59.739 59.739 ↑ 1.0 2 19,913

Index Scan using period_sickdoc_id_ix on sickdoc.period p_4 (cost=0.42..8.49 rows=2 width=8) (actual time=0.002..0.003 rows=2 loops=19,913)

  • Output: p_4.id, p_4.clinic_id, p_4.from_dt, p_4.issued_employee_id, p_4.issued_employee_position, p_4.sickdoc_id, p_4.step_id, p_4.to_dt, p_4.witness_employee_id, p_4.witness_employee_position, p_4.aud_who, p_4.aud_when, p_4.aud_source, p_4.aud_who_create, p_4.aud_when_create, p_4.aud_source_create, p_4.signature_num, p_4.doctor_signature, p_4.chairman_signature, p_4.is_sent_to_fss, p_4.witness_employee_print, p_4.issued_employee_print
  • Index Cond: (p_4.sickdoc_id = s.id)
  • Buffers: shared hit=94077
73. 71.942 71.942 ↑ 1.0 1 35,971

Index Scan using pim_employee_position_pk on public.pim_employee_position ep_1 (cost=0.29..8.31 rows=1 width=12) (actual time=0.002..0.002 rows=1 loops=35,971)

  • Output: ep_1.id, ep_1.dismissal_order_code, ep_1.start_date, ep_1.hiring_order_code, ep_1.rate, ep_1.end_date, ep_1.dismissal_reason_id, ep_1.employee_id, ep_1.employment_type_id, ep_1.hiring_type_id, ep_1.position_id, ep_1.position_type_id, ep_1.unit_id, ep_1.code, ep_1.aud_who, ep_1.aud_when, ep_1.aud_source, ep_1.aud_who_create, ep_1.aud_when_create, ep_1.aud_source_create, ep_1.pref_prescription, ep_1.extra_payment, ep_1.target_training, ep_1.leaving_reason_id
  • Index Cond: (ep_1.id = p_4.issued_employee_id)
  • Buffers: shared hit=103206
74. 68.804 68.804 ↑ 1.0 1 34,402

Index Scan using pim_position_pk on public.pim_position pp_1 (cost=0.29..0.37 rows=1 width=55) (actual time=0.002..0.002 rows=1 loops=34,402)

  • Output: pp_1.id, pp_1.code, pp_1.start_date, pp_1.name, pp_1.end_date, pp_1.department_id, pp_1.organization_id, pp_1.role_id, pp_1.speciality_id, pp_1.rate, pp_1.aud_who, pp_1.aud_when, pp_1.aud_source, pp_1.aud_who_create, pp_1.aud_when_create, pp_1.aud_source_create, pp_1.pref_prescription, pp_1.payment_fond, pp_1.staff_event1, pp_1.staff_event2
  • Index Cond: (pp_1.id = ep_1.position_id)
  • Buffers: shared hit=103206
75. 68.804 68.804 ↑ 1.0 1 34,402

Index Scan using pim_employee_pk on public.pim_employee e_1 (cost=0.29..0.36 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=34,402)

  • Output: e_1.id, e_1.note, e_1.number, e_1.photo, e_1.callup_subject_id, e_1.individual_id, e_1.organization_id, e_1.is_dismissed, e_1.employment_dt, e_1.dismissal_dt, e_1.aud_who, e_1.aud_when, e_1.aud_source, e_1.aud_who_create, e_1.aud_when_create, e_1.aud_source_create, e_1.accreditation_id
  • Index Cond: (e_1.id = ep_1.employee_id)
  • Buffers: shared hit=103326
76. 103.206 103.206 ↑ 1.0 1 34,402

Index Scan using pim_individual_pk on public.pim_individual i_1 (cost=0.43..5.52 rows=1 width=54) (actual time=0.003..0.003 rows=1 loops=34,402)

  • Output: i_1.id, i_1.birth_dt, i_1.death_dt, i_1.has_citizenship, i_1.name, i_1.patr_name, i_1.surname, i_1.gender_id, i_1.nationality_id, i_1.list_identity_doc, i_1.list_oms_doc, i_1.list_job_org, i_1.list_reg_name, i_1.list_snils, i_1.list_uid, i_1.aud_who, i_1.aud_when, i_1.aud_source, i_1.aud_who_create, i_1.aud_when_create, i_1.aud_source_create, i_1.birth_place, i_1.age_year, i_1.age_month, i_1.age_day, i_1.list_main_contact
  • Index Cond: (i_1.id = e_1.individual_id)
  • Buffers: shared hit=137608
77. 1.711 8.555 ↑ 1.0 1 1,711

Limit (cost=8.51..8.51 rows=1 width=45) (actual time=0.005..0.005 rows=1 loops=1,711)

  • Output: ((((p_5.issued_employee_print)::text || ' '::text) || (p_5.issued_employee_position)::text)), p_5.from_dt
  • Buffers: shared hit=6710
78. 1.711 6.844 ↑ 2.0 1 1,711

Sort (cost=8.51..8.51 rows=2 width=45) (actual time=0.004..0.004 rows=1 loops=1,711)

  • Output: ((((p_5.issued_employee_print)::text || ' '::text) || (p_5.issued_employee_position)::text)), p_5.from_dt
  • Sort Key: p_5.from_dt
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=6710
79. 5.133 5.133 ↑ 2.0 1 1,711

Index Scan using period_sickdoc_id_ix on sickdoc.period p_5 (cost=0.42..8.50 rows=2 width=45) (actual time=0.003..0.003 rows=1 loops=1,711)

  • Output: (((p_5.issued_employee_print)::text || ' '::text) || (p_5.issued_employee_position)::text), p_5.from_dt
  • Index Cond: (p_5.sickdoc_id = s.id)
  • Buffers: shared hit=6710
80. 59.739 59.739 ↑ 1.0 1 19,913

Index Scan using pim_organization_pk on public.pim_organization o (cost=0.29..8.31 rows=1 width=92) (actual time=0.003..0.003 rows=1 loops=19,913)

  • Output: o.short_name
  • Index Cond: (o.id = s.clinic_id)
  • Buffers: shared hit=59739
81. 2.395 2.395 ↓ 0.0 0 2,395

Index Scan using pim_organization_pk on public.pim_organization o_1 (cost=0.29..8.31 rows=1 width=92) (actual time=0.001..0.001 rows=0 loops=2,395)

  • Output: o_1.short_name
  • Index Cond: (o_1.id = s.workplace_id)
  • Buffers: shared hit=582
82. 79.652 139.391 ↓ 0.0 0 19,913

Limit (cost=0.00..1.11 rows=1 width=31) (actual time=0.007..0.007 rows=0 loops=19,913)

  • Output: fss_state.name
  • Buffers: shared hit=19913
83. 59.739 59.739 ↓ 0.0 0 19,913

Seq Scan on sickdoc.fss_sickdoc_state fss_state (cost=0.00..1.11 rows=1 width=31) (actual time=0.003..0.003 rows=0 loops=19,913)

  • Output: fss_state.name
  • Filter: ((fss_state.code)::text = (s.fss_state_code)::text)
  • Rows Removed by Filter: 8
  • Buffers: shared hit=19913
84. 19.913 119.478 ↓ 0.0 0 19,913

Result (cost=0.42..8.49 rows=1 width=0) (actual time=0.006..0.006 rows=0 loops=19,913)

  • One-Time Filter: (s.is_from_fss IS NULL)
  • Buffers: shared hit=89235
85. 99.565 99.565 ↓ 0.0 0 19,913

Index Scan using period_sickdoc_id_ix on sickdoc.period p_6 (cost=0.42..8.49 rows=1 width=0) (actual time=0.005..0.005 rows=0 loops=19,913)

  • Output: p_6.id, p_6.clinic_id, p_6.from_dt, p_6.issued_employee_id, p_6.issued_employee_position, p_6.sickdoc_id, p_6.step_id, p_6.to_dt, p_6.witness_employee_id, p_6.witness_employee_position, p_6.aud_who, p_6.aud_when, p_6.aud_source, p_6.aud_who_create, p_6.aud_when_create, p_6.aud_source_create, p_6.signature_num, p_6.doctor_signature, p_6.chairman_signature, p_6.is_sent_to_fss, p_6.witness_employee_print, p_6.issued_employee_print
  • Index Cond: (p_6.sickdoc_id = s.id)
  • Filter: ((p_6.witness_employee_id IS NOT NULL) AND (p_6.chairman_signature IS NULL))
  • Rows Removed by Filter: 1
  • Buffers: shared hit=89235
86. 3.049 24.392 ↑ 1.0 1 3,049

Limit (cost=8.50..8.51 rows=1 width=26) (actual time=0.008..0.008 rows=1 loops=3,049)

  • Output: (((s.issue_dt > p_7.from_dt) AND (p_7.witness_employee_id IS NOT NULL) AND (p_7.chairman_signature IS NOT NULL))), p_7.from_dt
  • Buffers: shared hit=12654
87. 12.196 21.343 ↑ 2.0 1 3,049

Sort (cost=8.50..8.51 rows=2 width=26) (actual time=0.007..0.007 rows=1 loops=3,049)

  • Output: (((s.issue_dt > p_7.from_dt) AND (p_7.witness_employee_id IS NOT NULL) AND (p_7.chairman_signature IS NOT NULL))), p_7.from_dt
  • Sort Key: p_7.from_dt
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=12654
88. 9.147 9.147 ↑ 2.0 1 3,049

Index Scan using period_sickdoc_id_ix on sickdoc.period p_7 (cost=0.42..8.49 rows=2 width=26) (actual time=0.003..0.003 rows=1 loops=3,049)

  • Output: ((s.issue_dt > p_7.from_dt) AND (p_7.witness_employee_id IS NOT NULL) AND (p_7.chairman_signature IS NOT NULL)), p_7.from_dt
  • Index Cond: (p_7.sickdoc_id = s.id)
  • Buffers: shared hit=12654
89. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.84..16.93 rows=1 width=0) (never executed)

90. 0.000 0.000 ↓ 0.0 0

Index Scan using period_sickdoc_id_ix on sickdoc.period p_8 (cost=0.42..8.49 rows=1 width=4) (never executed)

  • Output: p_8.id, p_8.clinic_id, p_8.from_dt, p_8.issued_employee_id, p_8.issued_employee_position, p_8.sickdoc_id, p_8.step_id, p_8.to_dt, p_8.witness_employee_id, p_8.witness_employee_position, p_8.aud_who, p_8.aud_when, p_8.aud_source, p_8.aud_who_create, p_8.aud_when_create, p_8.aud_source_create, p_8.signature_num, p_8.doctor_signature, p_8.chairman_signature, p_8.is_sent_to_fss, p_8.witness_employee_print, p_8.issued_employee_print
  • Index Cond: (p_8.sickdoc_id = s.id)
  • Filter: p_8.is_sent_to_fss
91. 0.000 0.000 ↓ 0.0 0

Index Only Scan using sickdoc_pk on sickdoc.sickdoc ms (cost=0.42..8.44 rows=1 width=4) (never executed)

  • Output: ms.id
  • Index Cond: (ms.id = s.id)
  • Heap Fetches: 0
92. 41.736 145.142 ↓ 1.0 95,759 1

Hash Join (cost=6,225.49..13,202.35 rows=94,926 width=4) (actual time=57.665..145.142 rows=95,759 loops=1)

  • Output: p_9.sickdoc_id
  • Hash Cond: (p_9.sickdoc_id = ms_1.id)
  • Buffers: shared hit=23261
93. 45.899 45.899 ↓ 1.0 95,759 1

Seq Scan on sickdoc.period p_9 (cost=0.00..5,671.63 rows=94,926 width=4) (actual time=0.015..45.899 rows=95,759 loops=1)

  • Output: p_9.id, p_9.clinic_id, p_9.from_dt, p_9.issued_employee_id, p_9.issued_employee_position, p_9.sickdoc_id, p_9.step_id, p_9.to_dt, p_9.witness_employee_id, p_9.witness_employee_position, p_9.aud_who, p_9.aud_when, p_9.aud_source, p_9.aud_who_create, p_9.aud_when_create, p_9.aud_source_create, p_9.signature_num, p_9.doctor_signature, p_9.chairman_signature, p_9.is_sent_to_fss, p_9.witness_employee_print, p_9.issued_employee_print
  • Filter: p_9.is_sent_to_fss
  • Rows Removed by Filter: 101650
  • Buffers: shared hit=3709
94. 26.047 57.507 ↑ 1.0 124,819 1

Hash (cost=4,665.25..4,665.25 rows=124,819 width=4) (actual time=57.507..57.507 rows=124,819 loops=1)

  • Output: ms_1.id
  • Buckets: 131072 Batches: 1 Memory Usage: 5413kB
  • Buffers: shared hit=19552
95. 31.460 31.460 ↑ 1.0 124,819 1

Index Only Scan using sickdoc_pk on sickdoc.sickdoc ms_1 (cost=0.42..4,665.25 rows=124,819 width=4) (actual time=0.018..31.460 rows=124,819 loops=1)

  • Output: ms_1.id
  • Heap Fetches: 20852
  • Buffers: shared hit=19552
96. 0.000 0.000 ↓ 0.0 0 9,726

Result (cost=0.42..8.49 rows=1 width=0) (actual time=0.000..0.000 rows=0 loops=9,726)

  • One-Time Filter: s.is_eln
  • Buffers: shared hit=489
97. 0.304 0.304 ↓ 0.0 0 152

Index Scan using period_sickdoc_id_ix on sickdoc.period p_10 (cost=0.42..8.49 rows=1 width=0) (actual time=0.002..0.002 rows=0 loops=152)

  • Output: p_10.id, p_10.clinic_id, p_10.from_dt, p_10.issued_employee_id, p_10.issued_employee_position, p_10.sickdoc_id, p_10.step_id, p_10.to_dt, p_10.witness_employee_id, p_10.witness_employee_position, p_10.aud_who, p_10.aud_when, p_10.aud_source, p_10.aud_who_create, p_10.aud_when_create, p_10.aud_source_create, p_10.signature_num, p_10.doctor_signature, p_10.chairman_signature, p_10.is_sent_to_fss, p_10.witness_employee_print, p_10.issued_employee_print
  • Index Cond: (p_10.sickdoc_id = s.id)
  • Filter: ((p_10.witness_employee_id IS NOT NULL) AND (p_10.chairman_signature IS NOT NULL))
  • Rows Removed by Filter: 0
  • Buffers: shared hit=489
98. 0.000 0.000 ↓ 0.0 0 9,722

Result (cost=0.42..8.49 rows=1 width=0) (actual time=0.000..0.000 rows=0 loops=9,722)

  • One-Time Filter: s.is_eln
  • Buffers: shared hit=473
99. 0.296 0.296 ↓ 0.0 0 148

Index Scan using period_sickdoc_id_ix on sickdoc.period p_11 (cost=0.42..8.49 rows=1 width=0) (actual time=0.002..0.002 rows=0 loops=148)

  • Output: p_11.id, p_11.clinic_id, p_11.from_dt, p_11.issued_employee_id, p_11.issued_employee_position, p_11.sickdoc_id, p_11.step_id, p_11.to_dt, p_11.witness_employee_id, p_11.witness_employee_position, p_11.aud_who, p_11.aud_when, p_11.aud_source, p_11.aud_who_create, p_11.aud_when_create, p_11.aud_source_create, p_11.signature_num, p_11.doctor_signature, p_11.chairman_signature, p_11.is_sent_to_fss, p_11.witness_employee_print, p_11.issued_employee_print
  • Index Cond: (p_11.sickdoc_id = s.id)
  • Filter: ((p_11.witness_employee_id IS NOT NULL) AND (p_11.chairman_signature IS NOT NULL))
  • Rows Removed by Filter: 0
  • Buffers: shared hit=473
100. 0.000 0.000 ↓ 0.0 0 9,722

Result (cost=0.42..8.46 rows=2 width=0) (actual time=0.000..0.000 rows=0 loops=9,722)

  • One-Time Filter: s.is_eln
  • Buffers: shared hit=450
101. 0.148 0.148 ↓ 0.0 0 148

Index Only Scan using period_sickdoc_id_ix on sickdoc.period p_12 (cost=0.42..8.46 rows=2 width=0) (actual time=0.001..0.001 rows=0 loops=148)

  • Output: p_12.sickdoc_id
  • Index Cond: (p_12.sickdoc_id = s.id)
  • Heap Fetches: 5
  • Buffers: shared hit=450
102. 23.526 1,070.433 ↑ 1.0 1 11,763

Limit (cost=9.00..9.01 rows=1 width=26) (actual time=0.090..0.091 rows=1 loops=11,763)

  • Output: ((((p_13.witness_employee_id IS NOT NULL) AND (p_13.chairman_signature IS NOT NULL)) OR (COALESCE(sickdoc.get_sickdoc_days_count(s.id), 0) < 16))), p_13.to_dt
  • Buffers: shared hit=130375
103. 47.052 1,046.907 ↑ 2.0 1 11,763

Sort (cost=9.00..9.01 rows=2 width=26) (actual time=0.089..0.089 rows=1 loops=11,763)

  • Output: ((((p_13.witness_employee_id IS NOT NULL) AND (p_13.chairman_signature IS NOT NULL)) OR (COALESCE(sickdoc.get_sickdoc_days_count(s.id), 0) < 16))), p_13.to_dt
  • Sort Key: p_13.to_dt DESC
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=130375
104. 999.855 999.855 ↑ 1.0 2 11,763

Index Scan using period_sickdoc_id_ix on sickdoc.period p_13 (cost=0.42..8.99 rows=2 width=26) (actual time=0.053..0.085 rows=2 loops=11,763)

  • Output: (((p_13.witness_employee_id IS NOT NULL) AND (p_13.chairman_signature IS NOT NULL)) OR (COALESCE(sickdoc.get_sickdoc_days_count(s.id), 0) < 16)), p_13.to_dt
  • Index Cond: (p_13.sickdoc_id = s.id)
  • Buffers: shared hit=130375
105. 0.000 0.000 ↓ 0.0 0

Index Only Scan using period_sickdoc_id_ix on sickdoc.period period_1 (cost=0.42..8.46 rows=2 width=0) (never executed)

  • Index Cond: (period_1.sickdoc_id = s.id)
  • Heap Fetches: 0
106. 42.753 42.753 ↓ 1.0 197,409 1

Seq Scan on sickdoc.period period_2 (cost=0.00..5,671.63 rows=196,263 width=4) (actual time=0.004..42.753 rows=197,409 loops=1)

  • Output: period_2.sickdoc_id
  • Buffers: shared hit=3709