简体   繁体   中英

Performance of Oracle Database Link

I have two databases A and B . My application runs on Database A . Now I must retrieve some data from database B . Therefore I created a database link to 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
  2. Select tables directly: 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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