更新时间:2023-02-06 18:01:45
请参阅 关于数据类型的文档.
您可以使用十进制/数字:
Precision Storage bytes
1-9 5
10-19 9
20-28 13
29-38 17
但即使是最小的精度 (1-9) 也是 5 个字节.
but even the smallest precision (1-9) is 5 bytes.
查看整数族 (并忽略 bigint
因为它太过分了):
Looking at the integer family (and ignoring bigint
because it's overkill):
Data type Range Storage
int -2^31 (-2,147,483,648) to 2^31-1 (2,147,483,647) 4 Bytes
smallint -2^15 (-32,768) to 2^15-1 (32,767) 2 Bytes
tinyint 0 to 255 1 Byte
...smallint
太小了,所以只用 integer
.与每次 decimal
/numeric
相比,它每次都会为您节省一个额外的字节.
... a smallint
is too small, so just use integer
. It'll save you an extra byte every time compared to decimal
/numeric
every time.