BIT(1)的存储大小是多少? [英] What's the storage size of BIT(1)?

查看:359
本文介绍了BIT(1)的存储大小是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直认为 BIT(1)列的存储大小为1位。

I'd always thought that the storage size of a BIT(1) column is 1 bit.

http://dev.mysql.com/doc/refman /5.6/zh-CN/storage-requirements.html

表示大约(1 + 7)/ 8字节= 1字节= 8位

states that it is approximately (1+7)/8 bytes = 1 byte = 8 bits.

如果我有32000行的 BIT(1)数据,是否表示它需要32000 *(1 + 7)/ 8字节= 32000字节的存储空间?

If I have 32000 rows of BIT(1) data, does it mean that it takes 32000 * (1+7)/8 bytes = 32000 bytes of storage ?

推荐答案

BIT(M)大约(M +7)/ 8字节

BIT(M) approximately (M+7)/8 bytes

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

->数据需要对齐,因此mysql需要字节的倍数

-> data needs to be aligned so mysql need multiples of byte

这篇关于BIT(1)的存储大小是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