Is there any performance difference on retrieving a bit or a char(1) ?
Just for curiosity =]
UPDATE: Suposing i\'m using SQL Server 2008!
For SQL Server: up to 8 columns of type BIT
can be stored inside a single byte, while each column of type CHAR(1)
will take up one byte.
On the other hand: a BIT
column can have two values (0 = false, 1 = true) or no value at all (NULL) - while a CHAR(1)
can have any character value (much more possibilities)
So really, it comes down to:
BIT
CHAR(1)
I don't think it makes any significant difference, from a performance point of view - unless you have tens of thousands of columns. Then of course, using BIT
which can store up to 8 columns in a single byte would be beneficial. But again: for your "normal" database case, where you have a few, a dozen of those columns, it really doesn't make a big difference. Pick the column type that suits your needs - don't over-worry about performance.....