Th3Fix3r
Th3Fix3r

Reputation:

What is the impact of setting up an index on varchar field?

I've got a table with approx 7 million rows of data. The schema is something like:

ID  - int (Primary Key)
Name - Varchar(250) Null
...

I want to set an index up for the Name column to speed up searches. e.g

Select * from table where name = 'ABC'

But what is the impact of setting up an Index on a varchar field? Index size? Does the speed benfit outweigh the cons?

Upvotes: 1

Views: 219

Answers (1)

Roee Adler
Roee Adler

Reputation: 33980

If you have to search by this field often, there's no question - you need an index on it. The insertion will be a tiny bit slower, and you'll lose several MBs in your hard drive, but it's nothing compared to the look-up time you'll waive when searching for a value in this field.

Upvotes: 1

Related Questions