Two large database tables; distant servers; Join or copy tables into same database?

  • A developer approached me today needing to run a query involving two tables, each with several million rows, each on database servers on "opposite" sides of our WAN. The query, essentially, does an inner join on these tables. I want to copy one of the tables so both of them will reside on the same physical server, same database. Then the Join will be a "local" one.

    He thinks a better approach is to do the Join "across the WAN". I don't see that as a viable option so, when in doubt, pose the question to a forum.

    What would you think about his solution?

    TIA,

    barkingdog

  • It depends.. Sorry..

    But I am uncomfortable with this as well, even copying one of these tables probably won't really solve the problem. Remote queries are complex to run (for the engine) and don't usually take advantage of really meaningful query plans. Especially a two remote server query..

    Not sure how others feel about this method..

    I'd likely do a query from each that subsets the table down to as little information as possible and write it to a temp table locally and then do my join all locally.

    But I'd try several methods. But the one I know I wouldn't do is a cross-server join involving 3 servers.

    CEWII

  • I would take the approach that Elliot suggests

    "likely do a query from each that subsets the table down to as little information as possible and write it to a temp table locally and then do my join all locally."

    I am sure that the above approach is the best way compared to a join across the WAN

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply