August 31, 2008 at 10:39 pm
Hi,
We have socket connection program, which is in ASP.NET. We have around 1000 connections a minute, which is likely to be increase.
We have to insert all these values into SQL SERVER2005. We do it using bulkcopy and we have used stored procedures for the same.
But all the same we face problem in insertion. Thats the time take to insert is longer. So can you please let me know the way of inserting into database faster.
Of course we do two or three insertions into the database in different tables.
How do we reduce the time taken for writing into database.
We have not used any adhoc queries. All are stored procedures.
Kindly let me know a way of interacting with the database faster.
Regards
Hemalatha.R
September 1, 2008 at 7:34 pm
You're using "bulkcopy" to do the inserts for "connections"? That's a new one on me. You're gonna have to show me that one. 🙂
The key is likely going to be the indexes. If the clustered index is keyed so that inserts don't always go to the logical "end" of the index, then page splits are gonna kill ya. Same thing goes for non-clustered indexes... when they split a page, they make a whole new extent.
When's the last time there was any maintenance done on the indexes?
Also, any triggers involved? I've found that those can be a huge performance drain if not correctly written.
--Jeff Moden
Change is inevitable... Change for the better is not.
September 1, 2008 at 10:40 pm
This is the way we make a bulkcopy
using (SqlBulkCopy bulkCopy = new SqlBulkCopy(MyCon))
{
bulkCopy.BatchSize = 100;
bulkCopy.DestinationTableName = "gpsdata_history_storegeofence";
bulkCopy.WriteToServer(dt);
}
We dont have any indexes
regards
cmrhema
September 2, 2008 at 6:53 am
I wonder if you wrapped all your SqlBulkCopys in a transaction if that would help.
Also, have you profiled your code to make sure that it is the database slowing you down? I would guess the issue to be more likely how your building your datatable that is being inserted to be where slowness is coming from.
September 2, 2008 at 6:56 am
Thank u All,
The delay was becuase we had to call another stored procedure in the way to insert.
Bulkcopy to do insertion was not the culprit.
Many Thanks
Regards
Hema
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply