Re: Efficient INSERT of rows- .NET
From: Tibor Karaszi (tibor_please.no.email_karaszi_at_hotmail.nomail.com)
Date: 08/24/04
- Next message: Matthias S.: "Re: Stored Proc to add a new Record and return an AutoValue"
- Previous message: anonymous_at_discussions.microsoft.com: "Re: using select into in a stored procedure."
- In reply to: Alejandro Mesa: "RE: Efficient INSERT of rows- .NET"
- Next in thread: Jonathan Porter: "Re: Efficient INSERT of rows- .NET"
- Reply: Jonathan Porter: "Re: Efficient INSERT of rows- .NET"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 24 Aug 2004 21:46:50 +0200
In addition to that, it might be worth mentioning below two things. In case Jon wants to stick with INSERT
statements:
1. Group several INSERT in the same transaction. Each transaction requires an I/O (write to the transaction
log). You can cut time, perhaps to some 10% by doing several in the same transaction. Not too many, though.
Start with about 1k - 5k and test from there.
2. Group several INSERT in the same batch. Each batch requires a network roundtrip, parsing etc. By batch, I
mean what we see as "GO" in Query Analyzer and the method you use in ADO.NET to send the command to SQL Server
(each ExecuteNonQuery is a batch, for instance).
-- Tibor Karaszi, SQL Server MVP http://www.karaszi.com/sqlserver/default.asp http://www.solidqualitylearning.com/ "Alejandro Mesa" <AlejandroMesa@discussions.microsoft.com> wrote in message news:CE3E90C4-E00D-4CC7-89F0-9632CD08FF29@microsoft.com... > Hope this could help. > > http://www.winnetmag.com/SQLServer/Article/ArticleID/43063/SQLServer_43063.html > > > AMB > > "Jonathan Porter" wrote: > > > Hello- I have a C++ .NET application that rips through a raw file, generating > > thousands of INSERT statements to insert into a SQL Server 2000 database > > through the SQLConnection class in .NET. While this seems reasonably fast, > > I'm wondering if it is the most efficient way of doing this. Would creating > > a stored procedure on the SQL Server and then passing parameters to the SP > > through the Command object be faster and more efficient? I've also > > considered dumping the contents to a flat CSV file and using SQL Server DTS > > to BULK INSERT the rows- but that is additional overhead in creating the CSV > > file and then launching DTS etc. Any suggestions/comments would be > > appreciated. > > > > Thanks, > > Jon
- Next message: Matthias S.: "Re: Stored Proc to add a new Record and return an AutoValue"
- Previous message: anonymous_at_discussions.microsoft.com: "Re: using select into in a stored procedure."
- In reply to: Alejandro Mesa: "RE: Efficient INSERT of rows- .NET"
- Next in thread: Jonathan Porter: "Re: Efficient INSERT of rows- .NET"
- Reply: Jonathan Porter: "Re: Efficient INSERT of rows- .NET"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|