Alex Rivera | Logout

Will indexing improve varchar(max) query performance, and how to create index

Asked 2012-05-02T22:54:58.400
18

Firstly, I should point out I don't have much knowledge on SQL Server indexes.

My situation is that I have an SQL Server 2008 database table that has a varchar(max) column usually filled with a lot of text.

My ASP.NET web application has a search facility which queries this column for keyword searches, and depending on the number of keywords searched for their may be one or many LIKE '%keyword%' statements in the SQL query to do the search.

My web application also allows searching by various other columns in this table as well, not just that one column. There is also a few joins from other tables too.

My question is, is it worthwhile creating an index on this column to improve performance of these search queries? And if so, what type of index, and will just indexing the one column be enough or do I need to include other columns such as the primary key and other searchable columns?

Edit
Report

1 Answer

0

The best way to find out is to create a bunch of test queries that resemble what would happen in real life and try to run them against your DB with and without the index. However, in general, if you are doing many SELECT queries, and little UPDATE/DELETE queries, an index might make your queries faster.

However, if you do a lot of updates, the index might hurt your performance, so you have to know what kind of queries your DB will have to deal with before you make this decision.

answered 2012-05-02T22:59:23.627

Your Answer