mysql constant number_MySQL 静态 (固定长度) 数据表 特性

对于 MyISAM 存储引擎,表默认的存储格式(storage format)为静态格式 (static format)。

当表中不包括可变长度的字段时(VARCHAR,VARBINARY,BLOB,TEXT),表中的每一行占用相同的固定长度。

一些特性:

固定长度的表会提高性能,因为搜寻得会更快一些,因为这些固定的长度是很容易计算下一个数据的偏移量的,所以读取的自然也会很快。

To look up a row based on a row number in the index, multiply the row number by the row length to calculate the row position. Also, when scanning a table, it is very easy to read a constant number of rows with each disk read operation.

更安全:

The security is evidenced if your computer crashes while the MySQL server is writing to a fixed-format MyISAM

file. In this case, myisamchk can easily determine where each row starts and ends, so it can usually reclaim all rows except the partially written one. MyISAM table indexes can always be reconstructed based on the data rows.

更容易缓存

含有 BLOB,TEXT 字段时,不使用 static format

含有CHAR,VARCHAR 字段时,可以设置为 static format。此时, 字段为自动填充内容,以保持固定长度(space-padded to the specified column width)

NULL 会占用一个 bit 的额外空间:

NULL columns require additional space in the row to record whether their values are NULL. Each NULL column takes one bit extra, rounded up to the nearest byte.

不需要 OPTIMIZE TABLE

Reorganization is unnecessary unless you delete a huge number of rows and want to return free disk space to the operating system.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值