explain.depesz.com

PostgreSQL's explain analyze made readable

Result: OmIX

Settings
# exclusive inclusive rows x rows loops node
1. 0.002 44,272.286 ↑ 1.0 21 1

Limit (cost=43,890,445.04..43,890,445.09 rows=21 width=755) (actual time=44,272.282..44,272.286 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), (CASE WHEN (s.type_id = 1) THEN 'Первичный'::text WHEN (s.type_id = 2) THEN 'Продолжение'::text WHEN ((s.type_id = 3) AND (sp.type_id = 1)) THEN 'Первичный (дубликат)'::text WHEN ((s.type_id = 3) AND (sp.type_id = 2)) THEN 'Продолжение (дубликат)'::text ELSE NULL::text END), sj.name, (((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))), ((alternatives: SubPlan 13 or hashed SubPlan 14)), (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 15))), 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 16)), 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)), ((NOT (alternatives: SubPlan 17 or hashed SubPlan 18))), (((sp.id IS NULL) OR (sp.is_eln IS NULL) OR COALESCE(((sp.fss_state_code)::text = '030'::text), false))), (NULL::unknown), (NULL::unknown), (CASE WHEN (s.is_eln AND ((SubPlan 19) 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 20)) IS FALSE) OR (((alternatives: SubPlan 21 or hashed SubPlan 22) OR ((s.issue_dt + '2 days'::interval) >= ('now'::cstring)::date) OR (SubPlan 23) OR (SubPlan 24) OR (NOT (SubPlan 25))) 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 26)) IS FALSE))) THEN 'Да'::text ELSE 'Нет'::text END), (CASE WHEN ((alternatives: SubPlan 27 or hashed SubPlan 28) OR ((state.code)::text = '3'::text)) THEN s.end_dt ELSE NULL::date END)
  • Buffers: shared hit=1758774 read=36683 dirtied=116
  • I/O Timings: read=35589.750
2.          

Initplan (forLimit)

3. 0.003 0.003 ↑ 1.0 1 1

Result (cost=0.01..0.02 rows=1 width=0) (actual time=0.003..0.003 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. 64.984 44,272.281 ↑ 310.8 21 1

Sort (cost=43,890,445.02..43,890,461.33 rows=6,527 width=755) (actual time=44,272.281..44,272.281 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), (CASE WHEN (s.type_id = 1) THEN 'Первичный'::text WHEN (s.type_id = 2) THEN 'Продолжение'::text WHEN ((s.type_id = 3) AND (sp.type_id = 1)) THEN 'Первичный (дубликат)'::text WHEN ((s.type_id = 3) AND (sp.type_id = 2)) THEN 'Продолжение (дубликат)'::text ELSE NULL::text END), sj.name, (((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))), ((alternatives: SubPlan 13 or hashed SubPlan 14)), (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 15))), 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 16)), 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)), ((NOT (alternatives: SubPlan 17 or hashed SubPlan 18))), (((sp.id IS NULL) OR (sp.is_eln IS NULL) OR COALESCE(((sp.fss_state_code)::text = '030'::text), false))), (NULL::unknown), (NULL::unknown), (CASE WHEN (s.is_eln AND ((SubPlan 19) 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 20)) IS FALSE) OR (((alternatives: SubPlan 21 or hashed SubPlan 22) OR ((s.issue_dt + '2 days'::interval) >= ('now'::cstring)::date) OR (SubPlan 23) OR (SubPlan 24) OR (NOT (SubPlan 25))) 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 26)) IS FALSE))) THEN 'Да'::text ELSE 'Нет'::text END), (CASE WHEN ((alternatives: SubPlan 27 or hashed SubPlan 28) OR ((state.code)::text = '3'::text)) THEN s.end_dt ELSE NULL::date END)
  • Sort Key: (CASE WHEN ((alternatives: SubPlan 27 or hashed SubPlan 28) OR ((state.code)::text = '3'::text)) THEN s.end_dt ELSE NULL::date END) DESC
  • Sort Method: top-N heapsort Memory: 35kB
  • Buffers: shared hit=1758774 read=36683 dirtied=116
  • I/O Timings: read=35589.750
7. 2,433.792 44,207.297 ↓ 3.1 19,913 1

Hash Left Join (cost=93,278.02..43,890,269.04 rows=6,527 width=755) (actual time=36,379.091..44,207.297 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, CASE WHEN (s.type_id = 1) THEN 'Первичный'::text WHEN (s.type_id = 2) THEN 'Продолжение'::text WHEN ((s.type_id = 3) AND (sp.type_id = 1)) THEN 'Первичный (дубликат)'::text WHEN ((s.type_id = 3) AND (sp.type_id = 2)) THEN 'Продолжение (дубликат)'::text ELSE NULL::text END, sj.name, ((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)), (alternatives: SubPlan 13 or hashed SubPlan 14), 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 15)), 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 16), 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), (NOT (alternatives: SubPlan 17 or hashed SubPlan 18)), ((sp.id IS NULL) OR (sp.is_eln IS NULL) OR COALESCE(((sp.fss_state_code)::text = '030'::text), false)), NULL::unknown, NULL::unknown, CASE WHEN (s.is_eln AND ((SubPlan 19) 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 20)) IS FALSE) OR (((alternatives: SubPlan 21 or hashed SubPlan 22) OR ((s.issue_dt + '2 days'::interval) >= ('now'::cstring)::date) OR (SubPlan 23) OR (SubPlan 24) OR (NOT (SubPlan 25))) 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 26)) IS FALSE))) THEN 'Да'::text ELSE 'Нет'::text END, CASE WHEN ((alternatives: SubPlan 27 or hashed SubPlan 28) OR ((state.code)::text = '3'::text)) THEN s.end_dt ELSE NULL::date END
  • Hash Cond: (s.parent_id = sp.id)
  • Buffers: shared hit=1758771 read=36683 dirtied=116
  • I/O Timings: read=35589.750
8. 18.717 36,301.156 ↓ 3.1 19,913 1

