One way , that I think on how to improve , is to create a view with schemabinding , add an index on it , and query by it.An example here:CREATE VIEW dbo.vTabla_JavaWITH schemaBindingAS SELECT [tj_ID] ,[tj_IsJava] = CAST(CASE WHEN (len([tj_Title])-len(replace([tj_Title],'java',''))) <> 0 THEN 1 ELSE 0 END AS BIT) ,tj_DiffTitleLength = len([tj_Title])-len(replace([tj_Title],'java','')) FROM [dbo].[Table_Java]GOCREATE UNIQUE CLUSTERED INDEX idx_vTabla_Java_U_C_ID ON dbo.vTabla_Java (tj_ID);GOCREATE NONCLUSTERED INDEX idx_vTabla_Java_NC_DiffTitleLength ON dbo.vTabla_Java (tj_DiffTitleLength);GOCREATE NONCLUSTERED INDEX idx_vTabla_Java_NC_IsJava ON dbo.vTabla_Java (tj_IsJava);GOSELECT tj_ID FROM dbo.vTabla_JavaWHERE tj_IsJava =1
sabinWeb MCP