What is the MAX number if I store int(255) in MySQL?(如果我将 int(255) 存储在 MySQL 中,MAX 数是多少?)
问题描述
我在 mysql 中使用 int(255) 作为我的 id.这够长吗?如果我有大约 1,000,000 条记录……谢谢.
I use int(255) in mysql as my id. Is this long enough? If I got about 1,000,000 records....Thank you.
推荐答案
可能只是为您将其转换为 int(11).由于 int 中不能有 255 个可见数字,因此最大值将为 2147483647.
Something is probably just converting that to int(11) for you. Since you can't have 255 visible digits in an int, the maximum value will be 2147483647.
如果您需要更多,您可以将其设置为无符号,因为我假设您没有负 id,那么您最多可以有 4294967295.
If you need more than that you can set it to be unsigned, since I'm assuming you have no negative ids and then you can have up to 4294967295.
如果您将拥有超过 40 亿条记录(如果您现在有 100 万条则不太可能),那么您可以使用 bigint 代替,它允许您存储数字最多 18446744073709551615 以增加存储空间为代价.
If you are ever going to have more than 4 billion records (very unlikely if you're at 1 million right now), then you could use a bigint instead, which allows you to store numbers up to 18446744073709551615 at a cost of more storage space of course.
这篇关于如果我将 int(255) 存储在 MySQL 中,MAX 数是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如果我将 int(255) 存储在 MySQL 中,MAX 数是多少?
基础教程推荐
- 如何在 SQL 中将 Float 转换为 Varchar 2021-01-01
- 表 './mysql/proc' 被标记为崩溃,应该修复 2022-01-01
- 如何根据该 XML 中的值更新 SQL 中的 XML 2021-01-01
- 在 MySQL 中:如何将表名作为存储过程和/或函数参数传递? 2021-01-01
- mysql选择动态行值作为列名,另一列作为值 2021-01-01
- 二进制文件到 SQL 数据库 Apache Camel 2021-01-01
- MySQL 中的类型:BigInt(20) 与 Int(20) 2021-01-01
- 什么是 orradiag_<user>文件夹? 2022-01-01
- oracle区分大小写的原因? 2021-01-01
- 在多列上分布任意行 2021-01-01
