|
Posted by Erland Sommarskog on 11/23/94 11:58
dunleav1 (jmd@dunleavyenterprises.com) writes:
> I can't use bulk load in my production code.
> I'm creating test code to create load to tune my product.
>
> Here's the test code I have been running to tune i/o on mssql.
> This is ran from tsql and not java. Running this code locally is about
> 20% slower than loading Oracle via jdbc, but is a lot faster than
> through jdbc.
>
> begin transaction
> declare @c int
> set @c = 0
> while @c <500000
> begin
> set @c = @c + 1
> insert into insertestjd calues (@c,@c,@c,@c)
> end
> commit transaction
Do you run the above with SET NOCOUNT ON? If you don't, there is a
(1 row affected) being sent to the client for every row inserted.
When I added SET NOCOUNT ON, your script ran in 10 seconds from Mgmt
Studio. I did not want to run it with SET NOCOUNT OFF.
I also tried this:
insert into inserttest
select Number, Number, Number, Number
from listtest..Numbers
where Number < 500000
go
Where Numbers is a one-column with numbers from 1 to 999999 that I had
around. This ran in six seconds.
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Navigation:
[Reply to this message]
|