explain.depesz.com

PostgreSQL's explain analyze made readable

Result: cVIH

Settings
# exclusive inclusive rows x rows loops node
1. 65.163 2,584,939.218 ↑ 317.4 38,637 1

Hash Left Join (cost=270,004,211.73..1,999,096,951.20 rows=12,265,119 width=382) (actual time=2,190,542.821..2,584,939.218 rows=38,637 loops=1)

  • Hash Cond: ((public.t_altes.origen)::text = (t_origen.codigo)::text)
2. 44.602 2,584,874.041 ↑ 317.4 38,637 1

Hash Left Join (cost=270,004,210.39..1,998,836,316.08 rows=12,265,119 width=365) (actual time=2,190,542.784..2,584,874.041 rows=38,637 loops=1)

  • Hash Cond: (("substring"(max(CASE WHEN ((public.t_altes.tipus_assistencia)::text = '99'::text) THEN '64-No99'::text WHEN ((public.t_altes.tipfinancia)::text <> '1'::text) THEN '63-NoSCS'::text WHEN ((public.t_altes.tipus_assistencia)::text = '6'::text) THEN '62-210200'::text WHEN (((public.t_altes.tipus_assistencia)::text = '9'::text) AND ((public.t_altes.servalta)::text = 'PALH'::text)) THEN '61-NoPALH'::text WHEN (((public.t_altes.tipus_assistencia)::text = '4'::text) AND ((public.t_altes.financia)::text = '94'::text)) THEN '60-242010'::text WHEN (((public.t_altes.tipus_assistencia)::text = '4'::text) AND ((public.t_altes.financia)::text = '96'::text) AND ((public.t_altes.cod_enferme)::text = 'HDTEA'::text)) THEN '59-TEA'::text WHEN (((public.t_altes.tipus_assistencia)::text = '4'::text) AND ((public.t_altes.financia)::text = '96'::text)) THEN '58-242020'::text WHEN ((public.t_altes.tipus_assistencia)::text = '4'::text) THEN '57-NoSMdi'::text WHEN ((public.t_altes.tipus_assistencia)::text = '88'::text) THEN '56-No88'::text WHEN (((public.t_altes.tipus_assistencia)::text = '3'::text) AND ((public.t_altes.procedencia)::text = ANY ('{15,16}'::text[]))) THEN '55-114001'::text WHEN (((public.t_altes.tipus_assistencia)::text = '3'::text) AND ((public.t_altes.procedencia)::text <> ALL ('{15,16}'::text[]))) THEN '55-482700'::text WHEN ((public.t_altes.c_proc_1 IS NULL) AND (public.t_altes.c_proc_2 IS NULL) AND (public.t_altes.c_diag_1 IS NULL) AND (public.t_altes.c_diag_2 IS NULL) AND ((public.t_altes.servalta)::text = ANY ('{USU,USUH}'::text[]))) THEN '54-VACIO2'::text WHEN ((public.t_altes.c_proc_1 IS NULL) AND (public.t_altes.c_proc_2 IS NULL) AND (public.t_altes.c_diag_1 IS NULL) AND (public.t_altes.c_diag_2 IS NULL)) THEN '54-VACIO'::text WHEN ((pt.concepte)::text = '170525'::text) THEN '53-170525'::text WHEN ((pt.concepte)::text = '170537'::text) THEN '52-170537'::text WHEN (((d1.concepte)::text = '149900-DP'::text) AND ((pt.concepte)::text = '149900'::text)) THEN '51-149900'::text WHEN ((((d1.concepte)::text = '149935-DP'::text) OR ((dt.concepte)::text = '149935-DS'::text)) AND ((pt.concepte)::text = '149935'::text)) THEN '50-149935'::text WHEN (((d1.concepte)::text = '149915-DP'::text) AND (((pt.concepte)::text = '149915-Pcon1A'::text) OR ((pt.concepte)::text = '149915-Pcon2A'::text) OR (((pt.concepte)::text = '149915-Pcon1A'::text) AND ((ptbis.concepte)::text = '149915-Pcon1B'::text)) OR (((pt.concepte)::text = '149915-Pcon2A'::text) AND ((ptbis.concepte)::text = '149915-Pcon2B'::text)))) THEN '84-149915'::text WHEN (((d1.concepte)::text = '149910-DP'::text) AND ((pt.concepte)::text = '149910'::text)) THEN '49-149910'::text WHEN ((((d1.concepte)::text = '149920-DP'::text) OR ((dt.concepte)::text = '149920-DS'::text)) AND (((pt.concepte)::text = '149920'::text) OR (((pt.concepte)::text = '149920-Pcon1A'::text) AND ((ptbis.concepte)::text = '149920-Pcon1B'::text)) OR (((pt.concepte)::text = '149920-Pcon2A'::text) AND ((ptbis.concepte)::text = '149920-Pcon2B'::text)))) THEN '48-149920'::text WHEN ((((d1.concepte)::text = '149930-DP'::text) OR ((dt.concepte)::text = '149930-DS'::text)) AND ((pt.concepte)::text = '149930'::text)) THEN '47-149930'::text WHEN ((((d1.concepte)::text = '149925-DP'::text) OR (((d1.concepte)::text = '149925-DP-DS'::text) AND ((dt.concepte)::text = '149925-DS'::text))) AND ((pt.concepte)::text = '149925'::text)) THEN '46-149925'::text WHEN (((d1.concepte)::text = '179012-DP'::text) AND ((pt.concepte)::text = '179012'::text)) THEN '45-179012'::text WHEN (((d1.concepte)::text = '148100-DP'::text) AND (((pt.concepte)::text = '148100-P1'::text) OR ((ptbis.concepte)::text = '148100-P2'::text))) THEN '44-148100'::text WHEN ((pt.concepte)::text = '115003'::text) THEN '43-115003'::text WHEN ((pt.concepte)::text = '115004'::text) THEN '42-115004'::text WHEN (((CASE WHEN (((((((public.t_altes.fecha_alta)::character(10))::text || ' '::text) || ((public.t_altes.hora_alta)::character(8))::text))::timestamp without time zone - (((((public.t_altes.fecha_ingreso)::character(10))::text || ' '::text) || ((public.t_altes.hora_ingreso)::character(8))::text))::timestamp without time zone) >= '16:00:00'::interval) THEN 'H - estada >= 16 horas'::text ELSE 'C - estada < 16 horas'::text END) = 'H - estada >= 16 horas'::text) AND ((pt.concepte)::text = '115015'::text)) THEN '41-115015'::text WHEN (((CASE WHEN (((((((public.t_altes.fecha_alta)::character(10))::text || ' '::text) || ((public.t_altes.hora_alta)::character(8))::text))::timestamp without time zone - (((((public.t_altes.fecha_ingreso)::character(10))::text || ' '::text) || ((public.t_altes.hora_ingreso)::character(8))::text))::timestamp without time zone) >= '16:00:00'::interval) THEN 'H - estada >= 16 horas'::text ELSE 'C - estada < 16 horas'::text END) = 'C - estada < 16 horas'::text) AND ((pt.concepte)::text = '115015'::text)) THEN '40-115115'::text WHEN (((CASE WHEN (((((((public.t_altes.fecha_alta)::character(10))::text || ' '::text) || ((public.t_altes.hora_alta)::character(8))::text))::timestamp without time zone - (((((public.t_altes.fecha_ingreso)::character(10))::text || ' '::text) || ((public.t_altes.hora_ingreso)::character(8))::text))::timestamp without time zone) >= '16:00:00'::interval) THEN 'H - estada >= 16 horas'::text ELSE 'C - estada < 16 horas'::text END) = 'H - estada >= 16 horas'::text) AND ((d1.concepte)::text = '114002-D'::text)) THEN '39-114002'::text WHEN (((CASE WHEN (((((((public.t_altes.fecha_alta)::character(10))::text || ' '::text) || ((public.t_altes.hora_alta)::character(8))::text))::timestamp without time zone - (((((public.t_altes.fecha_ingreso)::character(10))::text || ' '::text) || ((public.t_altes.hora_ingreso)::character(8))::text))::timestamp without time zone) >= '16:00:00'::interval) THEN 'H - estada >= 16 horas'::text ELSE 'C - estada < 16 horas'::text END) = 'C - estada < 16 horas'::text) AND ((d1.concepte)::text = '114002-D'::text) AND ((pt.concepte)::text = '114002'::text)) THEN '36-114002'::text WHEN (((d1.concepte)::text = '149450-DP'::text) AND ((pt.concepte)::text = '149450'::text)) THEN '35-149450'::text WHEN (((CASE WHEN (((((((public.t_altes.fecha_alta)::character(10))::text || ' '::text) || ((public.t_altes.hora_alta)::character(8))::text))::timestamp without time zone - (((((public.t_altes.fecha_ingreso)::character(10))::text || ' '::text) || ((public.t_altes.hora_ingreso)::character(8))::text))::timestamp without time zone) >= '16:00:00'::interval) THEN 'H - estada >= 16 horas'::text ELSE 'C - estada < 16 horas'::text END) = 'H - estada >= 16 horas'::text) AND ((CASE WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) < 15::numeric) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_1)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_2)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_3)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_4)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_5)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_6)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_7)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_8)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_9)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_10)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_11)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_12)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_13)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_14)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_15)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) >= 15::numeric) THEN 'ADULT'::text ELSE 'ERROR'::text END) = 'ADULT'::text) AND ((pt.concepte)::text = 'QUI-MAJ-ADU'::text)) THEN '34-115000'::text WHEN (((CASE WHEN (((((((public.t_altes.fecha_alta)::character(10))::text || ' '::text) || ((public.t_altes.hora_alta)::character(8))::text))::timestamp without time zone - (((((public.t_altes.fecha_ingreso)::character(10))::text || ' '::text) || ((public.t_altes.hora_ingreso)::character(8))::text))::timestamp without time zone) >= '16:00:00'::interval) THEN 'H - estada >= 16 horas'::text ELSE 'C - estada < 16 horas'::text END) = 'C - estada < 16 horas'::text) AND ((CASE WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) < 15::numeric) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_1)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_2)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_3)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_4)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_5)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_6)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_7)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_8)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_9)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_10)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_11)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_12)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_13)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_14)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_15)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) >= 15::numeric) THEN 'ADULT'::text ELSE 'ERROR'::text END) = 'ADULT'::text) AND ((pt.concepte)::text = 'QUI-MAJ-ADU'::text)) THEN '33-115001'::text WHEN (((CASE WHEN (((((((public.t_altes.fecha_alta)::character(10))::text || ' '::text) || ((public.t_altes.hora_alta)::character(8))::text))::timestamp without time zone - (((((public.t_altes.fecha_ingreso)::character(10))::text || ' '::text) || ((public.t_altes.hora_ingreso)::character(8))::text))::timestamp without time zone) >= '16:00:00'::interval) THEN 'H - estada >= 16 horas'::text ELSE 'C - estada < 16 horas'::text END) = 'H - estada >= 16 horas'::text) AND ((CASE WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) < 15::numeric) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_1)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_2)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_3)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_4)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_5)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_6)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_7)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_8)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_9)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_10)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_11)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_12)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_13)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_14)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_15)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) >= 15::numeric) THEN 'ADULT'::text ELSE 'ERROR'::text END) = 'NEN-RM'::text) AND ((pt.concepte)::text = 'QUI-MAJ-NEN'::text)) THEN '32-115000'::text WHEN (((CASE WHEN (((((((public.t_altes.fecha_alta)::character(10))::text || ' '::text) || ((public.t_altes.hora_alta)::character(8))::text))::timestamp without time zone - (((((public.t_altes.fecha_ingreso)::character(10))::text || ' '::text) || ((public.t_altes.hora_ingreso)::character(8))::text))::timestamp without time zone) >= '16:00:00'::interval) THEN 'H - estada >= 16 horas'::text ELSE 'C - estada < 16 horas'::text END) = 'C - estada < 16 horas'::text) AND ((CASE WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) < 15::numeric) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_1)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_2)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_3)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_4)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_5)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_6)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_7)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_8)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_9)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_10)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_11)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_12)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_13)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_14)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_15)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) >= 15::numeric) THEN 'ADULT'::text ELSE 'ERROR'::text END) = 'NEN-RM'::text) AND ((pt.concepte)::text = 'QUI-MAJ-NEN'::text)) THEN '31-115001'::text WHEN (((CASE WHEN (((((((public.t_altes.fecha_alta)::character(10))::text || ' '::text) || ((public.t_altes.hora_alta)::character(8))::text))::timestamp without time zone - (((((public.t_altes.fecha_ingreso)::character(10))::text || ' '::text) || ((public.t_altes.hora_ingreso)::character(8))::text))::timestamp without time zone) >= '16:00:00'::interval) THEN 'H - estada >= 16 horas'::text ELSE 'C - estada < 16 horas'::text END) = 'H - estada >= 16 horas'::text) AND ((CASE WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) < 15::numeric) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_1)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_2)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_3)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_4)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_5)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_6)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_7)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_8)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_9)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_10)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_11)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_12)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_13)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_14)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_15)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) >= 15::numeric) THEN 'ADULT'::text ELSE 'ERROR'::text END) = 'ADULT'::text) AND ((pt.concepte)::text = 'COND1-A'::text) AND ((pt.concepte)::text = 'COND1-B'::text)) THEN '30-11500I'::text WHEN (((CASE WHEN (((((((public.t_altes.fecha_alta)::character(10))::text || ' '::text) || ((public.t_altes.hora_alta)::character(8))::text))::timestamp without time zone - (((((public.t_altes.fecha_ingreso)::character(10))::text || ' '::text) || ((public.t_altes.hora_ingreso)::character(8))::text))::timestamp without time zone) >= '16:00:00'::interval) THEN 'H - estada >= 16 horas'::text ELSE 'C - estada < 16 horas'::text END) = 'C - estada < 16 horas'::text) AND ((CASE WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) < 15::numeric) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_1)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_2)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_3)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_4)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_5)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_6)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_7)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_8)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_9)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_10)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_11)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_12)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_13)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_14)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_15)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) >= 15::numeric) THEN 'ADULT'::text ELSE 'ERROR'::text END) = 'ADULT'::text) AND ((pt.concepte)::text = 'COND1-A'::text) AND ((pt.concepte)::text = 'COND1-B'::text)) THEN '29-11500A'::text WHEN (((CASE WHEN (((((((public.t_altes.fecha_alta)::character(10))::text || ' '::text) || ((public.t_altes.hora_alta)::character(8))::text))::timestamp without time zone - (((((public.t_altes.fecha_ingreso)::character(10))::text || ' '::text) || ((public.t_altes.hora_ingreso)::character(8))::text))::timestamp without time zone) >= '16:00:00'::interval) THEN 'H - estada >= 16 horas'::text ELSE 'C - estada < 16 horas'::text END) = 'H - estada >= 16 horas'::text) AND ((CASE WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) < 15::numeric) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_1)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_2)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_3)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_4)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_5)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_6)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_7)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_8)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_9)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_10)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_11)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_12)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_13)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_14)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_15)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) >= 15::numeric) THEN 'ADULT'::text ELSE 'ERROR'::text END) = 'ADULT'::text) AND ((pt.concepte)::text = 'COND2-A'::text) AND ((d1.concepte)::text = 'D-NEO'::text)) THEN '28-11500I'::text WHEN (((CASE WHEN (((((((public.t_altes.fecha_alta)::character(10))::text || ' '::text) || ((public.t_altes.hora_alta)::character(8))::text))::timestamp without time zone - (((((public.t_altes.fecha_ingreso)::character(10))::text || ' '::text) || ((public.t_altes.hora_ingreso)::character(8))::text))::timestamp without time zone) >= '16:00:00'::interval) THEN 'H - estada >= 16 horas'::text ELSE 'C - estada < 16 horas'::text END) = 'C - estada < 16 horas'::text) AND ((CASE WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) < 15::numeric) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_1)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_2)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_3)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_4)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_5)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_6)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_7)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_8)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_9)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_10)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_11)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_12)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_13)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_14)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_15)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) >= 15::numeric) THEN 'ADULT'::text ELSE 'ERROR'::text END) = 'ADULT'::text) AND ((pt.concepte)::text = 'COND2-A'::text) AND ((d1.concepte)::text = 'D-NEO'::text)) THEN '27-11500A'::text WHEN (((CASE WHEN (((((((public.t_altes.fecha_alta)::character(10))::text || ' '::text) || ((public.t_altes.hora_alta)::character(8))::text))::timestamp without time zone - (((((public.t_altes.fecha_ingreso)::character(10))::text || ' '::text) || ((public.t_altes.hora_ingreso)::character(8))::text))::timestamp without time zone) >= '16:00:00'::interval) THEN 'H - estada >= 16 horas'::text ELSE 'C - estada < 16 horas'::text END) = 'H - estada >= 16 horas'::text) AND ((CASE WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) < 15::numeric) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_1)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_2)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_3)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_4)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_5)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_6)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_7)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_8)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_9)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_10)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_11)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_12)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_13)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_14)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_15)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) >= 15::numeric) THEN 'ADULT'::text ELSE 'ERROR'::text END) = 'ADULT'::text) AND ((pt.concepte)::text = 'COND3-A'::text)) THEN CASE WHEN ((d1.concepte)::text = 'DP-H353'::text) THEN ''::text ELSE '26-11500I'::text END WHEN (((CASE WHEN (((((((public.t_altes.fecha_alta)::character(10))::text || ' '::text) || ((public.t_altes.hora_alta)::character(8))::text))::timestamp without time zone - (((((public.t_altes.fecha_ingreso)::character(10))::text || ' '::text) || ((public.t_altes.hora_ingreso)::character(8))::text))::timestamp without time zone) >= '16:00:00'::interval) THEN 'H - estada >= 16 horas'::text ELSE 'C - estada < 16 horas'::text END) = 'C - estada < 16 horas'::text) AND ((CASE WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) < 15::numeric) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_1)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_2)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_3)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_4)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_5)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_6)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_7)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_8)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_9)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_10)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_11)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_12)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_13)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_14)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_15)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) >= 15::numeric) THEN 'ADULT'::text ELSE 'ERROR'::text END) = 'ADULT'::text) AND ((pt.concepte)::text = 'COND3-A'::text)) THEN CASE WHEN ((d1.concepte)::text = 'DP-H353'::text) THEN ''::text ELSE '25-11500A'::text END WHEN (((CASE WHEN (((((((public.t_altes.fecha_alta)::character(10))::text || ' '::text) || ((public.t_altes.hora_alta)::character(8))::text))::timestamp without time zone - (((((public.t_altes.fecha_ingreso)::character(10))::text || ' '::text) || ((public.t_altes.hora_ingreso)::character(8))::text))::timestamp without time zone) >= '16:00:00'::interval) THEN 'H - estada >= 16 horas'::text ELSE 'C - estada < 16 horas'::text END) = 'H - estada >= 16 horas'::text) AND ((CASE WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) < 15::numeric) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_1)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_2)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_3)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_4)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_5)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_6)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_7)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_8)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_9)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_10)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_11)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_12)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_13)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_14)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_15)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) >= 15::numeric) THEN 'ADULT'::text ELSE 'ERROR'::text END) = 'ADULT'::text) AND ((pt.concepte)::text = 'COND4-A'::text)) THEN CASE WHEN ((d1.concepte)::text = 'COND4-B'::text) THEN ''::text ELSE '24-11500I'::text END WHEN (((CASE WHEN (((((((public.t_altes.fecha_alta)::character(10))::text || ' '::text) || ((public.t_altes.hora_alta)::character(8))::text))::timestamp without time zone - (((((public.t_altes.fecha_ingreso)::character(10))::text || ' '::text) || ((public.t_altes.hora_ingreso)::character(8))::text))::timestamp without time zone) >= '16:00:00'::interval) THEN 'H - estada >= 16 horas'::text ELSE 'C - estada < 16 horas'::text END) = 'C - estada < 16 horas'::text) AND ((CASE WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) < 15::numeric) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_1)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_2)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_3)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_4)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_5)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_6)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_7)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_8)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_9)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_10)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_11)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_12)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_13)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_14)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_15)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) >= 15::numeric) THEN 'ADULT'::text ELSE 'ERROR'::text END) = 'ADULT'::text) AND ((pt.concepte)::text = 'COND4-A'::text)) THEN CASE WHEN ((d1.concepte)::text = 'COND4-B'::text) THEN ''::text ELSE '23-11500A'::text END WHEN (((CASE WHEN (((((((public.t_altes.fecha_alta)::character(10))::text || ' '::text) || ((public.t_altes.hora_alta)::character(8))::text))::timestamp without time zone - (((((public.t_altes.fecha_ingreso)::character(10))::text || ' '::text) || ((public.t_altes.hora_ingreso)::character(8))::text))::timestamp without time zone) >= '16:00:00'::interval) THEN 'H - estada >= 16 horas'::text ELSE 'C - estada < 16 horas'::text END) = 'H - estada >= 16 horas'::text) AND ((CASE WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) < 15::numeric) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_1)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_2)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_3)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_4)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_5)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_6)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_7)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_8)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_9)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_10)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_11)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_12)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_13)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_14)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_15)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) >= 15::numeric) THEN 'ADULT'::text ELSE 'ERROR'::text END) = 'NEN-RM'::text) AND ((pt.concepte)::text = 'COND1P-A'::text) AND ((pt.concepte)::text = 'COND1-B'::text)) THEN '22-11500I'::text WHEN (((CASE WHEN (((((((public.t_altes.fecha_alta)::character(10))::text || ' '::text) || ((public.t_altes.hora_alta)::character(8))::text))::timestamp without time zone - (((((public.t_altes.fecha_ingreso)::character(10))::text || ' '::text) || ((public.t_altes.hora_ingreso)::character(8))::text))::timestamp without time zone) >= '16:00:00'::interval) THEN 'H - estada >= 16 horas'::text ELSE 'C - estada < 16 horas'::text END) = 'C - estada < 16 horas'::text) AND ((CASE WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) < 15::numeric) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_1)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_2)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_3)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_4)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_5)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_6)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_7)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_8)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_9)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_10)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_11)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_12)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_13)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_14)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_15)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) >= 15::numeric) THEN 'ADULT'::text ELSE 'ERROR'::text END) = 'NEN-RM'::text) AND ((pt.concepte)::text = 'COND1P-A'::text) AND ((pt.concepte)::text = 'COND1-B'::text)) THEN '22-11500A'::text WHEN (((CASE WHEN (((((((public.t_altes.fecha_alta)::character(10))::text || ' '::text) || ((public.t_altes.hora_alta)::character(8))::text))::timestamp without time zone - (((((public.t_altes.fecha_ingreso)::character(10))::text || ' '::text) || ((public.t_altes.hora_ingreso)::character(8))::text))::timestamp without time zone) >= '16:00:00'::interval) THEN 'H - estada >= 16 horas'::text ELSE 'C - estada < 16 horas'::text END) = 'H - estada >= 16 horas'::text) AND ((CASE WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) < 15::numeric) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_1)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_2)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_3)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_4)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_5)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_6)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_7)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_8)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_9)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_10)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_11)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_12)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_13)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_14)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_15)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) >= 15::numeric) THEN 'ADULT'::text ELSE 'ERROR'::text END) = 'NEN-RM'::text) AND ((pt.concepte)::text = 'COND2P-A'::text) AND ((pt.concepte)::text = 'D-NEO'::text)) THEN '21-11500I'::text WHEN (((CASE WHEN (((((((public.t_altes.fecha_alta)::character(10))::text || ' '::text) || ((public.t_altes.hora_alta)::character(8))::text))::timestamp without time zone - (((((public.t_altes.fecha_ingreso)::character(10))::text || ' '::text) || ((public.t_altes.hora_ingreso)::character(8))::text))::timestamp without time zone) >= '16:00:00'::interval) THEN 'H - estada >= 16 horas'::text ELSE 'C - estada < 16 horas'::text END) = 'C - estada < 16 horas'::text) AND ((CASE WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) < 15::numeric) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_1)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_2)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_3)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_4)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_5)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_6)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_7)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_8)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_9)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_10)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_11)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_12)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_13)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_14)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_15)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) >= 15::numeric) THEN 'ADULT'::text ELSE 'ERROR'::text END) = 'NEN-RM'::text) AND ((pt.concepte)::text = 'COND2P-A'::text) AND ((pt.concepte)::text = 'D-NEO'::text)) THEN '20-11500A'::text WHEN (((CASE WHEN (((((((public.t_altes.fecha_alta)::character(10))::text || ' '::text) || ((public.t_altes.hora_alta)::character(8))::text))::timestamp without time zone - (((((public.t_altes.fecha_ingreso)::character(10))::text || ' '::text) || ((public.t_altes.hora_ingreso)::character(8))::text))::timestamp without time zone) >= '16:00:00'::interval) THEN 'H - estada >= 16 horas'::text ELSE 'C - estada < 16 horas'::text END) = 'H - estada >= 16 horas'::text) AND ((CASE WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) < 15::numeric) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_1)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_2)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_3)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_4)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_5)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_6)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_7)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_8)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_9)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_10)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_11)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_12)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_13)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_14)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_15)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) >= 15::numeric) THEN 'ADULT'::text ELSE 'ERROR'::text END) = 'NEN-RM'::text) AND ((pt.concepte)::text = 'COND3P-A'::text)) THEN CASE WHEN ((d1.concepte)::text = 'COND4-B'::text) THEN ''::text ELSE '19-11500I'::text END WHEN (((CASE WHEN (((((((public.t_altes.fecha_alta)::character(10))::text || ' '::text) || ((public.t_altes.hora_alta)::character(8))::text))::timestamp without time zone - (((((public.t_altes.fecha_ingreso)::character(10))::text || ' '::text) || ((public.t_altes.hora_ingreso)::character(8))::text))::timestamp without time zone) >= '16:00:00'::interval) THEN 'H - estada >= 16 horas'::text ELSE 'C - estada < 16 horas'::text END) = 'C - estada < 16 horas'::text) AND ((CASE WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) < 15::numeric) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_1)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_2)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_3)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_4)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_5)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_6)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_7)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_8)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_9)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_10)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_11)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_12)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_13)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_14)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_15)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) >= 15::numeric) THEN 'ADULT'::text ELSE 'ERROR'::text END) = 'NEN-RM'::text) AND ((pt.concepte)::text = 'COND3P-A'::text)) THEN CASE WHEN ((d1.concepte)::text = 'COND4-B'::text) THEN ''::text ELSE '18-11500A'::text END WHEN (((public.t_altes.mot_alta)::text = ANY ('{5,6}'::text[])) OR ((public.t_altes.up_destino)::text = ANY ('{718,434,435,436,6046,772,148,765,272,1063}'::text[]))) THEN '17-114001'::text WHEN (((public.t_altes.c_diag_1)::text ~~ 'Z53%'::text) OR ((public.t_altes.c_diag_2)::text ~~ 'Z53%'::text) OR ((public.t_altes.c_diag_3)::text ~~ 'Z53%'::text) OR ((public.t_altes.c_diag_4)::text ~~ 'Z53%'::text)) THEN '16-114001'::text WHEN (((CASE WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) < 15::numeric) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_1)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_2)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_3)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_4)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_5)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_6)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_7)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_8)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_9)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_10)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_11)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_12)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_13)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_14)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_15)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) >= 15::numeric) THEN 'ADULT'::text ELSE 'ERROR'::text END) = 'NEN-RM'::text) AND ((pt.concepte)::text = 'T3'::text)) THEN '15-T3'::text WHEN (((public.t_altes.tipus_assistencia)::text = '13'::text) AND ((pt.concepte)::text = '145515'::text)) THEN '13-145515'::text WHEN (((CASE WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) < 15::numeric) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_1)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_2)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_3)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_4)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_5)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_6)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_7)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_8)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_9)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_10)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_11)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_12)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_13)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_14)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_15)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) >= 15::numeric) THEN 'ADULT'::text ELSE 'ERROR'::text END) = 'NEN-RM'::text) AND ((pt.concepte)::text = 'T2'::text)) THEN '12-T2'::text WHEN (((CASE WHEN (((((((public.t_altes.fecha_alta)::character(10))::text || ' '::text) || ((public.t_altes.hora_alta)::character(8))::text))::timestamp without time zone - (((((public.t_altes.fecha_ingreso)::character(10))::text || ' '::text) || ((public.t_altes.hora_ingreso)::character(8))::text))::timestamp without time zone) >= '16:00:00'::interval) THEN 'H - estada >= 16 horas'::text ELSE 'C - estada < 16 horas'::text END) = 'C - estada < 16 horas'::text) AND ((pt.concepte)::text = '145510'::text)) THEN '10-145510'::text WHEN (((CASE WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) < 15::numeric) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_1)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_2)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_3)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_4)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_5)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_6)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_7)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_8)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_9)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_10)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_11)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_12)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_13)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_14)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_15)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) >= 15::numeric) THEN 'ADULT'::text ELSE 'ERROR'::text END) = 'NEN-RM'::text) AND ((pt.concepte)::text = 'T1'::text)) THEN '09-T1'::text WHEN (((CASE WHEN (((((((public.t_altes.fecha_alta)::character(10))::text || ' '::text) || ((public.t_altes.hora_alta)::character(8))::text))::timestamp without time zone - (((((public.t_altes.fecha_ingreso)::character(10))::text || ' '::text) || ((public.t_altes.hora_ingreso)::character(8))::text))::timestamp without time zone) >= '16:00:00'::interval) THEN 'H - estada >= 16 horas'::text ELSE 'C - estada < 16 horas'::text END) = 'C - estada < 16 horas'::text) AND ((CASE WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) < 15::numeric) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_1)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_2)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_3)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_4)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_5)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_6)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_7)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_8)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_9)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_10)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_11)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_12)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_13)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_14)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_15)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) >= 15::numeric) THEN 'ADULT'::text ELSE 'ERROR'::text END) = 'ADULT'::text) AND ((pt.concepte)::text = 'QUI-MEN-ADU'::text)) THEN '07-141000'::text WHEN (((CASE WHEN (((((((public.t_altes.fecha_alta)::character(10))::text || ' '::text) || ((public.t_altes.hora_alta)::character(8))::text))::timestamp without time zone - (((((public.t_altes.fecha_ingreso)::character(10))::text || ' '::text) || ((public.t_altes.hora_ingreso)::character(8))::text))::timestamp without time zone) >= '16:00:00'::interval) THEN 'H - estada >= 16 horas'::text ELSE 'C - estada < 16 horas'::text END) = 'C - estada < 16 horas'::text) AND ((CASE WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) < 15::numeric) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_1)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_2)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_3)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_4)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_5)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_6)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_7)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_8)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_9)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_10)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_11)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_12)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_13)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_14)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_15)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) >= 15::numeric) THEN 'ADULT'::text ELSE 'ERROR'::text END) = 'NEN-RM'::text) AND ((pt.concepte)::text = 'QUI-MEN-NEN'::text)) THEN '06-141000'::text WHEN ((public.t_altes.tipus_assistencia)::text = '13'::text) THEN '05-141000'::text WHEN (((CASE WHEN (((((((public.t_altes.fecha_alta)::character(10))::text || ' '::text) || ((public.t_altes.hora_alta)::character(8))::text))::timestamp without time zone - (((((public.t_altes.fecha_ingreso)::character(10))::text || ' '::text) || ((public.t_altes.hora_ingreso)::character(8))::text))::timestamp without time zone) >= '16:00:00'::interval) THEN 'H - estada >= 16 horas'::text ELSE 'C - estada < 16 horas'::text END) = 'C - estada < 16 horas'::text) AND ((pt.concepte)::text = 'No_classi.'::text)) THEN '04-141000'::text WHEN ((CASE WHEN (((((((public.t_altes.fecha_alta)::character(10))::text || ' '::text) || ((public.t_altes.hora_alta)::character(8))::text))::timestamp without time zone - (((((public.t_altes.fecha_ingreso)::character(10))::text || ' '::text) || ((public.t_altes.hora_ingreso)::character(8))::text))::timestamp without time zone) >= '16:00:00'::interval) THEN 'H - estada >= 16 horas'::text ELSE 'C - estada < 16 horas'::text END) = 'H - estada >= 16 horas'::text) THEN '02-114001'::text ELSE '00-142000'::text END), 4, 6)) = (t_factur_conceptefactur.codiconceptefact)::text)
