My tables will probably have very large row lengths. If I'm reading correctly, a BIGINT
with a value of 1
will take up the full 8 bytes. http://dev.mysql.com/doc/refman/5.5/en/storage-requirements.html
This seems horribly inefficient.
Does a BIT
act the same way, or is it a variable length hybrid? I'm aware that using less than 1 full byte will still consume 1 byte of disk space except when there are other BIT
s, for example, 8 BIT 1
columns will only take 1 byte if I'm reading correctly.
In other words, if I have a BIT 41
with no other BIT
columns, will a row with 0
for that column consume 1 byte or the full 6 bytes as opposed to 2^41-1 which will of course take up the full 41 bits?
According to the docs, it looks like you're out of luck: a bit will always be the size you specified it to be. In fact, it will most likely be larger. You could consider serializing your bits into a BLOB field, as they are variable-length.