February 6, 2014 at 6:34 am
Is recommended that créate an index with a column that is varchar?
February 6, 2014 at 6:36 am
February 6, 2014 at 6:38 am
the usual answer is it depends on how you are searching;
if you are searching on last name (WHERE LName = 'McArther')
then yes, an index would help a query like that.
anything that starts with would also benefit form the index: ie
LIKE 'MC%'
but if you are looking for substrings, then the index would not be used, a table scan would occur instead:
LIKE '%the%'
Lowell
February 6, 2014 at 6:45 am
Lowell (2/6/2014)
the usual answer is it depends on how you are searching;if you are searching on last name
(WHERE LName = 'McArther')
then yes, an index would help a query like that.
...
It also depends on data density and distribution. Let say you have 1,000,001 rows in your table and 1,000,000 of them have LName = 'McArther' for one or another reason. Index will not help you much in this case...
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy