|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Most efficient way to query a remote serverThe second option provides less typing on your part. So, in a way, it's the
more efficient one. ML Usually, I prefer the four-part names. However, If the query is more
complex, involving several remote tables and no local tables, I'd say that OPENQUERY may be better in certain situations, because Books Online says (in the "Distributed Query Architecture" topic, regarding linked servers): When possible, SQL Server pushes relational operations such as joins, restrictions, projections, sorts, and group by operations to the OLE DB data source. SQL Server does not default to scanning the base table into SQL Server and performing the relational operations itself. SQL Server queries the OLE DB provider to determine the level of SQL grammar it supports, and, based on that information, pushes as many relational operations as possible to the provider. >From this paragraph, I understand that there are some queries that may not be supported by the OLE DB provider, so those queries may runlocally with the four-part naming syntax, but are forced to run remotely with the OPENQUERY syntax. However, I do not have an example of such query, so you can stick to the four-part naming syntax (until you find an evidence that a particular query is run locally, even if it's possible to run remotely). Razvan |
|||||||||||||||||||||||