I'm trying to retrieve data from a SQL Server at a remote site running SQL2008. There is a query involved, but to isolate the issue I've materialised the data, so all subsequent tests are now doing a SELECT * from a materialised table. The data is about 80MB if saved as csv.
If I run the query in SSMS (local-remote site), all of the data is returned in 8 seconds.
If I run the query through a linked server (local-remote site) using SQLNCLI or SQLOLEDB it takes 8 minutes (to select the data into a temp table)
If I run the query using a linked server setup using ODBC (local-remote site)it takes 1 minute.
Intrasite copy of the same dataset takes about 5 seconds. (local-local or remote-remote)
It isn't a stats permissions issue since I have sa access to all servers involved.
Anyone have any ideas what's happening here? I'm a bit puzzled.
Thanks
Ewan
If you have found this post helpful, please click the 'Vote as Helpful' link (the green triangle and number on the top-left).
If this post answers your question, click the 'Mark As Answered' link below. It helps others who experience the same issue in future to find the solution.