简体   繁体   English

跨数据库查询,加入优缺点

[英]Cross database queries, joins advantages and disadvantages

I am in a state of confusion that what are the advantages and disadvantages of using cross database queries within the same SQL Server instance? 我处于混乱状态,在同一个SQL Server实例中使用跨数据库查询的优点和缺点是什么?

One thing I can think of is the performance issue (queries will be slow) if that the case what is the solution of this problem? 我能想到的一件事是性能问题(查询会很慢)如果是这种情况的解决方案是什么?

Kindly highlight some advantages and disadvantages with solution so that I can work on the two database confidently . 请注意解决方案的一些优点和缺点,以便我可以自信地处理这两个数据库。

I have two databases db1 Companies/CRM and db2 Products/E-commerce 我有两个数据库db1 Companies / CRM和db2 Products / E-commerce

If you will read article here: https://dba.stackexchange.com/questions/692/sql-server-2008-cross-database-performance-on-same-physical-machine-and-server you will realize that you will not have performance penalty because query optimizer will be only one. 如果你在这里阅读文章: https//dba.stackexchange.com/questions/692/sql-server-2008-cross-database-performance-on-same-physical-machine-and-server你会意识到你会没有性能损失,因为查询优化器将只有一个。 Difference will be only if you will be use cross-instance queries.In this case, query will be analyzed by separate query analyzers on both instances. 差异仅在您将使用跨实例查询时。在这种情况下,查询将由两个实例上的单独查询分析器进行分析。

Possible issues that can be in your case are related to management.Read how to manage cross-database ownership here: http://msdn.microsoft.com/en-us/library/ms188676.aspx 在您的情况下可能出现的问题与management.Read如何在这里管理跨数据库所有权: http//msdn.microsoft.com/en-us/library/ms188676.aspx

There is no performance penalty. 没有性能损失。

There are issues around 周围有问题

  • security: permissions in each database for the same user 安全性:同一用户的每个数据库中的权限
  • data integrity: can't have cross database foreign keys 数据完整性:不能有跨数据库外键

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM