0

If I am using mySQL or Postgresql does putting a limit on the attribute shrink the size of the database? I guess this may be a silly question, but I am a little unfamiliar with how database size adds up.

What are some other point of emphasis when limiting the size of an SQL database with a Rails app?

4

1 回答 1

2

我想这是@mu正在寻找的手册中的引用:

短字符串(最多 126 字节)的存储要求是1 字节加上实际字符串,其中包括字符情况下的空格填充。较长的字符串有4 个字节的开销,而不是 1 个。长字符串由系统自动压缩,因此对磁盘的物理要求可能会更少。非常长的值也存储在后台表中,因此它们不会干扰对较短列值的快速访问。

大胆强调我的。

长度说明符对存储大小或类型没有任何影响。而且几乎没有任何理由使用,哪里会对存储大小产生影响。textvarcharchar(n)n

于 2013-04-27T04:00:20.130 回答