3. 144.121 2,584,822.469 ↑ 317.4 38,637 1

Merge Right Join (cost=270,004,206.21..1,998,730,831.88 rows=12,265,119 width=312) (actual time=2,190,535.781..2,584,822.469 rows=38,637 loops=1)

  • Merge Cond: ((public.t_altes.numicu)::text = (public.t_altes.numicu)::text)
4. 269,014.460 2,558,997.597 ↑ 5,521.2 38,637 1

GroupAggregate (cost=269,274,320.43..1,995,150,180.61 rows=213,323,897 width=232) (actual time=2,164,961.646..2,558,997.597 rows=38,637 loops=1)

5. 1,952,490.190 2,289,983.137 ↑ 10.4 30,549,291 1

Sort (cost=269,274,320.43..270,070,760.30 rows=318,575,950 width=232) (actual time=2,164,958.376..2,289,983.137 rows=30,549,291 loops=1)

  • Sort Key: public.t_altes.numicu, (((((((public.t_altes.fecha_alta)::character(10))::text || ' '::text) || ((public.t_altes.hora_alta)::character(8))::text))::timestamp without time zone - (((((public.t_altes.fecha_ingreso)::character(10))::text || ' '::text) || ((public.t_altes.hora_ingreso)::character(8))::text))::timestamp without time zone)), (CASE WHEN (((((((public.t_altes.fecha_alta)::character(10))::text || ' '::text) || ((public.t_altes.hora_alta)::character(8))::text))::timestamp without time zone - (((((public.t_altes.fecha_ingreso)::character(10))::text || ' '::text) || ((public.t_altes.hora_ingreso)::character(8))::text))::timestamp without time zone) >= '16:00:00'::interval) THEN 'H - estada >= 16 horas'::text ELSE 'C - estada < 16 horas'::text END), (CASE WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) < 15::numeric) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_1)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_2)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_3)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_4)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_5)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_6)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_7)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_8)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_9)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_10)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_11)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_12)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_13)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_14)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((public.t_altes.c_diag_15)::text = ANY ('{F70,F71,F72,F73,F78,F79}'::text[])) THEN 'NEN-RM'::text WHEN ((((public.t_altes.fecha_ingreso - public.t_altes.fechanac))::numeric / 365.25) >= 15::numeric) THEN 'ADULT'::text ELSE 'ERROR'::text END), (CASE WHEN ((public.t_altes.c_diag_1 IS NULL) AND (public.t_altes.c_proc_1 IS NULL)) THEN 'Diag1/Proc1 NULOS'::text WHEN ((public.t_altes.c_diag_1 IS NULL) AND (public.t_altes.c_proc_1 IS NOT NULL)) THEN 'Diag1 NULO / Proc1 NO NULO'::text WHEN ((public.t_altes.c_diag_1 IS NOT NULL) AND (public.t_altes.c_proc_1 IS NULL)) THEN 'Diag1 NO NULO / Proc1 NULO'::text WHEN ((public.t_altes.c_diag_1 IS NOT NULL) AND (public.t_altes.c_proc_1 IS NOT NULL)) THEN 'Diag1 NO NULO / Proc1 NO NULO'::text ELSE 'ERROR'::text END), public.t_altes.servalta
  • Sort Method: external merge Disk: 8579304kB
