简体   繁体   English

Oracle数据库链接的性能

[英]Performance of Oracle Database Link

I have two databases A and B . 我有两个数据库AB My application runs on Database A . 我的应用程序在数据库A上运行。 Now I must retrieve some data from database B . 现在,我必须从数据库B检索一些数据。 Therefore I created a database link to B . 因此,我创建了到B的数据库链接。

I am wondering what is faster: 我想知道什么更快:

  1. Create a View with the corresponding select on database B and get the data via this view: select * from myview@B 在数据库B上创建具有相应select的View并通过此视图获取数据: select * from myview@B
  2. Select tables directly: select * from table1@B, table2@B left outer join table3@B ... 直接选择表: select * from table1@B, table2@B left outer join table3@B

I think probably they would be just as fast since the execution plan will be identical. 我认为它们可能会一样快,因为执行计划是相同的。 But would be easier on you to just do second option. 但是,对您而言,仅选择第二种方法会更容易。

About Views 关于视图

A view is a logical representation of another table or combination of tables. 视图是另一个表或表组合的逻辑表示。 A view derives its data from the tables on which it is based. 视图从其所基于的表中获取其数据。 These tables are called base tables. 这些表称为基本表。 Base tables might in turn be actual tables or might be views themselves. 基本表可能又是实际表,也可能是视图本身。 All operations performed on a view actually affect the base table of the view. 对视图执行的所有操作实际上都会影响该视图的基表。

You don't get any performance benefits of using view instead of tables. 使用视图而不是表不会获得任何性能上的好处。 These are simply a stored query, When you submit select * from myview@B , this simply retrieve the view definition from data dictionary and rewrite the query using it. 这些只是一个存储的查询,当您提交select * from myview@B ,这仅从数据字典中检索视图定义并使用它重写查询。

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

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