Limit (cost=332044.12..332044.14 rows=10 width=83) (actual time=8013.683..8020.905 rows=10 loops=1)
-> Sort (cost=332044.12..332587.18 rows=217227 width=83) (actual time=8013.680..8013.681 rows=10 loops=1)
Sort Key: (round((((((CASE WHEN ((length((x.nombre1)::text) - levenshtein(lower((x.nombre1)::text), 'rubio'::text)) < 0) THEN 0.00 ELSE ((((length((x.nombre1)::text) - levenshtein(lower((x.nombre1)::text), 'rubio'::text)))::numeric / (length((x.nombre1)::text))::numeric) * 10.00) END + CASE WHEN (((length((x.apellido1)::text) - levenshtein(lower((x.apellido1)::text), 'uma'::text)))::numeric < 0.00) THEN 0.00 ELSE ((((length((x.apellido1)::text) - levenshtein(lower((x.apellido1)::text), 'uma'::text)))::numeric / (length((x.apellido1)::text))::numeric) * 20.00) END) + CASE WHEN (((length((x.numero_documento)::text) - levenshtein((x.numero_documento)::text, '560560'::text)) < 0) OR ((length((x.numero_documento)::text) - levenshtein((x.numero_documento)::text, '560560'::text)) IS NULL)) THEN 0.00 ELSE ((((length((x.numero_documento)::text) - levenshtein((x.numero_documento)::text, '560560'::text)))::numeric / (length((x.numero_documento)::text))::numeric) * 30.00) END) + CASE WHEN ((length(to_char((x.fecha_nacimiento)::timestamp with time zone, 'yyyy-MM-dd'::text)) - levenshtein(to_char((x.fecha_nacimiento)::timestamp with time zone, 'yyyy-MM-dd'::text), '1986-07-14'::text)) < 0) THEN 0.00 ELSE ((((length(to_char((x.fecha_nacimiento)::timestamp with time zone, 'yyyy-MM-dd'::text)) - levenshtein(to_char((x.fecha_nacimiento)::timestamp with time zone, 'yyyy-MM-dd'::text), '1986-07-14'::text)))::numeric / (length(to_char((x.fecha_nacimiento)::timestamp with time zone, 'yyyy-MM-dd'::text)))::numeric) * 20.00) END) + CASE WHEN (((x.tipo_documento_id)::character varying)::text = '1'::text) THEN 10.00 ELSE 0.00 END) + CASE WHEN (((x.genero_id)::character varying)::text = '100'::text) THEN 10.00 ELSE 0.00 END), 2)) DESC
Sort Method: top-N heapsort Memory: 27kB
-> WindowAgg (cost=1000.00..327349.92 rows=217227 width=83) (actual time=8013.048..8013.623 rows=24 loops=1)
-> Gather (cost=1000.00..282275.32 rows=217227 width=43) (actual time=2631.966..8020.157 rows=24 loops=1)
Workers Planned: 2
Workers Launched: 2
-> Parallel Seq Scan on paciente x (cost=0.00..259552.62 rows=90511 width=43) (actual time=1998.370..7999.838 rows=8 loops=3)
Filter: ((deleted IS FALSE) AND ((levenshtein(lower((apellido1)::text), 'uma'::text) < 6) OR (levenshtein(lower((nombre1)::text), 'rubio'::text) < 6) OR (levenshtein((numero_documento)::text, '560560'::text) < 6)) AND ((CASE WHEN (((length((apellido1)::text) - levenshtein(lower((apellido1)::text), 'uma'::text)))::numeric < 0.00) THEN 0.00 ELSE ((((length((apellido1)::text) - levenshtein(lower((apellido1)::text), 'uma'::text)))::numeric / (length((apellido1)::text))::numeric) * 20.00) END >= '10'::numeric) OR (CASE WHEN ((length((nombre1)::text) - levenshtein(lower((nombre1)::text), 'rubio'::text)) < 0) THEN 0.00 ELSE ((((length((nombre1)::text) - levenshtein(lower((nombre1)::text), 'rubio'::text)))::numeric / (length((nombre1)::text))::numeric) * 10.00) END >= '10'::numeric) OR (CASE WHEN (((length((numero_documento)::text) - levenshtein((numero_documento)::text, '560560'::text)) < 0) OR ((length((numero_documento)::text) - levenshtein((numero_documento)::text, '560560'::text)) IS NULL)) THEN 0.00 ELSE ((((length((numero_documento)::text) - levenshtein((numero_documento)::text, '560560'::text)))::numeric / (length((numero_documento)::text))::numeric) * 30.00) END >= '15'::numeric) OR (CASE WHEN ((length(to_char((fecha_nacimiento)::timestamp with time zone, 'yyyy-MM-dd'::text)) - levenshtein(to_char((fecha_nacimiento)::timestamp with time zone, 'yyyy-MM-dd'::text), '1986-07-14'::text)) < 0) THEN 0.00 ELSE ((((length(to_char((fecha_nacimiento)::timestamp with time zone, 'yyyy-MM-dd'::text)) - levenshtein(to_char((fecha_nacimiento)::timestamp with time zone, 'yyyy-MM-dd'::text), '1986-07-14'::text)))::numeric / (length(to_char((fecha_nacimiento)::timestamp with time zone, 'yyyy-MM-dd'::text)))::numeric) * 20.00) END >= '10'::numeric)) AND (round((((((CASE WHEN ((length((nombre1)::text) - levenshtein(lower((nombre1)::text), 'rubio'::text)) < 0) THEN 0.00 ELSE ((((length((nombre1)::text) - levenshtein(lower((nombre1)::text), 'rubio'::text)))::numeric / (length((nombre1)::text))::numeric) * 10.00) END + CASE WHEN (((length((apellido1)::text) - levenshtein(lower((apellido1)::text), 'uma'::text)))::numeric < 0.00) THEN 0.00 ELSE ((((length((apellido1)::text) - levenshtein(lower((apellido1)::text), 'uma'::text)))::numeric / (length((apellido1)::text))::numeric) * 20.00) END) + CASE WHEN (((length((numero_documento)::text) - levenshtein((numero_documento)::text, '560560'::text)) < 0) OR ((length((numero_documento)::text) - levenshtein((numero_documento)::text, '560560'::text)) IS NULL)) THEN 0.00 ELSE ((((length((numero_documento)::text) - levenshtein((numero_documento)::text, '560560'::text)))::numeric / (length((numero_documento)::text))::numeric) * 30.00) END) + CASE WHEN ((length(to_char((fecha_nacimiento)::timestamp with time zone, 'yyyy-MM-dd'::text)) - levenshtein(to_char((fecha_nacimiento)::timestamp with time zone, 'yyyy-MM-dd'::text), '1986-07-14'::text)) < 0) THEN 0.00 ELSE ((((length(to_char((fecha_nacimiento)::timestamp with time zone, 'yyyy-MM-dd'::text)) - levenshtein(to_char((fecha_nacimiento)::timestamp with time zone, 'yyyy-MM-dd'::text), '1986-07-14'::text)))::numeric / (length(to_char((fecha_nacimiento)::timestamp with time zone, 'yyyy-MM-dd'::text)))::numeric) * 20.00) END) + CASE WHEN (((tipo_documento_id)::character varying)::text = '1'::text) THEN 10.00 ELSE 0.00 END) + CASE WHEN (((genero_id)::character varying)::text = '100'::text) THEN 10.00 ELSE 0.00 END), 2) >= '60'::numeric))
Rows Removed by Filter: 384669
Planning Time: 2.119 ms
Execution Time: 8021.181 ms