Tuesday, March 20, 2012

query to Linksed server very slow!

Hello,

i have created an RPC from my SQL server which queries a database of a linked server (remote server).
the query result is very very slow. (it is a mis-size query, with many JOINs on tables with many entries). Let's say it takes about two minutes to get about 3000 results.
The query uses five tables in the database of the linked server, runs a few (let's about 5-8) JOIN clauses and selects the entries. except for two tables (out of 8), each table has about 1000-2000 entries. the two have about 40,000 entries.
Is this normal?!
Is there anyway i can optimize my query?
i also tested my query and asked for only 100 results as opposed to all of the 3000. there was only 2-3 second difference in getting the results back, which indicates that it is not the remote connection but the query itself which is slow.

any help would be greatly appreciated!!How about the speed when you connect to your linked server directly and test your query? You can use SQL Server Management Studio to issue the same query to the linked server directly. SQL Server 2005 Database Tuning Advisor can help to you to optimize the query.

No comments:

Post a Comment