GoGreen PC Tune-Up™
Learn More

Insta-Install™
this is how ssl encrypt our websites
MTNCOMP | List View | Table View | myBlog (1871 Entries)
myBlog Home

Blog


1 Trillion re-review using SQL NewID function - RFC 4122

SQL

by Mountain Computers Inc, Publication Date: Saturday, September 5, 2026

View Count: 94, Keywords: 1 Trillion, NewID, SQL Server, RFC 4122, Hashtags: #1Trillion #NewID #SQLServer #RFC4122



It is interesting the distinct count for the NewID function in SQL over just 30,000 records. If I extrapolate the NewID function for its length of 36 characters, the first and fifth group appears to have some promise.
 
See below.
 
-- create database db_1_Trillion
-- select newid(), len(NEWID()) 
use db_1_Trillion
/* 
create table one_trillion (
row_id    integer identity,
newID varchar(36) null
)
*/

/* 
declare @loop int
select @loop = 1
while @loop < 10000
begin
    insert into one_trillion select newid()
    select @loop = @loop + 1
end
*/

select * from one_trillion
select count(*) from one_trillion

-- first, second, third, fourth, and fifth group
select substring(newID,1,8), substring(newID,10,4), substring(newID, 15,4), substring(newID, 20,4), substring(newID, 25,36), newID from one_trillion
 
0109028B    97E4    4546    BF21    097AA1E173F7    0109028B-97E4-4546-BF21-097AA1E173F7
572649A4    CD85    4EAE    8A6E    5EE4F7595CE0    572649A4-CD85-4EAE-8A6E-5EE4F7595CE0
DE68F2CF    F83C    4CDB    B07E    9FB4E2413CCC    DE68F2CF-F83C-4CDB-B07E-9FB4E2413CCC
2FA9D159    F873    4E7D    988E    FDD3F4210568    2FA9D159-F873-4E7D-988E-FDD3F4210568
93F99EEB    344A    414B    8CA4    854A5AAD776C    93F99EEB-344A-414B-8CA4-854A5AAD776C
A93ACBDA    60D9    4422    ACCF    84324569B3EC    A93ACBDA-60D9-4422-ACCF-84324569B3EC
A199E70E    BDAA    4742    9DBE    172FA71A5740    A199E70E-BDAA-4742-9DBE-172FA71A5740
DC8D648F    FA14    45E1    94CD    C5D8D550F122    DC8D648F-FA14-45E1-94CD-C5D8D550F122 

-- first group 29998 distinct of 29998 rows
select distinct substring(newID,1,8) from one_trillion

-- second group 24030 distinct of 29998 rows
select distinct substring(newID,10,4) from one_trillion

-- third group 4093 distinct of 29998 rows
select distinct substring(newID, 15,4) from one_trillion

-- fourth group 13744 distinct of 29998 rows
select distinct substring(newID, 20,4) from one_trillion

-- fifth group 29998 distinct of 29998 rows
select distinct substring(newID, 25,36) from one_trillion

REF 1: https://learn.microsoft.com/en-us/sql/t-sql/functions/newid-transact-sql?view=sql-server-ver17
REF 2: https://stackoverflow.com/questions/17908776/sql-server-does-newid-always-gives-a-unique-id
REF 3: https://www.rfc-editor.org/rfc/rfc4122.txt 
 
more to come...
 

if you found this article helpful, consider contributing $10, 20 an Andrew Jackson or so..to the author. more authors coming soon
FYI we use paypal or patreon, patreon has 3x the transaction fees, so we don't, not yet.

© 2026 myBlog™ v1.2 All rights reserved. We count views as reads, so let's not over think it.