Hash Left Join (cost=87,104.43..93,193.40 rows=6,527 width=742) (actual time=35,878.242..36,301.156 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, sj.name, s_continue.number, s_continue.id, s_continue.clinic_id, fss_request.stacktrace, fss_request_state.id, fss_request_state.name
  • Hash Cond: (s.journal_id = sj.id)
  • Buffers: shared hit=63372 read=31773 dirtied=82
  • I/O Timings: read=34653.986
9. 20.079 36,282.398 ↓ 3.1 19,913 1

Merge Left Join (cost=87,100.86..93,147.68 rows=6,527 width=718) (actual time=35,878.176..36,282.398 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, s_continue.number, s_continue.id, s_continue.clinic_id, fss_request.stacktrace, fss_request_state.id, fss_request_state.name
  • Merge Cond: (s.id = s_continue.parent_id)
  • Buffers: shared hit=63370 read=31773 dirtied=82
  • I/O Timings: read=34653.986
10. 40.443 36,170.332 ↓ 3.1 19,913 1

Merge Left Join (cost=81,318.95..87,307.47 rows=6,527 width=698) (actual time=35,830.224..36,170.332 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=59931 read=31773 dirtied=82
  • I/O Timings: read=34653.986
11. 77.566 35,294.573 ↓ 3.1 19,913 1

Sort (cost=53,701.16..53,717.48 rows=6,527 width=230) (actual time=35,285.816..35,294.573 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=59927 read=24987 dirtied=82
  • I/O Timings: read=34474.310
12. 28.036 35,217.007 ↓ 3.1 19,913 1

Hash Left Join (cost=5,183.31..53,287.60 rows=6,527 width=230) (actual time=145.207..35,217.007 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=59927 read=24987 dirtied=82
  • I/O Timings: read=34474.310
13. 67.475 35,188.958 ↓ 3.1 19,913 1

Nested Loop Left Join (cost=5,182.16..53,255.21 rows=6,527 width=227) (actual time=145.170..35,188.958 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=59926 read=24987 dirtied=82
  • I/O Timings: read=34474.310
14. 14.965 373.298 ↓ 3.1 19,913 1

Hash Left Join (cost=5,181.73..8,846.99 rows=6,527 width=169) (actual time=143.568..373.298 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=7 read=5129 dirtied=81
  • I/O Timings: read=123.268
15. 15.816 358.312 ↓ 3.1 19,913 1

Hash Join (cost=5,180.66..8,756.18 rows=6,527 width=167) (actual time=143.527..358.312 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=6 read=5129 dirtied=81
  • I/O Timings: read=123.268
16. 108.506 342.468 ↓ 3.1 19,913 1

Hash Join (cost=5,179.55..8,665.32 rows=6,527 width=165) (actual time=143.484..342.468 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=5 read=5129 dirtied=81
  • I/O Timings: read=123.268
17. 102.510 102.510 ↑ 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.002..102.510 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=2 read=1692 dirtied=81
  • I/O Timings: read=46.319
18. 13.259 131.452 ↓ 3.1 19,913 1

Hash (cost=5,097.96..5,097.96 rows=6,527 width=157) (actual time=131.452..131.452 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=3 read=3437
  • I/O Timings: read=76.949
19. 12.815 118.193 ↓ 3.1 19,913 1

Hash Join (cost=1.05..5,097.96 rows=6,527 width=157) (actual time=14.917..118.193 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=3 read=3437
  • I/O Timings: read=76.949
20. 105.360 105.360 ↓ 1.0 19,913 1

Seq Scan on sickdoc.sickdoc s (cost=0.00..4,958.21 rows=19,580 width=163) (actual time=14.880..105.360 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=2 read=3437
  • I/O Timings: read=76.949
21. 0.003 0.018 ↑ 1.0 1 1

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

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

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

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

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

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

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

  • Output: state.code, state.id
  • Buffers: shared hit=1
25. 0.011 0.021 ↑ 1.0 3 1

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

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

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

  • Output: type.code, type.id
  • Buffers: shared hit=1
27. 34,748.185 34,748.185 ↑ 1.0 1 19,913

Index Scan using pim_individual_pk on public.pim_individual individual (cost=0.43..6.79 rows=1 width=62) (actual time=1.743..1.745 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=59919 read=19858 dirtied=1
  • I/O Timings: read=34351.042
28. 0.008 0.013 ↑ 1.0 7 1

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

  • Output: rwo.code, rwo.id
  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=1
29. 0.005 0.005 ↑ 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.005..0.005 rows=7 loops=1)

  • Output: rwo.code, rwo.id
  • Buffers: shared hit=1
30. 14.808 835.316 ↓ 53.5 56,569 1

Materialize (cost=27,617.79..34,561.57 rows=1,058 width=472) (actual time=544.397..835.316 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=4 read=6786
  • I/O Timings: read=179.676
31. 67.496 820.508 ↓ 53.5 56,569 1

Nested Loop Left Join (cost=27,617.79..34,558.93 rows=1,058 width=472) (actual time=544.387..820.508 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=4 read=6786
  • I/O Timings: read=179.676
32. 25.941 753.012 ↓ 53.5 56,569 1

Subquery Scan on fss_request (cost=27,617.79..34,494.40 rows=1,058 width=447) (actual time=544.345..753.012 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=3 read=6786
  • I/O Timings: read=179.676
33. 146.489 727.071 ↑ 1.3 168,438 1

WindowAgg (cost=27,617.79..31,849.55 rows=211,588 width=455) (actual time=544.314..727.071 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=3 read=6786
  • I/O Timings: read=179.676
34. 335.931 580.582 ↑ 1.3 168,438 1

Sort (cost=27,617.79..28,146.76 rows=211,588 width=455) (actual time=537.515..580.582 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=3 read=6786
  • I/O Timings: read=179.676
35. 244.651 244.651 ↑ 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.908..244.651 rows=196,181 loops=1)

  • Output: r.create_dt, r.sicklist_n2o_id, r.state_id, r.stacktrace
  • Buffers: shared read=6786
  • I/O Timings: read=179.676
36. 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
37. 0.026 0.026 ↑ 1.0 4 1

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

  • Output: fss_request_state.id, fss_request_state.name
  • Buffers: shared hit=1
38. 8.082 91.987 ↓ 187.0 11,407 1

Materialize (cost=5,781.91..6,146.32 rows=61 width=24) (actual time=47.930..91.987 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
39. 4.419 83.905 ↓ 187.0 11,407 1

Subquery Scan on s_continue (cost=5,781.91..6,146.17 rows=61 width=24) (actual time=47.926..83.905 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
40. 27.045 79.486 ↑ 1.1 11,424 1

WindowAgg (cost=5,781.91..5,994.39 rows=12,142 width=24) (actual time=47.906..79.486 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
41. 8.823 52.441 ↑ 1.1 11,424 1

Sort (cost=5,781.91..5,812.26 rows=12,142 width=24) (actual time=47.885..52.441 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
42. 43.618 43.618 ↓ 1.0 12,161 1

Seq Scan on sickdoc.sickdoc c (cost=0.00..4,958.21 rows=12,142 width=24) (actual time=0.010..43.618 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
43. 0.020 0.041 ↑ 1.0 70 1

Hash (cost=2.70..2.70 rows=70 width=28) (actual time=0.041..0.041 rows=70 loops=1)

  • Output: sj.name, sj.id
  • Buckets: 1024 Batches: 1 Memory Usage: 13kB
  • Buffers: shared hit=2
44. 0.021 0.021 ↑ 1.0 70 1

Seq Scan on sickdoc.journal sj (cost=0.00..2.70 rows=70 width=28) (actual time=0.007..0.021 rows=70 loops=1)

  • Output: sj.name, sj.id
  • Buffers: shared hit=2
45. 29.268 89.152 ↓ 1.0 124,819 1

Hash (cost=4,654.37..4,654.37 rows=121,537 width=13) (actual time=89.152..89.152 rows=124,819 loops=1)

  • Output: sp.type_id, sp.id, sp.is_eln, sp.fss_state_code
  • Buckets: 131072 Batches: 1 Memory Usage: 6181kB
  • Buffers: shared hit=3439
46. 59.884 59.884 ↓ 1.0 124,819 1

Seq Scan on sickdoc.sickdoc sp (cost=0.00..4,654.37 rows=121,537 width=13) (actual time=0.006..59.884 rows=124,819 loops=1)

  • Output: sp.type_id, sp.id, sp.is_eln, sp.fss_state_code
  • Buffers: shared hit=3439
47.          

SubPlan (forHash Left Join)

48. 13.275 212.400 ↑ 1.0 1 13,275

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

  • Output: p.issued_employee_id, p.from_dt
  • Buffers: shared hit=65306 read=369 dirtied=13
  • I/O Timings: read=13.574
49. 53.100 199.125 ↑ 2.0 1 13,275

Sort (cost=8.50..8.50 rows=2 width=8) (actual time=0.015..0.015 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=65306 read=369 dirtied=13
  • I/O Timings: read=13.574
50. 146.025 146.025 ↑ 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.008..0.011 rows=2 loops=13,275)

  • Output: p.issued_employee_id, p.from_dt
  • Index Cond: (p.sickdoc_id = s.id)
  • Buffers: shared hit=65306 read=369 dirtied=13
  • I/O Timings: read=13.574
51. 13.549 785.842 ↑ 1.0 1 13,549

Limit (cost=37.74..37.74 rows=1 width=105) (actual time=0.058..0.058 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=423228 read=58 dirtied=1
  • I/O Timings: read=83.247
52. 40.647 772.293 ↑ 2.0 1 13,549

Sort (cost=37.74..37.74 rows=2 width=105) (actual time=0.057..0.057 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=423228 read=58 dirtied=1
  • I/O Timings: read=83.247
53. 119.437 731.646 ↑ 1.0 2 13,549

Nested Loop (cost=1.72..37.73 rows=2 width=105) (actual time=0.035..0.054 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=423228 read=58 dirtied=1
  • I/O Timings: read=83.247
54. 26.159 392.921 ↑ 1.0 2 13,549

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

  • Output: p_1.from_dt, pp.name, e.individual_id
  • Buffers: shared hit=313632 read=10 dirtied=1
  • I/O Timings: read=2.482
55. 12.610 284.529 ↑ 1.0 2 13,549

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

  • Output: p_1.from_dt, ep.employee_id, pp.name
  • Buffers: shared hit=231324 read=10 dirtied=1
  • I/O Timings: read=2.482
56. 25.842 189.686 ↑ 1.0 2 13,549

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

  • Output: p_1.from_dt, ep.position_id, ep.employee_id
  • Buffers: shared hit=149094 read=7 dirtied=1
  • I/O Timings: read=0.643
57. 54.196 54.196 ↑ 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.003..0.004 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=66862 read=6 dirtied=1
  • I/O Timings: read=0.134
58. 109.648 109.648 ↑ 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.004..0.004 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=82232 read=1
  • I/O Timings: read=0.509
59. 82.233 82.233 ↑ 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.003..0.003 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=82230 read=3
  • I/O Timings: read=1.839
60. 82.233 82.233 ↑ 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.003..0.003 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
61. 219.288 219.288 ↑ 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.008..0.008 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=109596 read=48
  • I/O Timings: read=80.765
62. 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
63. 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
64. 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)
65. 39.826 139.391 ↑ 1.0 1 19,913

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

  • Output: (count(1) > 1)
  • Buffers: shared hit=63061 read=208 dirtied=8
  • I/O Timings: read=25.681
66. 99.565 99.565 ↑ 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.004..0.005 rows=2 loops=19,913)

  • Output: period.sickdoc_id
  • Index Cond: (period.sickdoc_id = s.id)
  • Heap Fetches: 3535
  • Buffers: shared hit=63061 read=208 dirtied=8
  • I/O Timings: read=25.681
67. 79.652 79.652 ↑ 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.003..0.004 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
68. 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
69. 19.913 258.869 ↑ 1.0 1 19,913

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

  • Output: p_3.issued_employee_id, p_3.from_dt
  • Buffers: shared hit=94075 read=2 dirtied=11
  • I/O Timings: read=37.197
70. 79.652 238.956 ↑ 2.0 1 19,913

Sort (cost=8.50..8.50 rows=2 width=8) (actual time=0.012..0.012 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=94075 read=2 dirtied=11
  • I/O Timings: read=37.197
71. 159.304 159.304 ↑ 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.006..0.008 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=94075 read=2 dirtied=11
  • I/O Timings: read=37.197
72. 0.000 1,115.128 ↑ 1.0 1 19,913

Limit (cost=37.74..37.74 rows=1 width=105) (actual time=0.056..0.056 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=541317 read=106
  • I/O Timings: read=366.340
73. 59.739 1,115.128 ↑ 2.0 1 19,913

Sort (cost=37.74..37.74 rows=2 width=105) (actual time=0.056..0.056 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=541317 read=106
  • I/O Timings: read=366.340
74. 168.294 1,055.389 ↑ 1.0 2 19,913

Nested Loop (cost=1.72..37.73 rows=2 width=105) (actual time=0.040..0.053 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=541317 read=106
  • I/O Timings: read=366.340
75. 36.185 577.477 ↑ 1.0 2 19,913

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

  • Output: p_4.from_dt, pp_1.name, e_1.individual_id
  • Buffers: shared hit=403788 read=27
  • I/O Timings: read=164.212
76. 27.120 438.086 ↑ 1.0 2 19,913

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

  • Output: p_4.from_dt, ep_1.employee_id, pp_1.name
  • Buffers: shared hit=300468 read=21
  • I/O Timings: read=128.106
77. 35.333 238.956 ↑ 1.0 2 19,913

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

  • Output: p_4.from_dt, ep_1.position_id, ep_1.employee_id
  • Buffers: shared hit=197276 read=7
  • I/O Timings: read=33.767
78. 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
79. 143.884 143.884 ↑ 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.003..0.004 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=103199 read=7
  • I/O Timings: read=33.767
80. 172.010 172.010 ↑ 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.005..0.005 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=103192 read=14
  • I/O Timings: read=94.339
81. 103.206 103.206 ↑ 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.003..0.003 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=103320 read=6
  • I/O Timings: read=36.106
82. 309.618 309.618 ↑ 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.009..0.009 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=137529 read=79
  • I/O Timings: read=202.128
83. 0.000 10.266 ↑ 1.0 1 1,711

Limit (cost=8.51..8.51 rows=1 width=45) (actual time=0.006..0.006 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
84. 5.133 10.266 ↑ 2.0 1 1,711

Sort (cost=8.51..8.51 rows=2 width=45) (actual time=0.006..0.006 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
85. 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
86. 79.652 79.652 ↑ 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.004 rows=1 loops=19,913)

  • Output: o.short_name
  • Index Cond: (o.id = s.clinic_id)
  • Buffers: shared hit=59739
87. 0.000 0.000 ↓ 0.0 0

Seq Scan on sickdoc.sickdoc (cost=0.00..5,262.06 rows=1 width=0) (never executed)

  • Filter: ((sickdoc.parent_id = s.id) AND (sickdoc.type_id = 3))
88. 43.331 43.331 ↑ 1.0 1,684 1

Seq Scan on sickdoc.sickdoc sickdoc_1 (cost=0.00..4,958.21 rows=1,685 width=4) (actual time=0.047..43.331 rows=1,684 loops=1)

  • Output: sickdoc_1.parent_id
  • Filter: (sickdoc_1.type_id = 3)
  • Rows Removed by Filter: 123135
  • Buffers: shared hit=3439
89. 45.505 45.505 ↓ 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.019..0.019 rows=0 loops=2,395)

  • Output: o_1.short_name
  • Index Cond: (o_1.id = s.workplace_id)
  • Buffers: shared hit=559 read=23
  • I/O Timings: read=41.532
90. 79.652 159.304 ↓ 0.0 0 19,913

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

  • Output: fss_state.name
  • Buffers: shared hit=19912 read=1
  • I/O Timings: read=9.946
91. 79.652 79.652 ↓ 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.004..0.004 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=19912 read=1
  • I/O Timings: read=9.946
92. 0.000 0.000 ↓ 0.0 0

Seq Scan on sickdoc.sickdoc s2 (cost=0.00..4,958.21 rows=4 width=0) (never executed)

  • Filter: (s2.parent_id = s.id)
93. 42.656 42.656 ↓ 1.0 124,819 1

Seq Scan on sickdoc.sickdoc s2_1 (cost=0.00..4,654.37 rows=121,537 width=4) (actual time=0.011..42.656 rows=124,819 loops=1)

  • Output: s2_1.parent_id
  • Buffers: shared hit=3439
94. 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
95. 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
96. 6.098 30.490 ↑ 1.0 1 3,049

Limit (cost=8.50..8.51 rows=1 width=26) (actual time=0.009..0.010 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
97. 12.196 24.392 ↑ 2.0 1 3,049

Sort (cost=8.50..8.51 rows=2 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
  • Sort Key: p_7.from_dt
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=12654
98. 12.196 12.196 ↑ 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.004 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
99. 0.000 0.000 ↓ 0.0 0

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

100. 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
101. 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
102. 45.292 190.784 ↓ 1.0 95,759 1

Hash Join (cost=6,117.49..13,094.35 rows=94,926 width=4) (actual time=95.116..190.784 rows=95,759 loops=1)

  • Output: p_9.sickdoc_id
  • Hash Cond: (p_9.sickdoc_id = ms_1.id)
  • Buffers: shared hit=22839 read=422 dirtied=1
  • I/O Timings: read=39.420
103. 50.840 50.840 ↓ 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.019..50.840 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
104. 26.119 94.652 ↓ 1.0 124,819 1

Hash (cost=4,598.28..4,598.28 rows=121,537 width=4) (actual time=94.652..94.652 rows=124,819 loops=1)

  • Output: ms_1.id
  • Buckets: 131072 Batches: 1 Memory Usage: 5413kB
  • Buffers: shared hit=19130 read=422 dirtied=1
  • I/O Timings: read=39.420
105. 68.533 68.533 ↓ 1.0 124,819 1

Index Only Scan using sickdoc_pk on sickdoc.sickdoc ms_1 (cost=0.42..4,598.28 rows=121,537 width=4) (actual time=9.251..68.533 rows=124,819 loops=1)

  • Output: ms_1.id
  • Heap Fetches: 20853
  • Buffers: shared hit=19130 read=422 dirtied=1
  • I/O Timings: read=39.420
106. 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
107. 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
108. 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
109. 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
110. 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
111. 0.296 0.296 ↓ 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.002..0.002 rows=0 loops=148)

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

Limit (cost=9.00..9.01 rows=1 width=26) (actual time=0.160..0.160 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=130378
113. 47.052 1,858.554 ↑ 2.0 1 11,763

Sort (cost=9.00..9.01 rows=2 width=26) (actual time=0.158..0.158 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=130378
114. 1,811.502 1,811.502 ↑ 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.089..0.154 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=130378
115. 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
116. 148.543 148.543 ↓ 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.017..148.543 rows=197,409 loops=1)

  • Output: period_2.sickdoc_id
  • Buffers: shared hit=4 read=3705
  • I/O Timings: read=102.846