If a sql server column is a string versus a guid, how would joins be impacted (assuming no indexes). Would it matter?
Also, when you put an index on a string column, does it become as efficient as an integer column with an index?
i.e. when you put an index on either a string or integer column, is the resulting index built the same way and therefore performs equally?
All other things being equal, less data is better. And by
dataI mean bytes.For almost all SQL Server applications, the tightest bottleneck is disk I/O, and pulling less data from disk (or cache) makes everything faster.
This is variable depending on your declared string length. Bear in mind that
GUIDs are 16 bytes, andvarcharare 1 byte per character.nvarcharare 2 bytes per character.(n)varcharalso have a 2 byte overhead per row to define the string length.Space/bytes wise, a
Stringis bigger than aGUIDis bigger than anint.The smaller/tighter your field definition the better, so
intis faster than aguid, which is faster than astring.