Two things that can affect index (and shared database) performance:
1) Index page size 2) Comparison speed
So, for the first, in general, the smaller your index / data page, the more pages you can store in memory, and the greater the likelihood that this query will be able to find the page in a cache or a slow disk. Thus, you would like to use the smallest data type that can conveniently fit your existing and proposed future needs.
BigInt - 8 bytes; VARCHAR may be smaller if the data size is small, so it really depends on your data. However, 10-character long numbers can match the SQL Server INT data type ( http://msdn.microsoft.com/en-us/library/ms187745.aspx ) depending on the size, so int vs. bigint depends on your domain.
In addition, if your entire line has a fixed length, there are some certain optimizations that SQL Server can perform when scanning, because it knows exactly where the next line will be on disk (assuming the lines are adjacent). Of course, an edge, but it can help.
For the second, it is faster to compare integers than unicode strings. Thus, if you are only storing numerical data, you definitely need to switch to a numerical data type of the appropriate size.
Finally, Mark is right that this is becoming a very confusing primary key. However, if your data requires this - for example, these are ONLY your columns, and you never make add'l queries, you can fine tune the optimized version (with Bigints, etc.) of your main key. However, be that as it may, the smell of code, so I will recommend his advice to really take a look at your data model and see if this is correct.
Matt rogish
source share