Say I have a fixed length column and I am
SELECTing from it, say 100 rows. When reading different rows of the fixed length column, does SQL Server check the length of the column for every row or does it check it once and reuse this information so that subsequent rows can be read faster?
In contrast, for variable length columns, SQL Server needs to check the length of every variable-length column for every row, using the offset array.
So my question is: Does SQL Server check the length of the fixed-length data types for every row (i.e. after the Status bits A and B portion of the row)? Logically when it needs to read a fixed length column it only needs to check it once.
Is this overhead the reason why indexes are best on fixed-length columns?
Not trying to solve any problem, just trying to understand.
Extra info: Regarding that indexes are best on fixed-length columns: This whole question started for me when I was reading this article Indexing Strategies for SQL Server Performance. At one point it says: "A clustered index key should be narrow but also use a fixed-width data type." What are the reasons for this statement? I can only think of the reason which is related to my question, i.e. fixed-length columns are cheaper to read, because the length only needs to be checked once.