Let's say my website will be like Facebook which has a lot of entry everyday. So the entry for the field of auto increment id in database should be a lot lot lot. Instead of INT without specify the Length/Values, should I use BIGINT with 50 Length/Values for the id field?
假设我的网站将像Facebook一样每天都有大量的条目。因此,数据库中自动增量id字段的输入应该很多。如果没有指定长度/值,而不是INT,我应该使用带有50个长度/值的BIGINT作为id字段吗?
1 个解决方案
#1
4
Depending on the database you are using, read the manual and look for the largest capacity integer datatype, and go for it.
根据您使用的数据库,阅读手册并查找最大容量整数数据类型,然后进行操作。
If you use MySQL (since you are using phpmyadmin), the largest capacity integer datatype is BIGINT UNSIGNED
.
如果您使用MySQL(因为您使用的是phpmyadmin),则最大容量整数数据类型为BIGINT UNSIGNED。
With it, you can represent integers from 0 up to 18446744073709551615.
有了它,您可以表示从0到18446744073709551615的整数。
Note that SERIAL
is an alias for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE
.
请注意,SERIAL是BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE的别名。
That means, you should go for SERIAL
.
这意味着,你应该选择SERIAL。
#1
4
Depending on the database you are using, read the manual and look for the largest capacity integer datatype, and go for it.
根据您使用的数据库,阅读手册并查找最大容量整数数据类型,然后进行操作。
If you use MySQL (since you are using phpmyadmin), the largest capacity integer datatype is BIGINT UNSIGNED
.
如果您使用MySQL(因为您使用的是phpmyadmin),则最大容量整数数据类型为BIGINT UNSIGNED。
With it, you can represent integers from 0 up to 18446744073709551615.
有了它,您可以表示从0到18446744073709551615的整数。
Note that SERIAL
is an alias for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE
.
请注意,SERIAL是BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE的别名。
That means, you should go for SERIAL
.
这意味着,你应该选择SERIAL。