remote table dblink

Symptoms

Sql plan management is not used for remote query.

How can  plan stability with queries with remote tables be applied?

Changes

No Changes.

Cause

The main purpose of the SPM is for plan stability of any SQL.

The issue with remote tables is that it has 2 components which need to be stabilized

a. the local query and

b. the remote query running on remote database.

The, execution plan for remote queries may change during run time.

Currently there is no functionality added which will include SPM / Outline / Profiles for remote tables to provide plan stability. 

So this is an expected behavior with SPM , SQL Profiles and Stored Outlines that  have a restriction on  Baselines, profiles or Stored Outlines on queries involving Remote objects.

Solution

The restriction of Plan Stability for Remote tables exists for all the methods used for stabilizing the execution plans (SQL PROFILES, STORED OUTLINES, SPM).

So this could be difficult for ORACLE to suggest any way to stabilize the complex query execution plan.

You can try using the /*+ DRIVING_SITE(<remote_table_alias)*/ hint in the complex query which will try to do most of the data processing involving remote table on the remote site. This will reduce the amount of data needed to be fetched over DB Link and will work in advancing the execution time of the queries.

Along with this you can also specify the order in which the remote and local tables should be joined in the query which will help in reproducing the good execution plan using the /*+ ORDERED */ hint.

The Good plan can be reproduced using the hints:

EXAMPLE:

=========

INSERT INTO TABLE_NAME 

SELECT /*+ ORDERED USE_NL(T1,T2,T3) */ DISTINCT T3.USERNUMBER,SUBSTR(T2.DOMAINCODE, 1, INSTR(T2.DOMAINCODE, '_', 1, 2) - 1),T4.USERNUMBER, T3.USERLOGIN, T1.DOMAINID, 'BINI' 

FROM TABLE1 T1, TABLE2 T2, TABLE3 T3, TABLE3 T4 ,TABLE4 T5 ,TABLE5 T6 

WHERE T1.DOMAINID = T2.DOMAINID AND T1.USERID = T3.USERID 

AND SUBSTR(DOMAINCODE, INSTR(T2.DOMAINCODE, '_', 1, 2) + 1) = T4.USERLOGIN 

AND T2.DOMAINCODE = :B2 || 'i_' || T4.USERLOGIN 

AND T1.USERTYPEID = 'ESTUDIANT' 

AND T2.DOMAINTYPEID = 'TUTORIA' 

AND T5.IDP = T3.USERNUMBER 

AND (T5.COD_CENTRO = :B1 OR :B1 IS NULL) 

AND T6.COD_PLAN = T5.COD_PLAN AND T6.IDP_TUTOR = T4.USERNUMBER;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值