Groups | Blog | Home
all groups > sql server connect > january 2006 >

sql server connect : SQL Server very slow over internet...


hurricane_number_one NO[at]SPAM yahoo.com
1/26/2006 2:45:53 PM
I have an application that uses SQL Server and can be run on mutiple
computers over a local area network. One of my clients has requested
to have SQL Server running at their main office and have each client
machine at a different location connecting to SQL Server over the
internet. I have been able to set this up fine by just pointing the
client machines to the main office PC by entering the server's IP in
the client's DSN and opening up the SQL Server port on the main office
computer's firewall but restricting access to only the IPs of the
client computers. This all works fine except that when writing large
number of records it's incredibly slow. If I'm writing 1000+ records
in a LAN it wouldn't take very long but when I try the same over the
internet it takes so long that I thought something was wrong and gave
up waiting. I don't know how long it would take but I waited at least
30 mins and it didn't complete. I'm using disconnected recordsets so
it should be sending all the data at once.
Any idea why it would be running so slow? I would expect some slowdown
over the internet but it is pratically non-functional. What can I try
to speed it up??? I know the connection does work because it works fine
for smaller number of records. Any suggestions?
Andrew J. Kelly
1/26/2006 7:46:32 PM
It doesn't actually send all the data at once. If you profile the event I
think you will find a series of 1000 calls to the database to do the updates
or inserts. That's a lot of network traffic. Is this .net? If so how are
the updates or inserts being done? Is it a sp? Do you have SET NOCOUNT ON
at the beginning of the SP?

--
Andrew J. Kelly SQL MVP


[quoted text, click to view]

hurricane_number_one NO[at]SPAM yahoo.com
1/26/2006 11:27:51 PM
It's done in VB6. I'm not using a SP. I open a recordset, disconnect
it, do my additions/updates then re-connect it and use UpdateBatch,
which I thought did all the data at once. If I were to just make one
massive insert statement, then use DBConnection.execute("INSERT
INTO.....") would that be faster? Any other suggestions?
Thanks!
Andrew J. Kelly
1/27/2006 12:00:00 AM
If the reasons for the speed issues are related to so many round trips this
may in deed be faster. You might want to look at using sp's in either case
so you can get some query plan reuse. But you need to test it to see and I
would suggest running a trace to see exactly what is happening.

--
Andrew J. Kelly SQL MVP


[quoted text, click to view]

AddThis Social Bookmark Button