6. 145,814.300 337,492.947 ↑ 10.4 30,549,291 1

Hash Left Join (cost=14,337.79..189,435,900.68 rows=318,575,950 width=232) (actual time=191.050..337,492.947 rows=30,549,291 loops=1)

  • Hash Cond: ((public.t_altes.c_proc_1)::text = (p1.cim10)::text)
7. 7,570.284 191,586.697 ↑ 16.1 8,804,491 1

Hash Left Join (cost=7,176.95..26,853,036.08 rows=141,729,307 width=232) (actual time=98.902..191,586.697 rows=8,804,491 loops=1)

  • Hash Cond: (replace((public.t_altes.c_diag_1)::text, '.'::text, ''::text) = (d1.cim10)::text)
8. 13,212.798 183,917.934 ↑ 6.7 6,805,914 1

Nested Loop Left Join (cost=16.11..16,780,880.79 rows=45,514,219 width=221) (actual time=0.365..183,917.934 rows=6,805,914 loops=1)

  • Join Filter: (((dt.cim10)::text = replace((public.t_altes.c_diag_1)::text, '.'::text, ''::text)) OR ((dt.cim10)::text = replace((public.t_altes.c_diag_2)::text, '.'::text, ''::text)) OR ((dt.cim10)::text = replace((public.t_altes.c_diag_3)::text, '.'::text, ''::text)) OR ((dt.cim10)::text = replace((public.t_altes.c_diag_4)::text, '.'::text, ''::text)) OR ((dt.cim10)::text = replace((public.t_altes.c_diag_5)::text, '.'::text, ''::text)) OR ((dt.cim10)::text = replace((public.t_altes.c_diag_6)::text, '.'::text, ''::text)) OR ((dt.cim10)::text = replace((public.t_altes.c_diag_7)::text, '.'::text, ''::text)) OR ((dt.cim10)::text = replace((public.t_altes.c_diag_8)::text, '.'::text, ''::text)) OR ((dt.cim10)::text = replace((public.t_altes.c_diag_9)::text, '.'::text, ''::text)) OR ((dt.cim10)::text = replace((public.t_altes.c_diag_10)::text, '.'::text, ''::text)) OR ((dt.cim10)::text = replace((public.t_altes.c_diag_11)::text, '.'::text, ''::text)) OR ((dt.cim10)::text = replace((public.t_altes.c_diag_12)::text, '.'::text, ''::text)) OR ((dt.cim10)::text = replace((public.t_altes.c_diag_13)::text, '.'::text, ''::text)) OR ((dt.cim10)::text = replace((public.t_altes.c_diag_14)::text, '.'::text, ''::text)) OR ((dt.cim10)::text = replace((public.t_altes.c_diag_15)::text, '.'::text, ''::text)))
9. 4,907.357 23,814.624 ↓ 4.2 4,080,292 1

Nested Loop Left Join (cost=10.71..3,275,810.85 rows=974,502 width=276) (actual time=0.254..23,814.624 rows=4,080,292 loops=1)

  • Join Filter: (((ptbis.cim10)::text = (public.t_altes.c_proc_1)::text) OR ((ptbis.cim10)::text = (public.t_altes.c_proc_2)::text) OR ((ptbis.cim10)::text = (public.t_altes.c_proc_3)::text) OR ((ptbis.cim10)::text = (public.t_altes.c_proc_4)::text) OR ((ptbis.cim10)::text = (public.t_altes.c_proc_5)::text) OR ((ptbis.cim10)::text = (public.t_altes.c_proc_6)::text) OR ((ptbis.cim10)::text = (public.t_altes.c_proc_7)::text) OR ((ptbis.cim10)::text = (public.t_altes.c_proc_8)::text) OR ((ptbis.cim10)::text = (public.t_altes.c_proc_9)::text) OR ((ptbis.cim10)::text = (public.t_altes.c_proc_10)::text) OR ((ptbis.cim10)::text = (public.t_altes.c_proc_11)::text) OR ((ptbis.cim10)::text = (public.t_altes.c_proc_12)::text) OR ((ptbis.cim10)::text = (public.t_altes.c_proc_13)::text) OR ((ptbis.cim10)::text = (public.t_altes.c_proc_14)::text) OR ((ptbis.cim10)::text = (public.t_altes.c_proc_15)::text))
10. 581.564 4,101.763 ↓ 1.4 290,304 1

Nested Loop Left Join (cost=5.36..717,566.22 rows=212,154 width=345) (actual time=0.246..4,101.763 rows=290,304 loops=1)

  • Join Filter: (((pt.cim10)::text = (public.t_altes.c_proc_1)::text) OR ((pt.cim10)::text = (public.t_altes.c_proc_2)::text) OR ((pt.cim10)::text = (public.t_altes.c_proc_3)::text) OR ((pt.cim10)::text = (public.t_altes.c_proc_4)::text) OR ((pt.cim10)::text = (public.t_altes.c_proc_5)::text) OR ((pt.cim10)::text = (public.t_altes.c_proc_6)::text) OR ((pt.cim10)::text = (public.t_altes.c_proc_7)::text) OR ((pt.cim10)::text = (public.t_altes.c_proc_8)::text) OR ((pt.cim10)::text = (public.t_altes.c_proc_9)::text) OR ((pt.cim10)::text = (public.t_altes.c_proc_10)::text) OR ((pt.cim10)::text = (public.t_altes.c_proc_11)::text) OR ((pt.cim10)::text = (public.t_altes.c_proc_12)::text) OR ((pt.cim10)::text = (public.t_altes.c_proc_13)::text) OR ((pt.cim10)::text = (public.t_altes.c_proc_14)::text) OR ((pt.cim10)::text = (public.t_altes.c_proc_15)::text))
11. 76.965 1,549.712 ↑ 1.2 38,637 1

Nested Loop Left Join (cost=0.00..160,623.41 rows=46,187 width=334) (actual time=0.233..1,549.712 rows=38,637 loops=1)

12. 275.000 275.000 ↑ 1.2 38,637 1

Seq Scan on t_altes (cost=0.00..35,754.77 rows=46,187 width=214) (actual time=0.161..275.000 rows=38,637 loops=1)

  • Filter: ((fecha_alta >= '2019-01-01'::date) AND ((tipfinancia)::text <> '2'::text))
13. 1,197.747 1,197.747 ↑ 1.0 1 38,637

Index Scan using pk_t_altes on t_altes (cost=0.00..2.69 rows=1 width=130) (actual time=0.030..0.031 rows=1 loops=38,637)

  • Index Cond: ((numicu)::text = (public.t_altes.numicu)::text)
  • Filter: ((fecha_alta >= '2019-01-01'::date) AND ((tipfinancia)::text <> '2'::text))
14. 425.007 1,970.487 ↑ 6.7 7 38,637

Bitmap Heap Scan on t_factur_cim10 pt (cost=5.36..9.83 rows=47 width=18) (actual time=0.044..0.051 rows=7 loops=38,637)

  • Recheck Cond: (((cim10)::text = (public.t_altes.c_proc_1)::text) OR ((cim10)::text = (public.t_altes.c_proc_2)::text) OR ((cim10)::text = (public.t_altes.c_proc_3)::text) OR ((cim10)::text = (public.t_altes.c_proc_4)::text) OR ((cim10)::text = (public.t_altes.c_proc_5)::text) OR ((cim10)::text = (public.t_altes.c_proc_6)::text) OR ((cim10)::text = (public.t_altes.c_proc_7)::text) OR ((cim10)::text = (public.t_altes.c_proc_8)::text) OR ((cim10)::text = (public.t_altes.c_proc_9)::text) OR ((cim10)::text = (public.t_altes.c_proc_10)::text) OR ((cim10)::text = (public.t_altes.c_proc_11)::text) OR ((cim10)::text = (public.t_altes.c_proc_12)::text) OR ((cim10)::text = (public.t_altes.c_proc_13)::text) OR ((cim10)::text = (public.t_altes.c_proc_14)::text) OR ((cim10)::text = (public.t_altes.c_proc_15)::text))
15. 347.733 1,545.480 ↓ 0.0 0 38,637

BitmapOr (cost=5.36..5.36 rows=47 width=0) (actual time=0.040..0.040 rows=0 loops=38,637)

16. 618.192 618.192 ↑ 1.0 3 38,637

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.016..0.016 rows=3 loops=38,637)

  • Index Cond: ((cim10)::text = (public.t_altes.c_proc_1)::text)
17. 270.459 270.459 ↑ 1.5 2 38,637

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.007..0.007 rows=2 loops=38,637)

  • Index Cond: ((cim10)::text = (public.t_altes.c_proc_2)::text)
18. 154.548 154.548 ↑ 3.0 1 38,637

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.004..0.004 rows=1 loops=38,637)

  • Index Cond: ((cim10)::text = (public.t_altes.c_proc_3)::text)
19. 38.637 38.637 ↑ 3.0 1 38,637

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.001..0.001 rows=1 loops=38,637)

  • Index Cond: ((cim10)::text = (public.t_altes.c_proc_4)::text)
20. 38.637 38.637 ↓ 0.0 0 38,637

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.001..0.001 rows=0 loops=38,637)

  • Index Cond: ((cim10)::text = (public.t_altes.c_proc_5)::text)
21. 38.637 38.637 ↓ 0.0 0 38,637

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.001..0.001 rows=0 loops=38,637)

  • Index Cond: ((cim10)::text = (public.t_altes.c_proc_6)::text)
22. 0.000 0.000 ↓ 0.0 0 38,637

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.000..0.000 rows=0 loops=38,637)

  • Index Cond: ((cim10)::text = (public.t_altes.c_proc_7)::text)
23. 0.000 0.000 ↓ 0.0 0 38,637

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.000..0.000 rows=0 loops=38,637)

  • Index Cond: ((cim10)::text = (public.t_altes.c_proc_8)::text)
24. 0.000 0.000 ↓ 0.0 0 38,637

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.000..0.000 rows=0 loops=38,637)

  • Index Cond: ((cim10)::text = (public.t_altes.c_proc_9)::text)
25. 38.637 38.637 ↓ 0.0 0 38,637

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.001..0.001 rows=0 loops=38,637)

  • Index Cond: ((cim10)::text = (public.t_altes.c_proc_10)::text)
26. 0.000 0.000 ↓ 0.0 0 38,637

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.000..0.000 rows=0 loops=38,637)

  • Index Cond: ((cim10)::text = (public.t_altes.c_proc_11)::text)
27. 0.000 0.000 ↓ 0.0 0 38,637

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.000..0.000 rows=0 loops=38,637)

  • Index Cond: ((cim10)::text = (public.t_altes.c_proc_12)::text)
28. 0.000 0.000 ↓ 0.0 0 38,637

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.000..0.000 rows=0 loops=38,637)

  • Index Cond: ((cim10)::text = (public.t_altes.c_proc_13)::text)
29. 0.000 0.000 ↓ 0.0 0 38,637

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.000..0.000 rows=0 loops=38,637)

  • Index Cond: ((cim10)::text = (public.t_altes.c_proc_14)::text)
30. 0.000 0.000 ↓ 0.0 0 38,637

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.000..0.000 rows=0 loops=38,637)

  • Index Cond: ((cim10)::text = (public.t_altes.c_proc_15)::text)
31. 4,644.864 14,805.504 ↑ 3.4 14 290,304

Bitmap Heap Scan on t_factur_cim10 ptbis (cost=5.36..9.83 rows=47 width=18) (actual time=0.038..0.051 rows=14 loops=290,304)

  • Recheck Cond: (((cim10)::text = (public.t_altes.c_proc_1)::text) OR ((cim10)::text = (public.t_altes.c_proc_2)::text) OR ((cim10)::text = (public.t_altes.c_proc_3)::text) OR ((cim10)::text = (public.t_altes.c_proc_4)::text) OR ((cim10)::text = (public.t_altes.c_proc_5)::text) OR ((cim10)::text = (public.t_altes.c_proc_6)::text) OR ((cim10)::text = (public.t_altes.c_proc_7)::text) OR ((cim10)::text = (public.t_altes.c_proc_8)::text) OR ((cim10)::text = (public.t_altes.c_proc_9)::text) OR ((cim10)::text = (public.t_altes.c_proc_10)::text) OR ((cim10)::text = (public.t_altes.c_proc_11)::text) OR ((cim10)::text = (public.t_altes.c_proc_12)::text) OR ((cim10)::text = (public.t_altes.c_proc_13)::text) OR ((cim10)::text = (public.t_altes.c_proc_14)::text) OR ((cim10)::text = (public.t_altes.c_proc_15)::text))
32. 1,451.520 10,160.640 ↓ 0.0 0 290,304

BitmapOr (cost=5.36..5.36 rows=47 width=0) (actual time=0.035..0.035 rows=0 loops=290,304)

33. 2,322.432 2,322.432 ↑ 1.0 3 290,304

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.008..0.008 rows=3 loops=290,304)

  • Index Cond: ((cim10)::text = (public.t_altes.c_proc_1)::text)
34. 1,451.520 1,451.520 ↑ 1.0 3 290,304

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.005..0.005 rows=3 loops=290,304)

  • Index Cond: ((cim10)::text = (public.t_altes.c_proc_2)::text)
35. 1,161.216 1,161.216 ↑ 1.5 2 290,304

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.004..0.004 rows=2 loops=290,304)

  • Index Cond: ((cim10)::text = (public.t_altes.c_proc_3)::text)
36. 870.912 870.912 ↑ 1.5 2 290,304

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.003..0.003 rows=2 loops=290,304)

  • Index Cond: ((cim10)::text = (public.t_altes.c_proc_4)::text)
37. 580.608 580.608 ↑ 3.0 1 290,304

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.002..0.002 rows=1 loops=290,304)

  • Index Cond: ((cim10)::text = (public.t_altes.c_proc_5)::text)
38. 580.608 580.608 ↑ 3.0 1 290,304

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.002..0.002 rows=1 loops=290,304)

  • Index Cond: ((cim10)::text = (public.t_altes.c_proc_6)::text)
39. 290.304 290.304 ↑ 3.0 1 290,304

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.001..0.001 rows=1 loops=290,304)

  • Index Cond: ((cim10)::text = (public.t_altes.c_proc_7)::text)
40. 290.304 290.304 ↑ 3.0 1 290,304

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.001..0.001 rows=1 loops=290,304)

  • Index Cond: ((cim10)::text = (public.t_altes.c_proc_8)::text)
41. 290.304 290.304 ↓ 0.0 0 290,304

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.001..0.001 rows=0 loops=290,304)

  • Index Cond: ((cim10)::text = (public.t_altes.c_proc_9)::text)
42. 290.304 290.304 ↓ 0.0 0 290,304

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.001..0.001 rows=0 loops=290,304)

  • Index Cond: ((cim10)::text = (public.t_altes.c_proc_10)::text)
43. 290.304 290.304 ↓ 0.0 0 290,304

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.001..0.001 rows=0 loops=290,304)

  • Index Cond: ((cim10)::text = (public.t_altes.c_proc_11)::text)
44. 290.304 290.304 ↓ 0.0 0 290,304

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.001..0.001 rows=0 loops=290,304)

  • Index Cond: ((cim10)::text = (public.t_altes.c_proc_12)::text)
45. 0.000 0.000 ↓ 0.0 0 290,304

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.000..0.000 rows=0 loops=290,304)

  • Index Cond: ((cim10)::text = (public.t_altes.c_proc_13)::text)
46. 0.000 0.000 ↓ 0.0 0 290,304

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.000..0.000 rows=0 loops=290,304)

  • Index Cond: ((cim10)::text = (public.t_altes.c_proc_14)::text)
47. 0.000 0.000 ↓ 0.0 0 290,304

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.000..0.000 rows=0 loops=290,304)

  • Index Cond: ((cim10)::text = (public.t_altes.c_proc_15)::text)
48. 8,160.584 146,890.512 ↑ 47.0 1 4,080,292

Bitmap Heap Scan on t_factur_cim10 dt (cost=5.39..9.86 rows=47 width=18) (actual time=0.036..0.036 rows=1 loops=4,080,292)

  • Recheck Cond: (((cim10)::text = replace((public.t_altes.c_diag_1)::text, '.'::text, ''::text)) OR ((cim10)::text = replace((public.t_altes.c_diag_2)::text, '.'::text, ''::text)) OR ((cim10)::text = replace((public.t_altes.c_diag_3)::text, '.'::text, ''::text)) OR ((cim10)::text = replace((public.t_altes.c_diag_4)::text, '.'::text, ''::text)) OR ((cim10)::text = replace((public.t_altes.c_diag_5)::text, '.'::text, ''::text)) OR ((cim10)::text = replace((public.t_altes.c_diag_6)::text, '.'::text, ''::text)) OR ((cim10)::text = replace((public.t_altes.c_diag_7)::text, '.'::text, ''::text)) OR ((cim10)::text = replace((public.t_altes.c_diag_8)::text, '.'::text, ''::text)) OR ((cim10)::text = replace((public.t_altes.c_diag_9)::text, '.'::text, ''::text)) OR ((cim10)::text = replace((public.t_altes.c_diag_10)::text, '.'::text, ''::text)) OR ((cim10)::text = replace((public.t_altes.c_diag_11)::text, '.'::text, ''::text)) OR ((cim10)::text = replace((public.t_altes.c_diag_12)::text, '.'::text, ''::text)) OR ((cim10)::text = replace((public.t_altes.c_diag_13)::text, '.'::text, ''::text)) OR ((cim10)::text = replace((public.t_altes.c_diag_14)::text, '.'::text, ''::text)) OR ((cim10)::text = replace((public.t_altes.c_diag_15)::text, '.'::text, ''::text)))
49. 28,562.044 138,729.928 ↓ 0.0 0 4,080,292

BitmapOr (cost=5.39..5.39 rows=47 width=0) (actual time=0.034..0.034 rows=0 loops=4,080,292)

50. 16,321.168 16,321.168 ↓ 0.0 0 4,080,292

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.004..0.004 rows=0 loops=4,080,292)

  • Index Cond: ((cim10)::text = replace((public.t_altes.c_diag_1)::text, '.'::text, ''::text))
51. 8,160.584 8,160.584 ↓ 0.0 0 4,080,292

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.002..0.002 rows=0 loops=4,080,292)

  • Index Cond: ((cim10)::text = replace((public.t_altes.c_diag_2)::text, '.'::text, ''::text))
52. 8,160.584 8,160.584 ↓ 0.0 0 4,080,292

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.002..0.002 rows=0 loops=4,080,292)

  • Index Cond: ((cim10)::text = replace((public.t_altes.c_diag_3)::text, '.'::text, ''::text))
53. 8,160.584 8,160.584 ↓ 0.0 0 4,080,292

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.002..0.002 rows=0 loops=4,080,292)

  • Index Cond: ((cim10)::text = replace((public.t_altes.c_diag_4)::text, '.'::text, ''::text))
54. 8,160.584 8,160.584 ↓ 0.0 0 4,080,292

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.002..0.002 rows=0 loops=4,080,292)

  • Index Cond: ((cim10)::text = replace((public.t_altes.c_diag_5)::text, '.'::text, ''::text))
55. 8,160.584 8,160.584 ↓ 0.0 0 4,080,292

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.002..0.002 rows=0 loops=4,080,292)

  • Index Cond: ((cim10)::text = replace((public.t_altes.c_diag_6)::text, '.'::text, ''::text))
56. 8,160.584 8,160.584 ↓ 0.0 0 4,080,292

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.002..0.002 rows=0 loops=4,080,292)

  • Index Cond: ((cim10)::text = replace((public.t_altes.c_diag_7)::text, '.'::text, ''::text))
57. 8,160.584 8,160.584 ↓ 0.0 0 4,080,292

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.002..0.002 rows=0 loops=4,080,292)

  • Index Cond: ((cim10)::text = replace((public.t_altes.c_diag_8)::text, '.'::text, ''::text))
58. 8,160.584 8,160.584 ↓ 0.0 0 4,080,292

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.002..0.002 rows=0 loops=4,080,292)

  • Index Cond: ((cim10)::text = replace((public.t_altes.c_diag_9)::text, '.'::text, ''::text))
59. 8,160.584 8,160.584 ↓ 0.0 0 4,080,292

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.002..0.002 rows=0 loops=4,080,292)

  • Index Cond: ((cim10)::text = replace((public.t_altes.c_diag_10)::text, '.'::text, ''::text))
60. 4,080.292 4,080.292 ↓ 0.0 0 4,080,292

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.001..0.001 rows=0 loops=4,080,292)

  • Index Cond: ((cim10)::text = replace((public.t_altes.c_diag_11)::text, '.'::text, ''::text))
61. 4,080.292 4,080.292 ↓ 0.0 0 4,080,292

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.001..0.001 rows=0 loops=4,080,292)

  • Index Cond: ((cim10)::text = replace((public.t_altes.c_diag_12)::text, '.'::text, ''::text))
62. 4,080.292 4,080.292 ↓ 0.0 0 4,080,292

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.001..0.001 rows=0 loops=4,080,292)

  • Index Cond: ((cim10)::text = replace((public.t_altes.c_diag_13)::text, '.'::text, ''::text))
63. 4,080.292 4,080.292 ↓ 0.0 0 4,080,292

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.001..0.001 rows=0 loops=4,080,292)

  • Index Cond: ((cim10)::text = replace((public.t_altes.c_diag_14)::text, '.'::text, ''::text))
64. 4,080.292 4,080.292 ↓ 0.0 0 4,080,292

Bitmap Index Scan on index_cim10 (cost=0.00..0.36 rows=3 width=0) (actual time=0.001..0.001 rows=0 loops=4,080,292)

  • Index Cond: ((cim10)::text = replace((public.t_altes.c_diag_15)::text, '.'::text, ''::text))
65. 58.728 98.479 ↑ 1.0 240,304 1

Hash (cost=4,157.04..4,157.04 rows=240,304 width=18) (actual time=98.479..98.479 rows=240,304 loops=1)

  • Buckets: 32768 Batches: 1 Memory Usage: 12047kB
66. 39.751 39.751 ↑ 1.0 240,304 1

Seq Scan on t_factur_cim10 d1 (cost=0.00..4,157.04 rows=240,304 width=18) (actual time=0.004..39.751 rows=240,304 loops=1)

67. 57.096 91.950 ↑ 1.0 240,304 1

Hash (cost=4,157.04..4,157.04 rows=240,304 width=7) (actual time=91.950..91.950 rows=240,304 loops=1)

  • Buckets: 32768 Batches: 1 Memory Usage: 9381kB
68. 34.854 34.854 ↑ 1.0 240,304 1

Seq Scan on t_factur_cim10 p1 (cost=0.00..4,157.04 rows=240,304 width=7) (actual time=0.004..34.854 rows=240,304 loops=1)

69. 37.451 25,680.751 ↑ 1.2 38,637 1

Materialize (cost=729,885.78..730,241.23 rows=46,187 width=168) (actual time=25,574.127..25,680.751 rows=38,637 loops=1)

70. 57.196 25,643.300 ↑ 1.2 38,637 1

Merge Left Join (cost=729,885.78..730,125.77 rows=46,187 width=168) (actual time=25,574.116..25,643.300 rows=38,637 loops=1)

  • Merge Cond: ((public.t_altes.numicu)::text = (previscs.epiprevscs)::text)
71. 239.209 25,151.918 ↑ 1.2 38,637 1

Sort (cost=671,011.61..671,127.08 rows=46,187 width=158) (actual time=25,142.389..25,151.918 rows=38,637 loops=1)

  • Sort Key: public.t_altes.numicu
  • Sort Method: quicksort Memory: 8457kB
