在每个表中设置id INT IDENTITY(1,1)列是否合适? [英] is it good to set id INT IDENTITY(1,1) column in each table?
本文介绍了在每个表中设置id INT IDENTITY(1,1)列是否合适?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
在每个表中设置id INT IDENTITY(1,1)列是否合适?
为什么?
解决方案
IDENTITY 的起始值 是 1 ,
和它将为每条新记录增加 1 Int只有4个字节。利用率大多数和最佳做法从...开始。
数据类型
范围
存储
bigint
- 2 ^ 63(-9,223,372,036,854,775,808)到2 ^ 63- 1(9,223,372,036,854,775,807)
8字节
我nt
- 2 ^ 31(-2,147,483,648)到2 ^ 31-1(2,147,483,647)
< td style =""> 4字节
跨度>
Hi all,
Is it good to set id INT IDENTITY(1,1) column in each table?
And why?
解决方案
starting value for IDENTITY is 1, and it will increment by 1 for each new record. Int have only 4 Bytes. Utilization mostly and best practice start from !.
Data type Range Storage bigint -2^63 (-9,223,372,036,854,775,808) to 2^63-1 (9,223,372,036,854,775,807) 8 Bytes int -2^31 (-2,147,483,648) to 2^31-1 (2,147,483,647) 4 Bytes
这篇关于在每个表中设置id INT IDENTITY(1,1)列是否合适?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文