Created
November 10, 2015 17:04
-
-
Save MikeFal/244247c679a27fe94895 to your computer and use it in GitHub Desktop.
Clustered Guid Insert Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$set = 'abcdefghijklmnopqrstuvwxyz'.ToCharArray() | |
$rowcount = 2000 | |
$tables = @('GUIDTest','NonGuidTest','SeqGUIDTest') | |
foreach($table in $tables){ | |
$Start = Get-Date | |
for($row=0;$row -lt $rowcount; $row++){ | |
$orgname = '' | |
for($char=0;$char -lt 20;$char ++){ | |
$orgname += $set | Get-Random | |
} | |
Invoke-Sqlcmd -Database dummy -Query "INSERT INTO $table(orgname) VALUES('$orgname');" | |
} | |
$time = ((Get-Date) - $Start).Seconds | |
Write-Host -ForegroundColor Cyan "$table Insert: $rowcount rows, $time seconds" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment