What are the problems with a join between two tables in two different databases?

后端 未结 5 1005
死守一世寂寞
死守一世寂寞 2021-01-01 13:05

I am interested in your thoughts about the the pitfalls of joining two or more tables from different databases. I\'ll try to give an example.

Suppose table Tab

5条回答
  •  情话喂你
    2021-01-01 13:37

    If they are on the same server, there is no real problem pulling from separate database. In fact, you may want to separate them for good reasons. For instance if you have a combination of transactional tables and lookup tables that are imported from files. The transactional data needs full recovery and frequent transactional log backups to be able to properly restore, the lookup data does not and can benefit from being in a database in simple recovery mode.

    We have many different databases our applications use and we cross databases in queries all the time. As long as the indexing is done properly, there has been no noticable performance difference. The biggest potential issue is for data integrity as you can't set up foreign keys across databases. This can be handled in triggers if need be though.

    Now when the databases are on different servers, there can be a performance problem and getting the data is more complicated.

提交回复
热议问题