72. 24.461 24,912.709 ↑ 1.2 38,637 1

Hash Left Join (cost=39,743.18..667,433.22 rows=46,187 width=158) (actual time=1,412.479..24,912.709 rows=38,637 loops=1)

  • Hash Cond: ((public.t_altes.servalta)::text = (t_servei.codigo)::text)
73. 73.573 24,888.021 ↑ 1.2 38,637 1

Hash Right Join (cost=39,712.28..666,767.26 rows=46,187 width=143) (actual time=1,412.236..24,888.021 rows=38,637 loops=1)

  • Hash Cond: ((public.t_altes.numicu)::text = (public.t_altes.numicu)::text)
74. 32.686 23,407.204 ↑ 1.2 38,637 1

Nested Loop Left Join (cost=973.92..627,540.47 rows=46,187 width=42) (actual time=4.964..23,407.204 rows=38,637 loops=1)

75. 33.238 37.770 ↑ 1.2 38,637 1

Bitmap Heap Scan on t_altes (cost=973.92..25,459.00 rows=46,187 width=10) (actual time=4.926..37.770 rows=38,637 loops=1)

  • Recheck Cond: (fecha_alta >= '2019-01-01'::date)
  • Filter: ((tipfinancia)::text <> '2'::text)
76. 4.532 4.532 ↑ 1.0 51,204 1

Bitmap Index Scan on "I_ALTES_FECHAALTA" (cost=0.00..962.38 rows=52,005 width=0) (actual time=4.532..4.532 rows=51,204 loops=1)

  • Index Cond: (fecha_alta >= '2019-01-01'::date)
77. 23,336.748 23,336.748 ↑ 1.0 1 38,637

Index Scan using pk_episodio_codigo on t_episodio (cost=0.00..13.02 rows=1 width=18) (actual time=0.603..0.604 rows=1 loops=38,637)

  • Index Cond: ((public.t_altes.numicu)::text = (codigo)::text)
78. 22.080 1,407.244 ↑ 1.2 38,637 1

Hash (cost=38,161.02..38,161.02 rows=46,187 width=111) (actual time=1,407.244..1,407.244 rows=38,637 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 4080kB
79. 43.449 1,385.164 ↑ 1.2 38,637 1

Hash Right Join (cost=36,030.30..38,161.02 rows=46,187 width=111) (actual time=1,317.820..1,385.164 rows=38,637 loops=1)

  • Hash Cond: ((rtrim((t_cmbd_ha.num_assis_162)::text)) = (public.t_altes.numicu)::text)
80. 124.786 1,249.246 ↓ 1.2 76,245 1

HashAggregate (cost=9,993.96..10,799.23 rows=64,421 width=10) (actual time=1,225.310..1,249.246 rows=76,245 loops=1)

81. 1,124.460 1,124.460 ↑ 1.0 181,982 1

Seq Scan on t_cmbd_ha (cost=0.00..9,083.69 rows=182,055 width=10) (actual time=0.716..1,124.460 rows=181,982 loops=1)

82. 18.503 92.469 ↑ 1.2 38,637 1

Hash (cost=25,459.00..25,459.00 rows=46,187 width=79) (actual time=92.469..92.469 rows=38,637 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 3983kB
83. 33.403 73.966 ↑ 1.2 38,637 1

Bitmap Heap Scan on t_altes (cost=973.92..25,459.00 rows=46,187 width=79) (actual time=40.956..73.966 rows=38,637 loops=1)

  • Recheck Cond: (fecha_alta >= '2019-01-01'::date)
  • Filter: ((tipfinancia)::text <> '2'::text)
84. 40.563 40.563 ↑ 1.0 51,204 1

Bitmap Index Scan on "I_ALTES_FECHAALTA" (cost=0.00..962.38 rows=52,005 width=0) (actual time=40.563..40.563 rows=51,204 loops=1)

  • Index Cond: (fecha_alta >= '2019-01-01'::date)
85. 0.084 0.227 ↑ 1.0 351 1

Hash (cost=26.51..26.51 rows=351 width=25) (actual time=0.227..0.227 rows=351 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 20kB
86. 0.143 0.143 ↑ 1.0 351 1

Seq Scan on t_servei (cost=0.00..26.51 rows=351 width=25) (actual time=0.009..0.143 rows=351 loops=1)

87. 14.203 434.186 ↓ 2.5 4,113 1

Sort (cost=58,874.17..58,878.23 rows=1,625 width=10) (actual time=431.717..434.186 rows=4,113 loops=1)

  • Sort Key: previscs.epiprevscs
  • Sort Method: quicksort Memory: 385kB
88. 0.598 419.983 ↓ 2.5 4,113 1

Subquery Scan on previscs (cost=58,755.01..58,787.51 rows=1,625 width=10) (actual time=418.565..419.983 rows=4,113 loops=1)

89. 3.046 419.385 ↓ 2.5 4,113 1

HashAggregate (cost=58,755.01..58,771.26 rows=1,625 width=18) (actual time=418.564..419.385 rows=4,113 loops=1)

90. 81.391 416.339 ↓ 2.9 4,642 1

Merge Join (cost=57,990.13..58,742.82 rows=1,625 width=18) (actual time=319.435..416.339 rows=4,642 loops=1)

  • Merge Cond: ((alta.numerohc)::text = (previo.numerohc)::text)
  • Join Filter: (((alta.numicu)::text <> (previo.numicu)::text) AND ((alta.fecha_ingreso - previo.fecha_alta) >= 0) AND ((alta.fecha_ingreso - previo.fecha_alta) <= 31))
91. 119.315 145.769 ↑ 1.2 38,417 1

Sort (cost=28,901.09..29,012.54 rows=44,580 width=20) (actual time=139.105..145.769 rows=38,417 loops=1)

  • Sort Key: alta.numerohc
  • Sort Method: quicksort Memory: 4538kB
92. 22.097 26.454 ↑ 1.2 38,417 1

Bitmap Heap Scan on t_altes alta (cost=973.52..25,458.60 rows=44,580 width=20) (actual time=4.733..26.454 rows=38,417 loops=1)

  • Recheck Cond: (fecha_alta >= '2019-01-01'::date)
  • Filter: ((tipfinancia)::text = '1'::text)
93. 4.357 4.357 ↑ 1.0 51,204 1

Bitmap Index Scan on "I_ALTES_FECHAALTA" (cost=0.00..962.38 rows=52,005 width=0) (actual time=4.357..4.357 rows=51,204 loops=1)

  • Index Cond: (fecha_alta >= '2019-01-01'::date)
94. 106.380 189.179 ↓ 1.9 77,848 1

Sort (cost=29,089.04..29,189.41 rows=40,150 width=20) (actual time=180.266..189.179 rows=77,848 loops=1)

  • Sort Key: previo.numerohc
  • Sort Method: quicksort Memory: 4345kB
95. 33.093 82.799 ↑ 1.1 35,946 1

Bitmap Heap Scan on t_altes previo (cost=1,285.97..26,018.95 rows=40,150 width=20) (actual time=50.202..82.799 rows=35,946 loops=1)

  • Recheck Cond: ((fecha_alta >= '2018-11-01'::date) AND ((tipfinancia)::text = '1'::text))
  • Filter: ((tipus_assistencia)::text = ANY ('{1,2,3,7}'::text[]))
96. 49.706 49.706 ↑ 1.2 43,937 1

Bitmap Index Scan on "I_ALTES_FECHA_ALTA_FINAN_TIPO-ASISTENCIA" (cost=0.00..1,275.93 rows=51,399 width=0) (actual time=49.706..49.706 rows=43,937 loops=1)

  • Index Cond: ((fecha_alta >= '2018-11-01'::date) AND ((tipfinancia)::text = '1'::text))
97. 0.039 6.970 ↑ 1.0 97 1

Hash (cost=2.97..2.97 rows=97 width=59) (actual time=6.970..6.970 rows=97 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
98. 6.931 6.931 ↑ 1.0 97 1

Seq Scan on t_factur_conceptefactur (cost=0.00..2.97 rows=97 width=59) (actual time=6.886..6.931 rows=97 loops=1)

99. 0.005 0.014 ↑ 1.0 15 1

Hash (cost=1.15..1.15 rows=15 width=21) (actual time=0.014..0.014 rows=15 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
100. 0.009 0.009 ↑ 1.0 15 1

Seq Scan on t_origen (cost=0.00..1.15 rows=15 width=21) (actual time=0.004..0.009 rows=15 loops=1)

Total runtime : 2,585,339.112 ms