Database Primary Key Length Design Tool

Calculate collision probability with the birthday paradox and design a safe random segment length for primary keys

Character Set

Total character count: 36 chars

Time Prefix Settings

Precision

Fixed String Settings

e.g. "uap" = 3
e.g. 2 × "-"
Total fixed length: 17 chars

Collision Probability

Target collision probability10^-6
10⁻¹²10⁻³

10⁻⁶ = one in a million, industry safety standard

Primary Key Format Preview

Format structure
{Prefix(3)}-{Timestamp(12)}-{Random(7)}
Example
uap-019cbc0dc7e3-coseizq
Total length24
VARCHAR suggestionVARCHAR(24)

Random Length Reference Table

Random lengthCombinations (N)Safe peakPer secondVARCHARScenario
1368.5e-3818Unusable, collision probability too high
21,2960.055019Unusable, collision probability too high
346,6560.3130520Unusable, collision probability too high
41.68e+611,83221⚠️Ultra low, test environment only
56.05e+71010,99622⚠️Low, small internal systems
62.18e+96565,98123⚠️Low, small internal systems
7Recommended7.84e+10395395,88924Medium-low, small websites
82.82e+122,375~238 萬25Medium, general SaaS services
91.02e+1414,252~1425 萬26Medium-high, mid-large platforms
103.66e+1585,512~8551 萬27Medium-high, mid-large platforms
111.32e+17513,072~5.1 億28High, large web services
124.74e+18~308 萬~30.8 億29Very high, large distributed systems
131.71e+20~1847 萬~184.7 億30Very high, large distributed systems
146.14e+21~1.1 億~1108.2 億31Extreme, global-scale services
152.21e+23~6.6 億~6649.4 億32Extreme, global-scale services
167.96e+24~39.9 億~4.0 兆33Extreme, global-scale services
172.87e+26~239.4 億~23.9 兆34Astronomical, theoretically zero collision
181.03e+28~1436.3 億~143.6 兆35Astronomical, theoretically zero collision
193.71e+29~8617.6 億~861.8 兆36Astronomical, theoretically zero collision
201.34e+31~5.2 兆~5170.6 兆37Astronomical, theoretically zero collision
廣告
廣告
Database Primary Key Length Design Tool | Life Toolkit