Mysql表溢出问题 [英] Mysql Table Overflow Issue

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

问题描述

Mysql表溢出问题:



我们的网站拥有无限数量的用户。但是MYSQL表,我们对主键字段有一些限制。



如果我们使用BIGINT作为数据类型,那么我们应该将用户记录存储到18446744073709551615。 br $>


我的查询是如何存储无限记录。什么是解决这个问题的最佳解决方案?



如果我们在应用层使用自动增量过程,我认为可能会出现同时出现问题的问题。

Mysql Table Overflow Issue:

We have unlimited number of users in our web site. But MYSQL table, we have some limit for the primary key field.

If we use BIGINT as data type then we should store the user records upto "18446744073709551615".

My query is how to store the unlimited records. What is the best solution for solve this issue?

If we use auto increment process in application layer, I think may be problem will occur for simulataneous request.

推荐答案

你真的不应该担心达到 bigint 的限制,甚至 int 因为在此之前你更有可能耗尽磁盘空间。



在此之前你需要重新设计你的网站来处理load。
You really should not worry about hitting the limit of bigint or even int since you are more likely to run out of disk space before that.

And well before that you will need to re-architect your site to handle the loads.


UUID [ ^ ]最多可以生成 340,282,366,920,938,463,463,374,607,431,768,211,456 [ ^ ]唯一值。但是,我认为性能将是这里的主要问题之一,因为你将使用32个字节,而不是BIGINT的8个字节。



恕我直言,唯一的一次当你的数据库没有规范化时,你将遇到达到BIGINT限制的问题。
UUIDs[^] can generate up to 340,282,366,920,938,463,463,374,607,431,768,211,456[^] unique values. However, I think performance will be one of the major concerns here because you will be using 32 bytes, vs. the 8 bytes of BIGINT.

IMHO, the only time that you will be having a problem of reaching the limit of BIGINT is when your database is not normalized.


这篇关于Mysql表溢出问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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