Index on a varchar field.Will it work faster as int field ?
If we create index for a varchar column then will it work as fast as integer column does. Please also mention the index structure of the varchar value indexing.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jignesh TrivediPosted Apr 2, 2013, 12:00 AM
it depend on size of your varchar type field.
if your varchar size more than 10 then big int would be the best (as per my knowledge).
BigInt is 8 bytes; the VARCHAR's can be smaller if the size of the data is small, so it really depends on your data.
please refer
http://ask.sqlservercentral.com/questions/1796/indexing-varchar-vs-bigint.html
hope this will help you to understand.
Santosh YadavPosted Apr 2, 2013, 5:56 AM
I think you are absolutely right. Actually I have bit of confusion over there and don't know the correct answer.
Santosh YadavPosted Apr 1, 2013, 11:14 PM
Thanks for your reply.
Jignesh TrivediPosted Apr 1, 2013, 5:54 AM
Hi,
Performance of Index on int column is faster than index on varchar column.Int uses 4 byte whereas varchar is use n byte depending on size of data inserted.
please refer below link, it might help you to understand this
http://lostechies.com/jimmybogard/2012/07/18/troubleshooting-sql-index-performance-on-varchar-columns/
http://sqlinsights.blogspot.in/2009/03/compare-varchar-and-int-implicit-vs.html