当数据库中的表的行数超过索引数据类型的最大大小时会发生什么?
例如,如果我的表中有一个 unsigned int 索引,当我获得的行数多于 sizeof(unsigned int) 时会发生什么? 我对 MySQL/PostgreSQL/MsSQL 感兴趣。
For example if i have a unsigned int index in my table, what happens when i get more rows than sizeof(unsigned int) ?
I'm interested in MySQL/PostgreSQL/MsSQL.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的问题询问当超过 4 或 8 行 (sizeof (unsigned int)) 时会发生什么。但我认为你的意思是当有 2^32(或 2^64)行时尝试插入一行时会发生什么?
我从未见过它,而且我确实与一些人一起工作过大数据库。我预计插入会失败并导致事务回滚。它可以在 MySQL 中使用 插入探针来感知。
Your question asks what happens when there are more than 4 or 8 rows (sizeof (unsigned int)). But I think you mean What happens when trying to insert a row when there will be 2^32 (or 2^64) rows?
I've never seen it, and I've worked with some really big databases. I expect the insert fails and causes the transaction to roll back. It can be sensed in MySQL with an insert probe.