There is a table with TEXT or NTEXT data type column and I need to improve the performance of queries with WHERE clause filtering out NULL or NOT NULL rows in this column.
Unfortunately, I cannot change the data type to NVARCHAR(MAX) nor add a computed column to the table.
What possibilities do I have, please?
Best Answer
If you're not doing any specific search predicates in your
WHERE
clauses, rather you're literally trying toSELECT
rowsWHERE TextColumn IS NULL
in one query, andWHERE TextColumn IS NOT NULL
in another query, then you should look into Filtered Indexes.You can create a Filtered Index for each case I mentioned above, so that subset of rows is indexed separately from each other, which may help with your performance.