开发者

In 64 bit systems, a 32 bit column occupies less space than a 64 bit one?

开发者 https://www.devze.com 2022-12-22 23:21 出处:网络
In MySQL running on a 64bit OS, every column occupies at least 64 bits? A bit would开发者_StackOverflow中文版 occupy a whole byte? or a whole word?Here\'s what I think you\'re looking for:

In MySQL running on a 64bit OS, every column occupies at least 64 bits? A bit would开发者_StackOverflow中文版 occupy a whole byte? or a whole word?


Here's what I think you're looking for:

http://dev.mysql.com/doc/refman/5.5/en/storage-requirements.html

"The storage requirements for data vary, according to the storage engine being used for the table in question. Different storage engines use different methods for recording the raw data and different data types. In addition, some engines may compress the information in a given row, either on a column or entire row basis, making calculation of the storage requirements for a given table or column structure [difficult]."

every column occupies at least 64 bits?

Do you actually mean column, or row? I think you mean row, but I'm not entirely sure. I can't quite figure out why you would need to know the size of the column description because AFAIK it takes up O(1) space...

A bit would occupy a whole byte? or a whole word?

In memory: Not sure actually - I'm leaning towards it occupying an entire word so that meaningful comparisons could be made, but I really don't know. Unless you're talking about using the MEMORY storage engine in which case...

On disk: It really does depend on your storage engine (as mdma said) and row sizes vary vastly depending on your storage engine and character set. For example, the article linked above explains some of the optimizations that MyISAM does to record as few bits as needed for each row.


It will be 32 bit on disk. I don't know about memory, but I do know 32bit numbers will be upcasted to 64 for comparisons (even on 32bit systems, which gives 64 bit systems a bit boost).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号