整数溢出下一步将是什么 [英] Integer overflow what will be next

查看:42
本文介绍了整数溢出下一步将是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在使用int(22)作为我的表格字段.但是现在它的值2147483647溢出并停止,所以我的 3000字段使用了相同的ID .我真的很坚持

现在我用bigint(20) unsigned 进行了更改,但将来可能会遇到相同的情况. 请告诉我什么将更好地用于此 varcharbigint或任何

如果我得到一些解释,那也很好.

解决方案

这样想:填满INT花了多长时间?大概六个月?

现在,该时间乘以大约40亿.

如果您以相同的速率插入数据,这就是填充BIGINT所花费的时间.因此,如果您花了半年的时间来填充INT,则BIGINT将持续20亿年.

这为您提供了一个范围,使BIGINT的范围比INT大得多. BIGINT最多支持2 64 个值,这是INT中的值数量的2 32 倍.

I am using int(22) for now as my table field. but for now it's overflow with value 2147483647 and stop so my 3000 field gone the same id. I am really stuck with that

For now i changed it with bigint(20) unsigned but may be i will come same condition in future. Please advice me what will be better use for this varchar or bigint or any

Also would be great if i get some explanation.

解决方案

Think of it this way: how long did it take you to fill up an INT? Perhaps six months?

Now multiply that time by roughly 4 billion.

That's how long it will take to fill up a BIGINT, if you insert data at the same rate. So if it took you half a year to fill an INT, the BIGINT will last 2 billion years.

That gives you some scope of how much larger the range of a BIGINT is than an INT. A BIGINT supports up to 264 values, which is 232 times larger than the number of values in an INT.

这篇关于整数溢出下一步将是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