Friday, May 10, 2013

Nonclustered vs Clustered PK indexes - Performance

Also pull the DBCC out of the tight loop:



truncate table company.employee

BEGIN TRANSACTION;
WHILE(@temp < 100000)
BEGIN
DECLARE @ssn int;
SELECT @ssn = round(RAND()*987654321, 0);
insert INTO company.employee values ('Maria', 'G', 'Sousa', @ssn, '2001-01-01', 'Rua XPTO', 'M', 1200, NULL, NULL);

SET @temp +=1;
END;

commit transaction;

And you can just leave it out as there's no reason to flush the page cache when inserting into an empty table.


If that doesn't do it, post your complete test script and the results you are getting.


David




David http://blogs.msdn.com/b/dbrowne/


No comments:

Post a Comment