Joining Tables from multiple SQL Server databases located on separate severs

前端 未结 4 1265
南笙
南笙 2021-01-19 03:52

What is the recommended way of joining SQL Server database tables located on databases which are on different servers?

All databases will be on the same network.

4条回答
  •  感动是毒
    2021-01-19 04:31

    Linked servers work - but have some issues that make me try to avoid them:

    1. Over time they make managing your environment, from a high level, a nightmare. Servers come and go, get upgraded and so on, and that gets really sketchy when you have hundreds of queries lurking around with servernames hardcoded in (think "... join myRetriringServer.someDatabase.dbo.importantData ..." ). Aliases help, but they are a hassle IMHO. It's an example of problematic tight coupling.

    2. Performance can be a very serious problem because cross-server queries of any complexity don't optimize, and you'll find the servers frequently resort on-the-fly copies of whole tables over the wire. (Joe ++)

    If you're in a really small environment, it works OK. For bigger environments, I much prefer moving slowly-changing data around with SSIS, and then working to co-locate rapidly changing / dependent data on the same server for performance.

提交回复
热议问题