explain.depesz.com

PostgreSQL's explain analyze made readable

Result: z7e9

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 11,463.715 ↑ 1.0 21 1

Limit (cost=54,901,646.75..54,901,646.80 rows=21 width=740) (actual time=11,463.712..11,463.715 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=1889230 read=2522
  • I/O Timings: read=79.391
2.          

Initplan (forLimit)

3. 0.006 0.007 ↑ 1.0 1 1

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

  • Output: $10
4.          

Initplan (forResult)

5. 0.001 0.001 ↓ 0.0 0 1

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

  • One-Time Filter: false
6. 110.053 11,463.711 ↑ 335.0 21 1

Sort (cost=54,901,646.73..54,901,664.32 rows=7,035 width=740) (actual time=11,463.710..11,463.711 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=1889230 read=2522
  • I/O Timings: read=79.391
7. 3,163.816 11,353.658 ↓ 3.0 21,096 1

Hash Left Join (cost=103,758.63..54,901,457.06 rows=7,035 width=740) (actual time=1,546.712..11,353.658 rows=21,096 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=1889230 read=2522
  • I/O Timings: read=79.391
8. 32.039 1,835.960 ↓ 3.0 21,096 1

Hash Left Join (cost=96,567.72..103,482.42 rows=7,035 width=727) (actual time=1,015.501..1,835.960 rows=21,096 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=100198 read=2519
  • I/O Timings: read=79.295
9. 28.650 1,803.850 ↓ 3.0 21,096 1

Merge Left Join (cost=96,564.12..103,434.72 rows=7,035 width=702) (actual time=1,015.366..1,803.850 rows=21,096 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=100196 read=2519
  • I/O Timings: read=79.295
10. 66.274 1,608.746 ↓ 3.0 21,096 1

Merge Left Join (cost=89,830.31..96,635.21 rows=7,035 width=682) (actual time=921.165..1,608.746 rows=21,096 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=96164 read=2519
  • I/O Timings: read=79.295
11. 65.817 573.205 ↓ 3.0 21,096 1

Sort (cost=57,916.31..57,933.90 rows=7,035 width=230) (actual time=550.585..573.205 rows=21,096 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: 6353kB
  • Buffers: shared hit=87966 read=2519
  • I/O Timings: read=79.295
12. 13.251 507.388 ↓ 3.0 21,096 1

Hash Left Join (cost=6,029.20..57,466.76 rows=7,035 width=230) (actual time=93.484..507.388 rows=21,096 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=87966 read=2519
  • I/O Timings: read=79.295
13. 20.107 494.103 ↓ 3.0 21,096 1

Nested Loop Left Join (cost=6,028.05..57,431.96 rows=7,035 width=227) (actual time=93.405..494.103 rows=21,096 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=87965 read=2519
  • I/O Timings: read=79.295
14. 11.434 220.844 ↓ 3.0 21,096 1

Hash Left Join (cost=6,027.62..10,144.87 rows=7,035 width=169) (actual time=93.290..220.844 rows=21,096 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=5006 read=952
  • I/O Timings: read=14.184
15. 10.931 209.366 ↓ 3.0 21,096 1

Hash Join (cost=6,026.55..10,047.07 rows=7,035 width=167) (actual time=93.161..209.366 rows=21,096 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=5005 read=952
  • I/O Timings: read=14.184
16. 65.445 198.421 ↓ 3.0 21,096 1

Hash Join (cost=6,025.44..9,949.23 rows=7,035 width=165) (actual time=93.098..198.421 rows=21,096 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=5004 read=952
  • I/O Timings: read=14.184
17. 40.126 40.126 ↑ 1.0 140,396 1

Seq Scan on sickdoc.sickdoc_extended se (cost=0.00..3,326.96 rows=140,396 width=12) (actual time=0.003..40.126 rows=140,396 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=971 read=952
  • I/O Timings: read=14.184
18. 21.428 92.850 ↓ 3.0 21,096 1

Hash (cost=5,937.50..5,937.50 rows=7,035 width=157) (actual time=92.850..92.850 rows=21,096 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: 3078kB
  • Buffers: shared hit=4033
19. 18.493 71.422 ↓ 3.0 21,096 1

Hash Join (cost=1.05..5,937.50 rows=7,035 width=157) (actual time=0.053..71.422 rows=21,096 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=4033
20. 52.910 52.910 ↑ 1.0 21,096 1

Seq Scan on sickdoc.sickdoc s (cost=0.00..5,786.95 rows=21,106 width=163) (actual time=0.018..52.910 rows=21,096 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: 119300
  • Buffers: shared hit=4032
21. 0.005 0.019 ↑ 1.0 1 1

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

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

Seq Scan on sickdoc.rf_kind kind (cost=0.00..1.04 rows=1 width=6) (actual time=0.011..0.014 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.005 0.014 ↑ 1.0 5 1

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

  • Output: state.code, state.id
  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=1
24. 0.009 0.009 ↑ 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.009 rows=5 loops=1)

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

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

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

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

  • Output: type.code, type.id
  • Buffers: shared hit=1
27. 253.152 253.152 ↑ 1.0 1 21,096

Index Scan using pim_individual_pk on public.pim_individual individual (cost=0.43..6.71 rows=1 width=62) (actual time=0.011..0.012 rows=1 loops=21,096)

  • 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=82959 read=1567
  • I/O Timings: read=65.111
28. 0.018 0.034 ↑ 1.0 7 1

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

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

  • Output: rwo.code, rwo.id
  • Buffers: shared hit=1
30. 30.724 969.267 ↓ 58.3 69,651 1

Materialize (cost=31,914.00..39,749.96 rows=1,194 width=456) (actual time=370.535..969.267 rows=69,651 loops=1)

  • Output: fss_request.stacktrace, fss_request.sicklist_n2o_id, fss_request_state.id, fss_request_state.name
  • Buffers: shared hit=8198
31. 116.935 938.543 ↓ 58.3 69,651 1

Nested Loop Left Join (cost=31,914.00..39,746.97 rows=1,194 width=456) (actual time=370.520..938.543 rows=69,651 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: 208953
  • Buffers: shared hit=8198
32. 52.129 821.608 ↓ 58.3 69,651 1

Subquery Scan on fss_request (cost=31,914.00..39,674.28 rows=1,194 width=431) (actual time=370.448..821.608 rows=69,651 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: 136125
  • Buffers: shared hit=8197
33. 273.197 769.479 ↑ 1.2 205,776 1

WindowAgg (cost=31,914.00..36,689.56 rows=238,778 width=439) (actual time=370.401..769.479 rows=205,776 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=8197
34. 347.399 496.282 ↑ 1.2 205,776 1

Sort (cost=31,914.00..32,510.94 rows=238,778 width=439) (actual time=370.331..496.282 rows=205,776 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: 37605kB
  • Buffers: shared hit=8197
35. 148.883 148.883 ↑ 1.0 238,778 1

Seq Scan on sickdoc.fss_request r (cost=0.00..10,584.78 rows=238,778 width=439) (actual time=0.015..148.883 rows=238,778 loops=1)

  • Output: r.create_dt, r.sicklist_n2o_id, r.state_id, r.stacktrace
  • Buffers: shared hit=8197
36. 0.000 0.000 ↑ 1.0 4 69,651

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

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

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

  • Output: fss_request_state.id, fss_request_state.name
  • Buffers: shared hit=1
38. 10.971 166.454 ↓ 185.3 12,788 1

Materialize (cost=6,733.81..7,147.18 rows=69 width=24) (actual time=94.156..166.454 rows=12,788 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=4032
39. 8.320 155.483 ↓ 185.3 12,788 1

Subquery Scan on s_continue (cost=6,733.81..7,147.00 rows=69 width=24) (actual time=94.139..155.483 rows=12,788 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: 19
  • Buffers: shared hit=4032
40. 42.958 147.163 ↑ 1.1 12,807 1

WindowAgg (cost=6,733.81..6,974.84 rows=13,773 width=24) (actual time=94.110..147.163 rows=12,807 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=4032
41. 17.425 104.205 ↑ 1.1 12,807 1

Sort (cost=6,733.81..6,768.25 rows=13,773 width=24) (actual time=94.051..104.205 rows=12,807 loops=1)

  • Output: c.parent_id, c.id, c.clinic_id, c.number
  • Sort Key: c.parent_id
  • Sort Method: quicksort Memory: 1445kB
  • Buffers: shared hit=4032
42. 86.780 86.780 ↑ 1.0 13,573 1

Seq Scan on sickdoc.sickdoc c (cost=0.00..5,786.95 rows=13,773 width=24) (actual time=0.050..86.780 rows=13,573 loops=1)

  • Output: c.parent_id, c.id, c.clinic_id, c.number
  • Filter: (c.type_id = 2)
  • Rows Removed by Filter: 126823
  • Buffers: shared hit=4032
43. 0.030 0.071 ↑ 1.0 71 1

Hash (cost=2.71..2.71 rows=71 width=29) (actual time=0.071..0.071 rows=71 loops=1)

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

Seq Scan on sickdoc.journal sj (cost=0.00..2.71 rows=71 width=29) (actual time=0.015..0.041 rows=71 loops=1)

  • Output: sj.name, sj.id
  • Buffers: shared hit=2
45. 46.427 163.129 ↑ 1.0 140,396 1

Hash (cost=5,435.96..5,435.96 rows=140,396 width=13) (actual time=163.129..163.129 rows=140,396 loops=1)

  • Output: sp.type_id, sp.id, sp.is_eln, sp.fss_state_code
  • Buckets: 262144 Batches: 1 Memory Usage: 7877kB
  • Buffers: shared hit=4032
46. 116.702 116.702 ↑ 1.0 140,396 1

Seq Scan on sickdoc.sickdoc sp (cost=0.00..5,435.96 rows=140,396 width=13) (actual time=0.013..116.702 rows=140,396 loops=1)

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

SubPlan (forHash Left Join)

48. 28.342 283.420 ↑ 1.0 1 14,171

Limit (cost=8.50..8.51 rows=1 width=8) (actual time=0.020..0.020 rows=1 loops=14,171)

  • Output: p.issued_employee_id, p.from_dt
  • Buffers: shared hit=69946
49. 85.026 255.078 ↑ 2.0 1 14,171

Sort (cost=8.50..8.51 rows=2 width=8) (actual time=0.018..0.018 rows=1 loops=14,171)

  • Output: p.issued_employee_id, p.from_dt
  • Sort Key: p.from_dt DESC
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=69946
50. 170.052 170.052 ↑ 1.0 2 14,171

Index Scan using period_sickdoc_id_ix on sickdoc.period p (cost=0.42..8.49 rows=2 width=8) (actual time=0.010..0.012 rows=2 loops=14,171)

  • Output: p.issued_employee_id, p.from_dt
  • Index Cond: (p.sickdoc_id = s.id)
  • Buffers: shared hit=69946
51. 14.471 969.557 ↑ 1.0 1 14,471

Limit (cost=37.74..37.74 rows=1 width=105) (actual time=0.067..0.067 rows=1 loops=14,471)

  • 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=451620
52. 57.884 955.086 ↑ 2.0 1 14,471

Sort (cost=37.74..37.74 rows=2 width=105) (actual time=0.066..0.066 rows=1 loops=14,471)

  • 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=451620
53. 201.054 897.202 ↑ 1.0 2 14,471

Nested Loop (cost=1.72..37.73 rows=2 width=105) (actual time=0.037..0.062 rows=2 loops=14,471)

  • 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=451620
54. 27.710 549.898 ↑ 1.0 2 14,471

Nested Loop (cost=1.29..26.63 rows=2 width=59) (actual time=0.023..0.038 rows=2 loops=14,471)

  • Output: p_1.from_dt, pp.name, e.individual_id
  • Buffers: shared hit=334620
55. 27.710 405.188 ↑ 1.0 2 14,471

Nested Loop (cost=1.00..25.89 rows=2 width=59) (actual time=0.017..0.028 rows=2 loops=14,471)

  • Output: p_1.from_dt, ep.employee_id, pp.name
  • Buffers: shared hit=246789
56. 71.119 260.478 ↑ 1.0 2 14,471

Nested Loop (cost=0.71..25.13 rows=2 width=12) (actual time=0.011..0.018 rows=2 loops=14,471)

  • Output: p_1.from_dt, ep.position_id, ep.employee_id
  • Buffers: shared hit=159039
57. 72.355 72.355 ↑ 1.0 2 14,471

Index Scan using period_sickdoc_id_ix on sickdoc.period p_1 (cost=0.42..8.49 rows=2 width=8) (actual time=0.004..0.005 rows=2 loops=14,471)

  • 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=71289
58. 117.004 117.004 ↑ 1.0 1 29,251

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=29,251)

  • 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=87750
59. 117.000 117.000 ↑ 1.0 1 29,250

Index Scan using pim_position_pk on public.pim_position pp (cost=0.29..0.37 rows=1 width=55) (actual time=0.004..0.004 rows=1 loops=29,250)

  • 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=87750
60. 117.000 117.000 ↑ 1.0 1 29,250

Index Scan using pim_employee_pk on public.pim_employee e (cost=0.29..0.36 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=29,250)

  • 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=87831
61. 146.250 146.250 ↑ 1.0 1 29,250

Index Scan using pim_individual_pk on public.pim_individual i (cost=0.43..5.52 rows=1 width=54) (actual time=0.005..0.005 rows=1 loops=29,250)

  • 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=117000
62. 0.000 0.000 ↓ 0.0 0

Limit (cost=8.51..8.52 rows=1 width=44) (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.52 rows=2 width=44) (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=44) (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. 63.288 189.864 ↑ 1.0 1 21,096

Aggregate (cost=8.46..8.47 rows=1 width=0) (actual time=0.009..0.009 rows=1 loops=21,096)

  • Output: (count(1) > 1)
  • Buffers: shared hit=66381
66. 126.576 126.576 ↑ 1.0 2 21,096

Index Only Scan using period_sickdoc_id_ix on sickdoc.period (cost=0.42..8.46 rows=2 width=0) (actual time=0.006..0.006 rows=2 loops=21,096)

  • Output: period.sickdoc_id
  • Index Cond: (period.sickdoc_id = s.id)
  • Heap Fetches: 3139
  • Buffers: shared hit=66381
67. 147.672 147.672 ↑ 1.0 1 21,096

Seq Scan on public.md_sl_disability_reason _sdr (cost=0.00..1.19 rows=1 width=3) (actual time=0.005..0.007 rows=1 loops=21,096)

  • Output: ((_sdr.code)::text = '05'::text)
  • Filter: (_sdr.id = se.disability_reason_id)
  • Rows Removed by Filter: 14
  • Buffers: shared hit=21096
68. 105.480 105.480 ↑ 1.0 1 21,096

Seq Scan on public.md_sl_disability_reason _sdr_1 (cost=0.00..1.19 rows=1 width=3) (actual time=0.003..0.005 rows=1 loops=21,096)

  • Output: ((_sdr_1.code)::text <> '05'::text)
  • Filter: (_sdr_1.id = se.disability_reason_id)
  • Rows Removed by Filter: 14
  • Buffers: shared hit=21096
69. 42.192 358.632 ↑ 1.0 1 21,096

Limit (cost=8.50..8.51 rows=1 width=8) (actual time=0.017..0.017 rows=1 loops=21,096)

  • Output: p_3.issued_employee_id, p_3.from_dt
  • Buffers: shared hit=99596
70. 126.576 316.440 ↑ 2.0 1 21,096

Sort (cost=8.50..8.51 rows=2 width=8) (actual time=0.015..0.015 rows=1 loops=21,096)

  • Output: p_3.issued_employee_id, p_3.from_dt
  • Sort Key: p_3.from_dt
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=99596
71. 189.864 189.864 ↑ 1.0 2 21,096

Index Scan using period_sickdoc_id_ix on sickdoc.period p_3 (cost=0.42..8.49 rows=2 width=8) (actual time=0.008..0.009 rows=2 loops=21,096)

  • Output: p_3.issued_employee_id, p_3.from_dt
  • Index Cond: (p_3.sickdoc_id = s.id)
  • Buffers: shared hit=99596
72. 21.096 1,202.472 ↑ 1.0 1 21,096

Limit (cost=37.74..37.74 rows=1 width=105) (actual time=0.057..0.057 rows=1 loops=21,096)

  • 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=575376 read=3
  • I/O Timings: read=0.096
73. 84.384 1,181.376 ↑ 2.0 1 21,096

Sort (cost=37.74..37.74 rows=2 width=105) (actual time=0.056..0.056 rows=1 loops=21,096)

  • 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=575376 read=3
  • I/O Timings: read=0.096
74. 238.975 1,096.992 ↑ 1.0 2 21,096

Nested Loop (cost=1.72..37.73 rows=2 width=105) (actual time=0.032..0.052 rows=2 loops=21,096)

  • 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=575376 read=3
  • I/O Timings: read=0.096
75. 22.412 675.072 ↑ 1.0 2 21,096

Nested Loop (cost=1.29..26.63 rows=2 width=59) (actual time=0.020..0.032 rows=2 loops=21,096)

  • Output: p_4.from_dt, pp_1.name, e_1.individual_id
  • Buffers: shared hit=429023
76. 43.508 506.304 ↑ 1.0 2 21,096

Nested Loop (cost=1.00..25.89 rows=2 width=59) (actual time=0.015..0.024 rows=2 loops=21,096)

  • Output: p_4.from_dt, ep_1.employee_id, pp_1.name
  • Buffers: shared hit=319130
77. 58.332 316.440 ↑ 1.0 2 21,096

Nested Loop (cost=0.71..25.13 rows=2 width=12) (actual time=0.009..0.015 rows=2 loops=21,096)

  • Output: p_4.from_dt, ep_1.position_id, ep_1.employee_id
  • Buffers: shared hit=209363
78. 105.480 105.480 ↑ 1.0 2 21,096

Index Scan using period_sickdoc_id_ix on sickdoc.period p_4 (cost=0.42..8.49 rows=2 width=8) (actual time=0.004..0.005 rows=2 loops=21,096)

  • 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=99596
79. 152.628 152.628 ↑ 1.0 1 38,157

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.004..0.004 rows=1 loops=38,157)

  • 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=109767
80. 146.356 146.356 ↑ 1.0 1 36,589

Index Scan using pim_position_pk on public.pim_position pp_1 (cost=0.29..0.37 rows=1 width=55) (actual time=0.003..0.004 rows=1 loops=36,589)

  • 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=109767
81. 146.356 146.356 ↑ 1.0 1 36,589

Index Scan using pim_employee_pk on public.pim_employee e_1 (cost=0.29..0.36 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=36,589)

  • 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=109893
82. 182.945 182.945 ↑ 1.0 1 36,589

Index Scan using pim_individual_pk on public.pim_individual i_1 (cost=0.43..5.52 rows=1 width=54) (actual time=0.005..0.005 rows=1 loops=36,589)

  • 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=146353 read=3
  • I/O Timings: read=0.096
83. 1.729 13.832 ↑ 1.0 1 1,729

Limit (cost=8.51..8.52 rows=1 width=44) (actual time=0.008..0.008 rows=1 loops=1,729)

  • Output: ((((p_5.issued_employee_print)::text || ' '::text) || (p_5.issued_employee_position)::text)), p_5.from_dt
  • Buffers: shared hit=6763
84. 5.187 12.103 ↑ 2.0 1 1,729

Sort (cost=8.51..8.52 rows=2 width=44) (actual time=0.007..0.007 rows=1 loops=1,729)

  • 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=6763
85. 6.916 6.916 ↑ 2.0 1 1,729

Index Scan using period_sickdoc_id_ix on sickdoc.period p_5 (cost=0.42..8.50 rows=2 width=44) (actual time=0.004..0.004 rows=1 loops=1,729)

  • 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=6763
86. 105.480 105.480 ↑ 1.0 1 21,096

Index Scan using pim_organization_pk on public.pim_organization o (cost=0.29..8.31 rows=1 width=91) (actual time=0.005..0.005 rows=1 loops=21,096)

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

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

  • Filter: ((sickdoc.parent_id = s.id) AND (sickdoc.type_id = 3))
88. 83.202 83.202 ↓ 1.0 1,884 1

Seq Scan on sickdoc.sickdoc sickdoc_1 (cost=0.00..5,786.95 rows=1,835 width=4) (actual time=0.081..83.202 rows=1,884 loops=1)

  • Output: sickdoc_1.parent_id
  • Filter: (sickdoc_1.type_id = 3)
  • Rows Removed by Filter: 138512
  • Buffers: shared hit=4032
89. 4.924 4.924 ↓ 0.0 0 2,462

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

  • Output: o_1.short_name
  • Index Cond: (o_1.id = s.workplace_id)
  • Buffers: shared hit=720
90. 189.864 316.440 ↓ 0.0 0 21,096

Limit (cost=0.00..1.11 rows=1 width=31) (actual time=0.015..0.015 rows=0 loops=21,096)

  • Output: fss_state.name
  • Buffers: shared hit=21096
91. 126.576 126.576 ↓ 0.0 0 21,096

Seq Scan on sickdoc.fss_sickdoc_state fss_state (cost=0.00..1.11 rows=1 width=31) (actual time=0.006..0.006 rows=0 loops=21,096)

  • Output: fss_state.name
  • Filter: ((fss_state.code)::text = (s.fss_state_code)::text)
  • Rows Removed by Filter: 8
  • Buffers: shared hit=21096
92. 0.000 0.000 ↓ 0.0 0

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

  • Filter: (s2.parent_id = s.id)
93. 74.786 74.786 ↑ 1.0 140,396 1

Seq Scan on sickdoc.sickdoc s2_1 (cost=0.00..5,435.96 rows=140,396 width=4) (actual time=0.008..74.786 rows=140,396 loops=1)

  • Output: s2_1.parent_id
  • Buffers: shared hit=4032
94. 42.192 232.056 ↓ 0.0 0 21,096

Result (cost=0.42..8.49 rows=1 width=0) (actual time=0.011..0.011 rows=0 loops=21,096)

  • One-Time Filter: (s.is_from_fss IS NULL)
  • Buffers: shared hit=94504
95. 189.864 189.864 ↓ 0.0 0 21,096

Index Scan using period_sickdoc_id_ix on sickdoc.period p_6 (cost=0.42..8.49 rows=1 width=0) (actual time=0.009..0.009 rows=0 loops=21,096)

  • 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=94504
96. 6.418 41.717 ↑ 1.0 1 3,209

Limit (cost=8.51..8.51 rows=1 width=26) (actual time=0.012..0.013 rows=1 loops=3,209)

  • 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=13358
97. 19.254 35.299 ↑ 2.0 1 3,209

Sort (cost=8.51..8.51 rows=2 width=26) (actual time=0.011..0.011 rows=1 loops=3,209)

  • 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=13358
98. 16.045 16.045 ↑ 2.0 1 3,209

Index Scan using period_sickdoc_id_ix on sickdoc.period p_7 (cost=0.42..8.50 rows=2 width=26) (actual time=0.004..0.005 rows=1 loops=3,209)

  • 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=13358
99. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.84..12.94 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..4.44 rows=1 width=4) (never executed)

  • Output: ms.id
  • Index Cond: (ms.id = s.id)
  • Heap Fetches: 0
102. 61.002 221.131 ↓ 1.0 118,765 1

Hash Join (cost=5,897.31..13,948.98 rows=115,988 width=4) (actual time=64.159..221.131 rows=118,765 loops=1)

  • Output: p_9.sickdoc_id
  • Hash Cond: (p_9.sickdoc_id = ms_1.id)
  • Buffers: shared hit=4766
103. 97.901 97.901 ↓ 1.0 118,765 1

Seq Scan on sickdoc.period p_9 (cost=0.00..6,456.83 rows=115,988 width=4) (actual time=0.038..97.901 rows=118,765 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: 105284
  • Buffers: shared hit=4258
104. 36.279 62.228 ↑ 1.0 140,396 1

Hash (cost=4,142.36..4,142.36 rows=140,396 width=4) (actual time=62.228..62.228 rows=140,396 loops=1)

  • Output: ms_1.id
  • Buckets: 262144 Batches: 1 Memory Usage: 6984kB
  • Buffers: shared hit=508
105. 25.949 25.949 ↑ 1.0 140,396 1

Index Only Scan using sickdoc_pk on sickdoc.sickdoc ms_1 (cost=0.42..4,142.36 rows=140,396 width=4) (actual time=0.055..25.949 rows=140,396 loops=1)

  • Output: ms_1.id
  • Heap Fetches: 0
  • Buffers: shared hit=508
106. 0.000 0.000 ↓ 0.0 0 10,065

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

  • One-Time Filter: s.is_eln
  • Buffers: shared hit=546
107. 0.684 0.684 ↓ 0.0 0 171

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

  • 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=546
108. 0.000 0.000 ↓ 0.0 0 10,061

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

  • One-Time Filter: s.is_eln
  • Buffers: shared hit=530
109. 0.501 0.501 ↓ 0.0 0 167

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

  • 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=530
110. 0.000 0.000 ↓ 0.0 0 10,061

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

  • One-Time Filter: s.is_eln
  • Buffers: shared hit=503
111. 0.501 0.501 ↓ 0.0 0 167

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.003..0.003 rows=0 loops=167)

  • Output: p_12.sickdoc_id
  • Index Cond: (p_12.sickdoc_id = s.id)
  • Heap Fetches: 1
  • Buffers: shared hit=503
112. 25.374 1,750.806 ↑ 1.0 1 12,687

Limit (cost=9.01..9.01 rows=1 width=26) (actual time=0.138..0.138 rows=1 loops=12,687)

  • 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=139884
113. 76.122 1,725.432 ↑ 2.0 1 12,687

Sort (cost=9.01..9.01 rows=2 width=26) (actual time=0.136..0.136 rows=1 loops=12,687)

  • 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=139884
114. 1,649.310 1,649.310 ↑ 1.0 2 12,687

Index Scan using period_sickdoc_id_ix on sickdoc.period p_13 (cost=0.42..9.00 rows=2 width=26) (actual time=0.081..0.130 rows=2 loops=12,687)

  • 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=139884
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. 89.282 89.282 ↓ 1.0 224,049 1

Seq Scan on sickdoc.period period_2 (cost=0.00..6,456.83 rows=219,883 width=4) (actual time=0.007..89.282 rows=224,049 loops=1)

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