declare @orderedBuckets table (
SourceRowId int not null
,SizeIndex int not null
,Units int not null
,primary key (SourceRowId,SizeIndex) -- where the magic happens (50 minutes vs 5 seconds)
);
insert into @orderedBuckets
select * from dbo.NormalizeSizes(@bucketsOrdered, 6);