{ "phase": "before", "generatedAt": "2026-07-12T23:07:27.740Z", "queryId": "query_06", "queryName": "Busqueda textual real del backend para marcapasos LIMIT 25", "sqlFile": "queries/query_06.sql", "explain": { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 13280.61, "Total Cost": 13280.68, "Plan Rows": 25, "Plan Width": 840, "Actual Startup Time": 21.911, "Actual Total Time": 21.916, "Actual Rows": 25, "Actual Loops": 1, "Disabled": false, "Output": [ "matched.source_dataset_key", "matched.source_dataset_id", "matched.source_dataset_name", "matched.categoria_linea", "matched.categoria_canonica", "matched.categoria_slug", "matched.expediente", "matched.registro_sanitario", "matched.producto", "matched.titular", "matched.estado_registro", "matched.fecha_expedicion", "matched.fecha_vencimiento", "matched.modalidad", "matched.grupo", "matched.marca", "matched.principio_activo", "matched.forma_farmaceutica", "matched.presentacion_comercial", "matched.atc", "matched.rol_nombre", "matched.rol_tipo", "matched.ciudad_titular", "matched.pais_titular", "matched.fabricante", "matched.importador", "matched.vigencia", "matched.source_uid" ], "Shared Hit Blocks": 179, "Shared Read Blocks": 749, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0, "Plans": [ { "Node Type": "Bitmap Heap Scan", "Parent Relationship": "InitPlan", "Subplan Name": "CTE matched", "Parallel Aware": false, "Async Capable": false, "Relation Name": "invima_api_catalog", "Schema": "public", "Alias": "invima_api_catalog", "Startup Cost": 3715.04, "Total Cost": 13165.27, "Plan Rows": 2392, "Plan Width": 596, "Actual Startup Time": 7.898, "Actual Total Time": 21.142, "Actual Rows": 430, "Actual Loops": 1, "Disabled": false, "Output": [ "invima_api_catalog.source_dataset_key", "invima_api_catalog.source_uid", "invima_api_catalog.source_dataset_id", "invima_api_catalog.source_dataset_name", "invima_api_catalog.categoria_linea", "invima_api_catalog.categoria_canonica", "invima_api_catalog.categoria_slug", "invima_api_catalog.expediente", "invima_api_catalog.registro_sanitario", "invima_api_catalog.producto", "invima_api_catalog.titular", "invima_api_catalog.estado_registro", "invima_api_catalog.fecha_expedicion", "invima_api_catalog.fecha_vencimiento", "invima_api_catalog.modalidad", "invima_api_catalog.grupo", "invima_api_catalog.marca", "invima_api_catalog.principio_activo", "invima_api_catalog.forma_farmaceutica", "invima_api_catalog.presentacion_comercial", "invima_api_catalog.atc", "invima_api_catalog.rol_nombre", "invima_api_catalog.rol_tipo", "invima_api_catalog.ciudad_titular", "invima_api_catalog.pais_titular", "invima_api_catalog.fabricante", "invima_api_catalog.importador", "invima_api_catalog.vigencia" ], "Recheck Cond": "((to_tsvector('spanish'::regconfig, COALESCE(invima_api_catalog.search_text, ''::text)) @@ '''marcapas'''::tsquery) OR (COALESCE(invima_api_catalog.registro_sanitario, ''::text) ~~* '%marcapasos%'::text) OR (COALESCE(invima_api_catalog.expediente, ''::text) ~~* '%marcapasos%'::text) OR (COALESCE(invima_api_catalog.producto, ''::text) ~~* '%marcapasos%'::text) OR (COALESCE(invima_api_catalog.categoria_canonica, ''::text) ~~* '%marcapasos%'::text) OR (COALESCE(invima_api_catalog.categoria_linea, ''::text) ~~* '%marcapasos%'::text))", "Rows Removed by Index Recheck": 1, "Exact Heap Blocks": 205, "Lossy Heap Blocks": 0, "Shared Hit Blocks": 179, "Shared Read Blocks": 749, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0, "Plans": [ { "Node Type": "BitmapOr", "Parent Relationship": "Outer", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 3715.04, "Total Cost": 3715.04, "Plan Rows": 2393, "Plan Width": 0, "Actual Startup Time": 7.366, "Actual Total Time": 7.368, "Actual Rows": 0, "Actual Loops": 1, "Disabled": false, "Shared Hit Blocks": 109, "Shared Read Blocks": 581, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0, "Plans": [ { "Node Type": "Bitmap Index Scan", "Parent Relationship": "Member", "Parallel Aware": false, "Async Capable": false, "Index Name": "idx_invima_api_catalog_search_fts", "Startup Cost": 0, "Total Cost": 2095.3, "Plan Rows": 1689, "Plan Width": 0, "Actual Startup Time": 4.255, "Actual Total Time": 4.255, "Actual Rows": 420, "Actual Loops": 1, "Disabled": false, "Index Cond": "(to_tsvector('spanish'::regconfig, COALESCE(invima_api_catalog.search_text, ''::text)) @@ '''marcapas'''::tsquery)", "Index Searches": 1, "Shared Hit Blocks": 1, "Shared Read Blocks": 489, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 }, { "Node Type": "Bitmap Index Scan", "Parent Relationship": "Member", "Parallel Aware": false, "Async Capable": false, "Index Name": "idx_bench_catalog_registro_coalesce_trgm", "Startup Cost": 0, "Total Cost": 119.7, "Plan Rows": 141, "Plan Width": 0, "Actual Startup Time": 0.065, "Actual Total Time": 0.066, "Actual Rows": 0, "Actual Loops": 1, "Disabled": false, "Index Cond": "(COALESCE(invima_api_catalog.registro_sanitario, ''::text) ~~* '%marcapasos%'::text)", "Index Searches": 1, "Shared Hit Blocks": 10, "Shared Read Blocks": 7, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 }, { "Node Type": "Bitmap Index Scan", "Parent Relationship": "Member", "Parallel Aware": false, "Async Capable": false, "Index Name": "idx_bench_catalog_expediente_coalesce_trgm", "Startup Cost": 0, "Total Cost": 160.91, "Plan Rows": 141, "Plan Width": 0, "Actual Startup Time": 0.021, "Actual Total Time": 0.021, "Actual Rows": 0, "Actual Loops": 1, "Disabled": false, "Index Cond": "(COALESCE(invima_api_catalog.expediente, ''::text) ~~* '%marcapasos%'::text)", "Index Searches": 1, "Shared Hit Blocks": 15, "Shared Read Blocks": 2, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 }, { "Node Type": "Bitmap Index Scan", "Parent Relationship": "Member", "Parallel Aware": false, "Async Capable": false, "Index Name": "idx_bench_catalog_producto_coalesce_trgm", "Startup Cost": 0, "Total Cost": 124.95, "Plan Rows": 141, "Plan Width": 0, "Actual Startup Time": 2.946, "Actual Total Time": 2.946, "Actual Rows": 420, "Actual Loops": 1, "Disabled": false, "Index Cond": "(COALESCE(invima_api_catalog.producto, ''::text) ~~* '%marcapasos%'::text)", "Index Searches": 1, "Shared Hit Blocks": 57, "Shared Read Blocks": 75, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 }, { "Node Type": "Bitmap Index Scan", "Parent Relationship": "Member", "Parallel Aware": false, "Async Capable": false, "Index Name": "idx_bench_catalog_categoria_canonica_coalesce_trgm", "Startup Cost": 0, "Total Cost": 609.42, "Plan Rows": 141, "Plan Width": 0, "Actual Startup Time": 0.037, "Actual Total Time": 0.037, "Actual Rows": 0, "Actual Loops": 1, "Disabled": false, "Index Cond": "(COALESCE(invima_api_catalog.categoria_canonica, ''::text) ~~* '%marcapasos%'::text)", "Index Searches": 1, "Shared Hit Blocks": 14, "Shared Read Blocks": 3, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 }, { "Node Type": "Bitmap Index Scan", "Parent Relationship": "Member", "Parallel Aware": false, "Async Capable": false, "Index Name": "idx_bench_catalog_categoria_linea_coalesce_trgm", "Startup Cost": 0, "Total Cost": 601.17, "Plan Rows": 141, "Plan Width": 0, "Actual Startup Time": 0.042, "Actual Total Time": 0.042, "Actual Rows": 0, "Actual Loops": 1, "Disabled": false, "Index Cond": "(COALESCE(invima_api_catalog.categoria_linea, ''::text) ~~* '%marcapasos%'::text)", "Index Searches": 1, "Shared Hit Blocks": 12, "Shared Read Blocks": 5, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 } ] } ] }, { "Node Type": "Sort", "Parent Relationship": "Outer", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 115.34, "Total Cost": 121.32, "Plan Rows": 2392, "Plan Width": 840, "Actual Startup Time": 21.911, "Actual Total Time": 21.912, "Actual Rows": 25, "Actual Loops": 1, "Disabled": false, "Output": [ "matched.source_dataset_key", "matched.source_dataset_id", "matched.source_dataset_name", "matched.categoria_linea", "matched.categoria_canonica", "matched.categoria_slug", "matched.expediente", "matched.registro_sanitario", "matched.producto", "matched.titular", "matched.estado_registro", "matched.fecha_expedicion", "matched.fecha_vencimiento", "matched.modalidad", "matched.grupo", "matched.marca", "matched.principio_activo", "matched.forma_farmaceutica", "matched.presentacion_comercial", "matched.atc", "matched.rol_nombre", "matched.rol_tipo", "matched.ciudad_titular", "matched.pais_titular", "matched.fabricante", "matched.importador", "matched.vigencia", "matched.source_uid" ], "Sort Key": [ "matched.fecha_vencimiento DESC NULLS LAST", "matched.producto", "matched.source_dataset_key", "matched.source_uid" ], "Sort Method": "top-N heapsort", "Sort Space Used": 55, "Sort Space Type": "Memory", "Shared Hit Blocks": 179, "Shared Read Blocks": 749, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0, "Plans": [ { "Node Type": "CTE Scan", "Parent Relationship": "Outer", "Parallel Aware": false, "Async Capable": false, "CTE Name": "matched", "Alias": "matched", "Startup Cost": 0, "Total Cost": 47.84, "Plan Rows": 2392, "Plan Width": 840, "Actual Startup Time": 7.903, "Actual Total Time": 21.564, "Actual Rows": 430, "Actual Loops": 1, "Disabled": false, "Output": [ "matched.source_dataset_key", "matched.source_dataset_id", "matched.source_dataset_name", "matched.categoria_linea", "matched.categoria_canonica", "matched.categoria_slug", "matched.expediente", "matched.registro_sanitario", "matched.producto", "matched.titular", "matched.estado_registro", "matched.fecha_expedicion", "matched.fecha_vencimiento", "matched.modalidad", "matched.grupo", "matched.marca", "matched.principio_activo", "matched.forma_farmaceutica", "matched.presentacion_comercial", "matched.atc", "matched.rol_nombre", "matched.rol_tipo", "matched.ciudad_titular", "matched.pais_titular", "matched.fabricante", "matched.importador", "matched.vigencia", "matched.source_uid" ], "Storage": "Memory", "Maximum Storage": 206, "Shared Hit Blocks": 179, "Shared Read Blocks": 749, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 } ] } ] }, "Settings": {}, "Planning": { "Shared Hit Blocks": 24, "Shared Read Blocks": 37, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 }, "Planning Time": 4.722, "Triggers": [], "Execution Time": 22.244 } }