آیا برای کلید اصلی یک جدول بانک اطلاعاتی GUID بهتر است یا INT؟
نویسنده: وحید نصیری
تاریخ: ۱۳۹۴/۱۱/۱۴ ۱۲:۵۷
آدرس: www.dntips.ir
| مطالب | ۳۶۹۴ |
| نویسندگان | ۲۷۶ |
| گروههای مطالب | ۱۰۲۴ |
| نقشههای راه | ۱۱۹ |
| دورهها | ۱۴ |
| اشتراکها | ۱۷۹۱۴ |
| Criteria | GUIDs | Seq. GUIDs | BIGINT | INT |
| Storage | 16 bytes | 16 bytes | 8 bytes | 4 bytes |
| Insert/Update performance | Slowest | Comparable but the index keys are larger in size. For wider tables, this would be slower than Integer values. | Faster than sequential GUIDs | Fastest |
| Hotspot contention | Very rare | Yes | Yes | Highest, due to smaller size of RIDs |
| Fragmentation/Page Splits | High | Minimal | Minimal | Minimal |
| JOIN Performance/SORT operations | Least performance (Rank 4 = Least performance) | Better than random GUIDs due lesser fragmentation (Rank: 3) | High performance (Rank: 2) | High Performance (Rank: 1) |
| Logical reads | Rank 4=Highest | Rank 3 | Rank 2 | Rank 1=Least |
| Merging data across servers | Beneficial | Beneficial | Difficult | Difficult |
| Uniqueness | Rare chance of duplicates | Globally unique. Virtually no chance of collisions | Limited by range of BIGINT | Limited by range of INT |