I am using SQL Server 2008 Enterprise. And I am using Linked Server technologies to link another SQL Server 2008 Enterprise instance from another server. I write TSQL to manipulate objects (e.g. tables) from both server instances.
My question is, for linked server, is there a big performance issue? If yes, what is the key performance bottleneck and best practice we should follow?
thanks in advance, George
The OPENQUERY is faster than the linked server because when we use the linked server, the SQL Server breaks the query into local and remote queries. The local queries are executed on the local server, and remote queries will be sent to the remote server.
Linked servers enable the SQL Server Database Engine and Azure SQL Managed Instance to read data from the remote data sources and execute commands against the remote database servers (for example, OLE DB data sources) outside of the instance of SQL Server.
The alternative to using Linked Servers is to use the OPENQUERY statement, also known as a pass through query. When using an OPENQUERY statement, the WHERE clause gets executed at the remote server and the resultant (mapped) records traverse over the wire instead of an entire sourced data set.
Linked Servers are an easy way to connect between different SQL Server instances without too much hassle and application development overhead. But, if not configured correctly, they can also serve as a dangerous security vulnerability.
It depends on what you are doing.
If you are running queries that join between tables in the two server instances, and transferring large amounts of data, then you have a bottleneck that you need to be aware of.
If the servers are on their own subnet with a 1GB link, then you should not have to worry a great deal. I would be concerned if the two servers are connected by a shared, slow link.
My question is, for linked server, is there a big performance issue? If yes, what is the key performance bottleneck and best practice we should follow?
Compared to what? For what queries? of course it all depends on what you are doing. For some queries the performance hit will be negligible for others massive.
There are a bunch of concerns you should keep in mind:
In the past I have found situations where it was a few orders of magnitude faster to move the remote data locally, and index it before joining into it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With