Using Hint

Hi Forum,
I am tuning a query which contains more than 15 outer joins. While going thru the query tuning documents i founf that the USE_NL(table table) hint can be used in these cases.
The ideal syntax is Select /*+ USE_NL(table table) */ col1,col2... from .... where...
This is a case of only where condition. For multiple conditions what should i do? Can i write a query like this
1) /*+ USE_NL (table1 table2), USE_NL(table3 table4)*/............ or
2) /*+ USE_NL (table1 table2) USE_NL(table3 table4)*/.......... or
3) /* +USE NL(table1 table2 table3...)*/
What i think is the first option will be correct one coz it applied to each condition involved in the query. But a little confused and undecided. First two are identical except for the comma which segregates each USE_NL hint.
Can anybody guide me in this approach? The following query along with the explain plan output is also given. From this output how could i be able to find out whether the approach is correct or query needs to be optimized further.
explain plan
set statement_id='WPDQRY1'
into wpd_plan_table
for
SELECT decode(nscr.nscr_rvsn_dt, null, nsct.nsct_prod_lclzd_cd, nscr.sub_nsct_prod_lclzd_cd) ,
to_char(nsct.nsct_cntrc_sale_dt, 'MM/DD/YYYY'), to_char(nsct.nsct_strt_dt, 'MM/DD/YYYY') ,
decode(nscr.nscr_rvsn_dt, null, 'N/A', to_char(nscr.nscr_rvsn_dt, 'MM/DD/YYYY')),
npcs.nsp_prod_dsgn_nbr , nsp.nsp_nsrc_prod_nm,nsct.npcs_prod_cmpnt_id , npcs.npcs_prod_cmpnt_nm,
nsct.cms_lgl_ent_id, rcms.cdcv_cd_val_nm, nsct.nsct_sys_cd, nsct.acsr_accsr_id,
crmsStat.cdcv_cd_val_nm as contractStatus, nsct.cms_nsct_stat_cd,
nmvs_cp_test.CMS_NMVS_MV_STAT cp_test_status,nmvs_cp_prod.CMS_NMVS_MV_STAT cp_prod_status,
nmvs_cm_test.CMS_NMVS_MV_STAT cm_test_status,nmvs_cm_prod.CMS_NMVS_MV_STAT cm_prod_status,
nsct.nsct_prod_lclzd_cd,
decode(to_char(nmvs_cp_test.nmvs_mv_aftr_dt, 'MM/DD/YYYY HH24:MI:SS'), null,
to_char(sysdate, 'MM/DD/YYYY HH24:MI:SS'),to_char(nmvs_cp_test.nmvs_mv_aftr_dt, 'MM/DD/YYYY HH24:MI:SS') )
cp_test_nmvs_mv_aftr_dt,
decode(to_char(nmvs_cp_prod.nmvs_mv_aftr_dt, 'MM/DD/YYYY HH24:MI:SS'), null,
to_char(sysdate, 'MM/DD/YYYY HH24:MI:SS'),to_char(nmvs_cp_prod.nmvs_mv_aftr_dt, 'MM/DD/YYYY HH24:MI:SS') )
cp_prod_nmvs_mv_aftr_dt,
decode(to_char(nmvs_cm_test.nmvs_mv_aftr_dt, 'MM/DD/YYYY HH24:MI:SS'), null,
to_char(sysdate, 'MM/DD/YYYY HH24:MI:SS'),to_char(nmvs_cm_test.nmvs_mv_aftr_dt, 'MM/DD/YYYY HH24:MI:SS') )
cm_test_nmvs_mv_aftr_dt,
decode(to_char(nmvs_cm_prod.nmvs_mv_aftr_dt, 'MM/DD/YYYY HH24:MI:SS'), null,
to_char(sysdate, 'MM/DD/YYYY HH24:MI:SS'),to_char(nmvs_cm_prod.nmvs_mv_aftr_dt, 'MM/DD/YYYY HH24:MI:SS') )
cm_prod_nmvs_mv_aftr_dt,nsct.plvs_val_set_id,nsct_adjud_cd, adjstat.cdcv_cd_val_nm as adjudicationStatus
FROM
nsct_prod_lclzd nsct, nsp_nsrc_prod nsp, npcs_prodcmpnt_set npcs,
rcms_udcv_usrdfnd_cdval rcms, nsws_nsctwrki_afln nsws, wrki_wrk_inv wrki,
rcms_udcv_usrdfnd_cdval crmsStat, nmvs_nsct_move_sts nmvs_cp_test, nmvs_nsct_move_sts nmvs_cp_prod,
nmvs_nsct_move_sts nmvs_cm_test, nmvs_nsct_move_sts nmvs_cm_prod,rcms_udcv_usrdfnd_cdval adjstat,
NSCR_NSCTRVSN_XREF nscr
WHERE
npcs.npcs_prod_cmpnt_id = nsct.npcs_prod_cmpnt_id
and nsp.nsp_prod_dsgn_nbr = npcs.nsp_prod_dsgn_nbr
and nsct.nsct_prod_lclzd_cd = nscr.nsct_prod_lclzd_cd(+)
and nsct.nsct_strt_dt = nscr.nsct_strt_dt(+)
and rcms.cdci_cd_itm_id = 1715
and rcms.cdcv_domn_val = nsct.cms_lgl_ent_id
and crmsStat.cdci_cd_itm_id = 1745
and crmsStat.cdcv_domn_val = nsct.cms_nsct_stat_cd
and adjstat.cdci_cd_itm_id = 1704
and adjstat.cdcv_domn_val = nsct.nsct_adjud_cd
and nvl(nsct.nsct_pformgrnt_ind, '') = nvl(decode(null , 'Y', 1, 'N', 0, null) , nvl(nsct.nsct_pformgrnt_ind, ''))
and nvl(nsct.nsct_shl_ind, '') = nvl(decode(null , 'Y', 1, 'N', 0, null) , nvl(nsct.nsct_shl_ind, ''))
and nvl(nsct.nsct_prc_ship_ind, '') = nvl(decode(null , 'Y', 1, 'N', 0, null) , nvl(nsct.nsct_prc_ship_ind, ''))
and nvl(nsct.nsct_dsply_ind, '') = nvl(decode(null , 'Y', 1, 'N', 0, null) , nvl(nsct.nsct_dsply_ind, ''))
and nvl(nsct.nsct_its_adj_ind, '') = nvl(decode(null , 'Y', 1, 'N', 0, null) , nvl(nsct.nsct_its_adj_ind, ''))
and nvl(nsct.nsct_cob_adjud_ind, '') = nvl(decode(null , 'Y', 1, 'N', 0, null) , nvl(nsct.nsct_cob_adjud_ind, ''))
and nvl(nsct.nsct_mdcradjud_ind, '') = nvl(decode(null , 'Y', 1, 'N', 0, null) , nvl(nsct.nsct_mdcradjud_ind, ''))
and nvl(nsct.nsct_multiplan_ind, '') = nvl(decode(null , 'Y', 1, 'N', 0, null) , nvl(nsct.nsct_multiplan_ind, ''))
and nvl(nsct.nsct_ben_inq_ind, '') = nvl(decode(null , 'Y', 1, 'N', 0, null) , nvl(nsct.nsct_ben_inq_ind, ''))
and nvl(decode(nsct.nsct_sys_cd, 'STAR', nscr.sub_nsct_prod_lclzd_cd, nsct.nsct_prod_lclzd_cd), ' ') like nvl(null || '%', nvl(decode(nsct.nsct_sys_cd, 'STAR', nscr.sub_nsct_prod_lclzd_cd, nsct.nsct_prod_lclzd_cd), ' '))
and nvl( nsct.nsct_cntrc_sale_dt, to_date('01/01/0001','MM/DD/YYYY')) = nvl(to_date(null, 'MM/DD/YYYY') , nvl(nsct.nsct_cntrc_sale_dt, to_date('01/01/0001','MM/DD/YYYY')))
and nvl( nsct.nsct_strt_dt, '') = nvl(to_date(null, 'MM/DD/YYYY') , nvl(nsct.nsct_strt_dt, ''))
and nvl( nsct.nsct_end_dt, '') = nvl(to_date(null, 'MM/DD/YYYY') , nvl(nsct.nsct_end_dt, ''))
and nvl( nscr.nscr_rvsn_dt, to_date('01/01/1800', 'MM/DD/YYYY')) = nvl(to_date(null , 'MM/DD/YYYY') , nvl(nscr.nscr_rvsn_dt, to_date('01/01/1800', 'MM/DD/YYYY')))
and nvl(upper(nsct.nsct_grp_nm), ' ') like nvl('%' || upper(null) || '%' , nvl(nsct.nsct_grp_nm, ' '))
and nvl(upper(nsct.nsct_cstm_ownr_txt), ' ') like nvl('%' || upper(null) || '%' , nvl(nsct.nsct_cstm_ownr_txt, ' '))
and nvl(wrki.wrki_vchr_id(+), '') = nvl(null , nvl(wrki.wrki_vchr_id(+), ''))
and decode(null, null, 0, nvl(wrki.wrki_vchr_id, 0)) = decode(null, null, 0, nvl(wrki.wrki_vchr_id, 1))
and nsws.nsct_sys_cd(+) =nsct.nsct_sys_cd
and nsws.nsct_prod_lclzd_cd(+) =nsct.nsct_prod_lclzd_cd
and nsws.nsct_strt_dt(+) =nsct.nsct_strt_dt
and wrki.wrki_vchr_id(+) = nsws.wrki_vchr_id
and nmvs_cp_test.nsct_sys_cd(+) = nsct.nsct_sys_cd
and nmvs_cp_test.nsct_strt_dt(+) = nsct.nsct_strt_dt
and nmvs_cp_test.nsct_prod_lclzd_cd(+) = nsct.nsct_prod_lclzd_cd
and nmvs_cp_test.CMS_NMVS_PARTN_CD(+)='BEN_INQY' and nmvs_cp_test.CMS_NMVS_RGN_CD(+)='T'
and nmvs_cp_prod.nsct_sys_cd(+) = nsct.nsct_sys_cd
and nmvs_cp_prod.nsct_strt_dt(+) = nsct.nsct_strt_dt
and nmvs_cp_prod.nsct_prod_lclzd_cd(+) = nsct.nsct_prod_lclzd_cd
and nmvs_cp_prod.CMS_NMVS_PARTN_CD(+)='BEN_INQY' and nmvs_cp_prod.CMS_NMVS_RGN_CD(+)='P'
and nmvs_cm_test.nsct_sys_cd(+) = nsct.nsct_sys_cd
and nmvs_cm_test.nsct_strt_dt(+) = nsct.nsct_strt_dt
and nmvs_cm_test.nsct_prod_lclzd_cd(+) = nsct.nsct_prod_lclzd_cd
and nmvs_cm_test.CMS_NMVS_PARTN_CD(+)='ADJUD' and nmvs_cm_test.CMS_NMVS_RGN_CD(+)='T'
and nmvs_cm_prod.nsct_sys_cd(+) = nsct.nsct_sys_cd
and nmvs_cm_prod.nsct_strt_dt(+) = nsct.nsct_strt_dt
and nmvs_cm_prod.nsct_prod_lclzd_cd(+) = nsct.nsct_prod_lclzd_cd
and nmvs_cm_prod.CMS_NMVS_PARTN_CD(+)='ADJUD' and nmvs_cm_prod.CMS_NMVS_RGN_CD(+)='P'
and nvl(nsct.npcs_prod_cmpnt_id, '') = nvl(null , nvl(nsct.npcs_prod_cmpnt_id, ''))
and nvl(nsct.plvs_val_set_id, '') = nvl(null, nvl(nsct.plvs_val_set_id, ''))
and nsct.cms_nsct_stat_cd != 'DLET'
and ('N'=null OR nsct_cstm_ownr_txt != ' ')
and ('N'=null OR nsct_grp_nm != ' ')
| Id | Operation | Name | Rows | Bytes | Cost |
| 0 | SELECT STATEMENT | | 1 | 488 | 16 |
| 1 | TABLE ACCESS BY INDEX ROWID | RCMS_UDCV_USRDFND_CDVAL | 1 | 23 | 2 |
| 2 | NESTED LOOPS | | 1 | 488 | 16 |
| 3 | NESTED LOOPS | | 1 | 465 | 14 |
| 4 | NESTED LOOPS | | 1 | 442 | 12 |
| 5 | NESTED LOOPS | | 1 | 419 | 10 |
|* 6 | FILTER | | | | |
|* 7 | HASH JOIN OUTER | | | | |
|* 8 | HASH JOIN | | 1 | 371 | 6 |
| 9 | NESTED LOOPS OUTER | | 1 | 347 | 3 |
| 10 | NESTED LOOPS OUTER | | 1 | 344 | 3 |
| 11 | NESTED LOOPS OUTER | | 1 | 323 | 2 |
| 12 | NESTED LOOPS OUTER | | 1 | 265 | 2 |
| 13 | NESTED LOOPS OUTER | | 1 | 207 | 2 |
| 14 | NESTED LOOPS OUTER | | 1 | 149 | 2 |
|* 15 | TABLE ACCESS FULL | NSCT_PROD_LCLZD | 1 | 91 | 2 |
| 16 | TABLE ACCESS BY INDEX ROWID | NMVS_NSCT_MOVE_STS | 1 | 58 | |
|* 17 | INDEX UNIQUE SCAN | PK_NMVS_NSCT_MOVE_STS | 1 | | |
| 18 | TABLE ACCESS BY INDEX ROWID | NMVS_NSCT_MOVE_STS | 1 | 58 | |
|* 19 | INDEX UNIQUE SCAN | PK_NMVS_NSCT_MOVE_STS | 1 | | |
| 20 | TABLE ACCESS BY INDEX ROWID | NMVS_NSCT_MOVE_STS | 1 | 58 | |
|* 21 | INDEX UNIQUE SCAN | PK_NMVS_NSCT_MOVE_STS | 1 | | |
| 22 | TABLE ACCESS BY INDEX ROWID | NMVS_NSCT_MOVE_STS | 1 | 58 | |
|* 23 | INDEX UNIQUE SCAN | PK_NMVS_NSCT_MOVE_STS | 1 | | |
|* 24 | INDEX FULL SCAN | PK_NSWS_NSCTWRKI_AFLN | 1 | 21 | 1 |
|* 25 | INDEX UNIQUE SCAN | PK_WRKI_WRK_INV | 1 | 3 | |
| 26 | TABLE ACCESS FULL | NPCS_PRODCMPNT_SET | 28 | 672 | 2 |
| 27 | TABLE ACCESS FULL | NSCR_NSCTRVSN_XREF | 49 | 1274 | 2 |
| 28 | TABLE ACCESS BY INDEX ROWID | NSP_NSRC_PROD | 1 | 22 | 1 |
|* 29 | INDEX UNIQUE SCAN | PK_NSP_NSRC_PROD | 1 | | |
| 30 | TABLE ACCESS BY INDEX ROWID | RCMS_UDCV_USRDFND_CDVAL | 1 | 23 | 2 |
|* 31 | INDEX RANGE SCAN | PK_RCMS_UDCV_USRDFND_CDVAL | 1 | | 1 |
| 32 | TABLE ACCESS BY INDEX ROWID | RCMS_UDCV_USRDFND_CDVAL | 1 | 23 | 2 |
|* 33 | INDEX RANGE SCAN | PK_RCMS_UDCV_USRDFND_CDVAL | 1 | | 1 |
|* 34 | INDEX RANGE SCAN | PK_RCMS_UDCV_USRDFND_CDVAL | 1 | | 1 |
Predicate Information (identified by operation id):
6 - filter(NVL(DECODE("NSCT"."NSCT_SYS_CD",'STAR',"NSCR"."SUB_NSCT_PROD_LCLZD_CD","NSCT"."NSCT_PROD_LCLZD_CD"),' ') LIKE NVL('%',NVL(DECODE "NSCT"."NSCT_SYS_CD",'STAR',"NSCR"."SUB_NSCT_PROD_LCLZD_CD","NSCT"."NSCT_PROD_LCLZD_CD"),' ')) AND NVL("NSCR"."NSCR_RVSN_DT",TO_DATE('1800-01-01 00:00:00', 'yyyy-mm-dd hh24:mi:ss'))=NVL(TO_DATE(NULL),NVL("NSCR"."NSCR_RVSN_DT",TO_DATE('1800-01-01 00:00:00', 'yyyy-mm-dd hh24:mi:ss'))))
7 - access("NSCT"."NSCT_PROD_LCLZD_CD"="NSCR"."NSCT_PROD_LCLZD_CD"(+) AND
"NSCT"."NSCT_STRT_DT"="NSCR"."NSCT_STRT_DT"(+)) 8 - access("NPCS"."NPCS_PROD_CMPNT_ID"="NSCT"."NPCS_PROD_CMPNT_ID") 15 - filter(NVL("NSCT"."NSCT_PFORMGRNT_IND",NULL)=NVL(NULL,NVL("NSCT"."NSCT_PFORMGRNT_IND",NULL)) AND NVL("NSCT"."NSCT_SHL_IND",NULL)=NVL(NULL,NVL("NSCT"."NSCT_SHL_IND",NULL)) AND
NVL("NSCT"."NSCT_PRC_SHIP_IND",NULL)=NVL(NULL,NVL("NSCT"."NSCT_PRC_SHIP_IND",NULL)) AND
NVL("NSCT"."NSCT_DSPLY_IND",NULL)=NVL(NULL,NVL("NSCT"."NSCT_DSPLY_IND",NULL)) AND
NVL("NSCT"."NSCT_ITS_ADJ_IND",NULL)=NVL(NULL,NVL("NSCT"."NSCT_ITS_ADJ_IND",NULL)) AND
NVL("NSCT"."NSCT_COB_ADJUD_IND",NULL)=NVL(NULL,NVL("NSCT"."NSCT_COB_ADJUD_IND",NULL)) AND
NVL("NSCT"."NSCT_MDCRADJUD_IND",NULL)=NVL(NULL,NVL("NSCT"."NSCT_MDCRADJUD_IND",NULL)) AND
NVL("NSCT"."NSCT_MULTIPLAN_IND",NULL)=NVL(NULL,NVL("NSCT"."NSCT_MULTIPLAN_IND",NULL)) AND
NVL("NSCT"."NSCT_BEN_INQ_IND",NULL)=NVL(NULL,NVL("NSCT"."NSCT_BEN_INQ_IND",NULL)) AND
NVL("NSCT"."NSCT_CNTRC_SALE_DT",TO_DATE('0001-01-01 00:00:00', 'yyyy-mm-dd hh24:mi:ss'))=NVL(TO_DATE(NULL),NVL("NSCT"."NSCT_CNTRC_SALE_DT",TO_DATE('0001-01-01 00:00:00','yyyy-mm-dd hh24:mi:ss'))) AND NVL("NSCT"."NSCT_STRT_DT",'')=NVL(TO_DATE(NULL),NVL("NSCT"."NSCT_STRT_DT",'')) AND NVL("NSCT"."NSCT_END_DT",'')=NVL(TO_DATE(NULL),NVL("NSCT"."NSCT_END_DT",'')) AND
NVL(UPPER("NSCT"."NSCT_GRP_NM"),' ') LIKE NVL('%%',NVL("NSCT"."NSCT_GRP_NM",' ')) AND
NVL(UPPER("NSCT"."NSCT_CSTM_OWNR_TXT"),' ') LIKE NVL('%%',NVL("NSCT"."NSCT_CSTM_OWNR_TXT",' ')) AND
NVL("NSCT"."NPCS_PROD_CMPNT_ID",NULL)=NVL(NULL,NVL("NSCT"."NPCS_PROD_CMPNT_ID",NULL)) AND
NVL("NSCT"."PLVS_VAL_SET_ID",NULL)=NVL(NULL,NVL("NSCT"."PLVS_VAL_SET_ID",NULL)) AND
"NSCT"."CMS_NSCT_STAT_CD"<>'DLET' AND ("NSCT"."NSCT_CSTM_OWNR_TXT"<>' ') AND ("NSCT"."NSCT_GRP_NM"<>' '))
17 - access("NMVS_CP_TEST"."NSCT_SYS_CD"(+)="NSCT"."NSCT_SYS_CD" AND "NMVS_CP_TEST"."NSCT_PROD_LCLZD_CD"(+)="NSCT"."NSCT_PROD_LCLZD_CD" AND
"NMVS_CP_TEST"."NSCT_STRT_DT"(+)="NSCT"."NSCT_STRT_DT" AND "NMVS_CP_TEST"."CMS_NMVS_PARTN_CD"(+)='BEN_INQY' AND "NMVS_CP_TEST"."CMS_NMVS_RGN_CD"(+)='T')
19 - access("NMVS_CP_PROD"."NSCT_SYS_CD"(+)="NSCT"."NSCT_SYS_CD" AND
"NMVS_CP_PROD"."NSCT_PROD_LCLZD_CD"(+)="NSCT"."NSCT_PROD_LCLZD_CD" AND
"NMVS_CP_PROD"."NSCT_STRT_DT"(+)="NSCT"."NSCT_STRT_DT" AND
"NMVS_CP_PROD"."CMS_NMVS_PARTN_CD"(+)='BEN_INQY' AND "NMVS_CP_PROD"."CMS_NMVS_RGN_CD"(+)='P')
21 - access("NMVS_CM_TEST"."NSCT_SYS_CD"(+)="NSCT"."NSCT_SYS_CD" AND "NMVS_CM_TEST"."NSCT_PROD_LCLZD_CD"(+)="NSCT"."NSCT_PROD_LCLZD_CD" AND "NMVS_CM_TEST"."NSCT_STRT_DT"(+)="NSCT"."NSCT_STRT_DT" AND "NMVS_CM_TEST"."CMS_NMVS_PARTN_CD"(+)='ADJUD'
AND "NMVS_CM_TEST"."CMS_NMVS_RGN_CD"(+)='T')
23 - access("NMVS_CM_PROD"."NSCT_SYS_CD"(+)="NSCT"."NSCT_SYS_CD" AND
"NMVS_CM_PROD"."NSCT_PROD_LCLZD_CD"(+)="NSCT"."NSCT_PROD_LCLZD_CD" AND
"NMVS_CM_PROD"."NSCT_STRT_DT"(+)="NSCT"."NSCT_STRT_DT" AND "NMVS_CM_PROD"."CMS_NMVS_PARTN_CD"(+)='ADJUD'
AND "NMVS_CM_PROD"."CMS_NMVS_RGN_CD"(+) 'P')
24 - access("NSWS"."NSCT_PROD_LCLZD_CD"(+)="NSCT"."NSCT_PROD_LCLZD_CD" AND
"NSWS"."NSCT_STRT_DT"(+)="NSCT"."NSCT_STRT_DT" AND "NSWS"."NSCT_SYS_CD"(+)="NSCT"."NSCT_SYS_CD")
filter("NSWS"."NSCT_SYS_CD"(+)="NSCT"."NSCT_SYS_CD" AND
"NSWS"."NSCT_PROD_LCLZD_CD"(+)="NSCT"."NSCT_PROD_LCLZD_CD" AND
"NSWS"."NSCT_STRT_DT"(+)="NSCT"."NSCT_STRT_DT")
25 - access("WRKI"."WRKI_VCHR_ID"(+)="NSWS"."WRKI_VCHR_ID") filter(NVL("WRKI"."WRKI_VCHR_ID"(+),NULL)=NVL(NULL,NVL("WRKI"."WRKI_VCHR_ID"(+),NULL)))
29 - access("NSP"."NSP_PROD_DSGN_NBR"="NPCS"."NSP_PROD_DSGN_NBR")
31 - access("CRMSSTAT"."CDCI_CD_ITM_ID"=1745 AND "CRMSSTAT"."CDCV_DOMN_VAL"="NSCT"."CMS_NSCT_STAT_CD") filter "CRMSSTAT"."CDCV_DOMN_VAL"="NSCT"."CMS_NSCT_STAT_CD" AND "CRMSSTAT"."CDCV_DOMN_VAL"<>'DLET')
33 - access("RCMS"."CDCI_CD_ITM_ID"=1715 AND "RCMS"."CDCV_DOMN_VAL"="NSCT"."CMS_LGL_ENT_ID") filter("RCMS"."CDCV_DOMN_VAL"="NSCT"."CMS_LGL_ENT_ID")
34 - access("ADJSTAT"."CDCI_CD_ITM_ID"=1704 AND "ADJSTAT"."CDCV_DOMN_VAL"="NSCT"."NSCT_ADJUD_CD") filter("ADJSTAT"."CDCV_DOMN_VAL"="NSCT"."NSCT_ADJUD_CD")
Regards
Swadhin

The USE_NL hint syntax is documented here.

Similar Messages

  • What is the disadvantage of using hints in query

    hi all,
    i am report developer, in my project we were using hits in the query ... so that the query performance has improved ..
    my question is if we use hints in the query will it give any effects.. means to say instead of using hints we can make use of execution plan..
    what is the use of execution plan i don't know.. but i have an ideal about it .. if we change the execution plan then that will be use full i think
    please reply me,, if am wrong please correct me.. am not that much good at execution plan and hints in oracle..
    please tel me the difference between hints and execution plan and which one is better ?
    Thanks
    Raja

    Hint are used to bias the execution plan of a query. So there is no 'which is bettter'. Hints may be used to generate a different execution plan, but you can't predict how an execution plan looks like in the end. This decision is done by the db engine.
    It best to start without any hints and let the query optimizer do the work. For queries you feel run to slow you can try to give hints and see if your assumption is correct (when the execution time is faster with hints).
    On the other side your question is not related to jdev. You may ask the question in the {forum:id=75} forum
    Timo

  • About Using Hints in OWB

    Hi ALL
    I am facing one diffculty about using hints in OWB. Through the mapping configuration, i am trying to use INDEX hint for my table. The generated code is correct, but is a very redundant code. Hint is repeating multiple times in the sub query. Below is the sample:
    SELECT
    /*+ INDEX ("My_Table1") INDEX ("My_Table2") */
    Column1,
    Column2,
    Column3,
    Column4,
    Column5,
    Column6,
    Column7,
    Column8
    FROM
    ( SELECT
    /*+ INDEX ("My_Table1") INDEX ("My_Table2") INDEX ("My_Table1") INDEX ("My_Table2") INDEX ("My_Table1") INDEX ("My_Table2") INDEX ("My_Table1") INDEX ("My_Table2") INDEX ("My_Table1") INDEX ("My_Table2") INDEX ("My_Table1") INDEX ("My_Table2") INDEX ("My_Table1") INDEX ("My_Table2") INDEX ("My_Table1") INDEX ("My_Table2") INDEX ("My_Table1") INDEX ("My_Table2") INDEX ("My_Table1") INDEX ("My_Table2") INDEX ("My_Table1") INDEX ("My_Table2")
    Column9,
    Column10,
    Column11,
    Column12
    FROM
    ( SELECT .....
    The text under the hint ("My_Table1") INDEX ("My_Table2") is repeating again and again. Any way of controlling the code being generated..?

    From a performance standpoint, using hints in that manner may cause poorer performance than without. The INDEX (table_name) hint directs the optimizer to evaluate all relevant indexes. It is very easy to build an example where your column of interest is the last column in a multicolumn index and have a query perform worse than what a full table scan would produce. Oracle's recommendation is to "use hints sparingly" and that is for good reason.

  • Can we use hints in oracle 11g version ?

    can we use hints in oracle 11g version ? is it working ??

    Why do you ask these questions? Have you looked at the SQL Reference Guide and Performance Tuning Guide for your Oracle version - both which covers using hints?
    Have you see a statement that is not supported? Or does not work?
    Or are you simply doing idle speculation and expecting forum members to spend their free time in answering a basic question where the answer is ridiculously simply to find?

  • Tuning query without using hint

    Hi,
    i want to change the plan of a query without using hint.
    Also i want to use the plan that hint generate in my original query.
    My db is a 11g.
    How can i do this?
    tnx

    You can use SQL Plan Manager. You might find this interesting:
    http://blogs.oracle.com/optimizer/entry/what_should_i_do_with_old_hints_in_my_workload
    The link above basically suggests these steps:
    1. Run the query with the hints, then
    2. Take the plan from #1 and associate its SQL plan baseline with the query with no hints
    3. Remove the hints for that query in the code and start capturing and evolving plans for the un-hinted query

  • How to use hints in PL/SQL

    Hi,
    If I want to use hints in PL/SQL procedure, it is valid to write it this way:
    begin
    update /*+  INDEX(opp DIM_OPP_REFDB_IDX) */
            scott.rec_dim_opportunity opp
            set opp.mp_opportunity_re ....
    endI doubt when I tried it that the optimizer didn't actually use the index.
    Thanks in advance.
    Oracle 10g R1
    Windows 2003 32-bit

    the table is of 90MB and when the UPDATE statement is used in SQL, the explain plan output shows that the index is used.
    When I execute it from a procedure, the Current Statement show in TOAD doesn't show that the index is used and the update takes forever. Explain plan of the statement (as show in TOAD) shows that full table scan is being used.

  • Using hints to improve performance

    Hi I am trying to create table using the below stmt. I am giving the counts on the tables also.
    It is taking 5-6 minutes to create the table. I am trying to improve its performance.
    Are my hints correct? What is nested look?
    Any suggestions.
    Thanks.
    create table dt_25_temp as
    select /*+ index(dt,DT_25_IDX) index(cl, T_CL_CLIENT_ID_CL_ID_IDX1 ) index(ml,T_MAILING_IDX2) index (ms ,t_ms_pk) use_nl(dupe,master)*/
    dt.id ,dt.l_id , dt.cl_id
    , ml.ml_id
    , ml.ml_u3
    , ms.t_cd
    , ml.ml_u1
    , ml.ml_u2
    , ml.ml_u4
    , ml.ml_u5
    from Dt_25 dt
    , t_ml ml
    , t_cl cl
    , t_ms ms
    where dt.cl_id = cl.id
    and cl.ml_id = ml.id
    and dt.ms_id = ms.id
    and cl.client_id = 12345
    and ml.client_id = 12345
    select count(1) from t_cl--1576262 records
    select count(1) from t_ml--280682
    select count(1) from t_ms--10341585
    select count(1) from dt_25--1092469 ( this is temporary table I create daily , it mave have 1000 to 1M records )
    DT_25_IDX is on column ID
    T_CL_CLIENT_ID_CL_ID_IDX1 is on client_id and id
    T_ML_IDX2 on id,cl_id
    t_ms_pk is on column id

    user10405034 wrote:
    Hi I am trying to create table using the below stmt. I am giving the counts on the tables also.
    It is taking 5-6 minutes to create the table. I am trying to improve its performance.
    Are my hints correct? What is nested look?
    Any suggestions.First of all, why are you using hints? If you have representative statistics in place and you're using the cost based optimizer it should be able to come up with a reasonable plan by itself. If not, you need to find out why. You should use hints only as a last resort, if you know something about your data that the optimizer simply doesn't know and therefore can't recognize.
    I wonder why you use the USE_NL hint if you're asking what a "nested look" (I assume you meant NESTED LOOP) is, suggesting that you don't know what this particular hint is about?
    - Can you show us the output of EXPLAIN PLAN using DBMS_XPLAN.DISPLAY? Use the \ tag before and after to use proper formatting in fixed font- What 4-digit version (e.g. 10.2.0.4) of Oracle are you using?
    - Given the fact that your DT_25 table might have significantly different sizes, the question is if the data from the other tables joined to will be restricted by the join or not. It would be possible that if your DT_25 table is small, a index access into the other tables might be faster, whereas if your DT_25 table is large and covers a lot of data from the other tables, a full table scan of those tables might be more appropriate.
    - How restrictive are these filter predicates specified:
    and cl.client_id = 12345
    and ml.client_id = 12345
    i.e. how many rows from the totals provided correspond to those predicates?
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to use hints in Obiee to increase performance

    Anybody please tell me how can we use hints to increase performance of ad hoc and dashboard reports in obiee

    Hi,
    Check this,
    http://www.howtoexam.com/index.php?option=com_content&view=article&id=75%3Ausing-hints-in-obiee-rpd-and-answers&catid=790%3Acomputers-and-software&Itemid=166
    Rgds,
    Dpka

  • How to use hint on with clause query

    Hi all,
    I have a query and it consits full of tabs with WITH clause. Top level I am just selecting all the tabs (queries with WITH clause) by saying select * from tab1,tab2,.....so on .
    Now my question is If I want to use hint on my SQL can I use the same by using tab1,tab2...
    tab1, tab2 are not actually tables ....each tab represents one SQL with WITH clause.
    Please let me know if there is any confusion on my post.

    What's stopping you from trying it yourself?
    Post your results here to help others.

  • Using hint in hyperion query

    hi
    i m using hyperion verion 9.3.1.2 ..
    and i have problem where given query in request tab is taking lot of time to execute.
    i took the query log also saw the explain plan of query..
    when i chnged the index on which the query is executing (using hint) on sql promt the response time was improved drastically.
    please can any one let me know if i can make ue of that hint in hyperion ????
    thanks
    tushar

    If you are talking about Hyperion Interactive Reporting (IR) you can add hints. One quick way is to add a computed column to your request line and make it your first item requested. Put the hint in the computed item and process the query. If you want to do it another way, let me know if you are using IR.

  • Need to use Hint for Select Query  11g

    Hi,
    I have a select query which is fetching data from multiple table.
    I just need 10 or less rows, already I m using rownum <=10
    Could you tell which is the better choice for using HINT.
    /*+ FIRST_ROWS(10) */      (or)    /*+ all_rows */
    Thanks.

    On Oracle 11.2.0.3 and 11.1.0.7 on my test table with an ORDER BY in the query, I found FIRST_ROWS using the index to get sorted rows and ALL_ROWS retrieving 10 rows from a full scan and then sorting them.
    On Oracle  I didn't find any difference in plan on a different, physically smaller, table.
    For the ALL_ROWS version the optimiser already knows that there will only be 10 rows returned.
    The performance difference: As usual, only use FIRST_ROWS if you actually intend to fetch less than the full data set. If you intend to fetch all 10 rows, use ALL_ROWS, which should be the default (taken from the optimizer_mode system parameter).

  • Using Hints Oracle

    Hi All,
    I have a statement which selects from WB2_V_MKPF_MSEG2
    SELECT
    MBLNR MJAHR ZEILE_I BWART_I MATNR_I WERKS_I LGORT_I CHARG_I SHKZG_I MENGE_I MEINS_I UMMAT_I UMWRK_I  UMLGO_I UMCHA_I
    FROM WB2_V_MKPF_MSEG2 INTO TABLE ITAB_MSEG
    FOR ALL ENTRIES IN ITAB_BATCH WHERE
          MATNR_I = ITAB_BATCH-MATNR AND WERKS_I = STRC_T001L-WERKS AND LGORT_I IN S_LGORT1 AND
          BWART_I IN ('311', '312') AND CHARG_I = ITAB_BATCH-CHARG AND BUDAT IN R_BUDAT  %_HINTS ORACLE
          '&SUBSTITUTE VALUES&' ORACLE '&max_blocking_factor 20&'.
    When I observed the trace, I found 2 different execution plans (I had executed the report multiple times)
    First -
    1. Index Range Scan MKPF~BUD
    2. Table Access by Index Rowid MKPF
    3. Index Range Scan MSEG~0
    4. Table Access by Index Rowid MSEG
    Second -
    1. Index Range Scan MSEG~M 
    Index M contains the following fields - MATNR, WERKS, LGORT, BWART, SOBKZ, CHARG
    2.Table Access by Index Rowid MSEG
    3. Index Range Scan MKPF~BUD
    4. Table Access by Index Rowid MKPF
    The report running with second execution plan takes less time when compared to first. Though Optimizer is selecting a execution plan which goes through Index in both cases it is unable to select the Best Optimal Plan in all the cases ie Second.
    I tried to use Hints,
    ORACLE 'INDEX("MSEG" "MSEG~M" "MSEG^M")'
    but the optimizer is not considering, still I get the First Execution Plan.
    I could observe that Hints are working when I use a single table ie either MKPF or MSEG. But when I use View it is not working.
    Is it possible to influence Optimizer to consider first MSEGM and then MKPFBUD using Hints
    Can any one help me on this.
    Regards,
    Vipin.

    Hi,
    > Can you tell the Syntax for LEADING Hint and USE_NL Hint to influence the order of Selection ie first MSEGM and then MKPFBUD.
    sure, this hint:
    %_HINTS ORACLE 'LEADING(T2)'
             ORACLE 'USE_NL(T1)'.
    will start with MSEG - T2 (alias from view) and use nested loop to access MKPF - T1 (alias from view)
    > And I have one more doubt, when I am going through Oracle Performance Tuning Guide 10g for hints, I found this
    >
    >
    > Oracle does not encourage the use of hints inside or on views (or subqueries). This
    > is because you can define views in one context and use them in another. Also, such
    > hints can result in unexpected execution plans. In particular, hints inside views or
    > on views are handled differently, depending on whether the view is mergeable into
    > the top-level query.
    >
    >
    >  Can you please give me your advice on this.
    hm i think this means that you should not hint IN the view itself because it may be used
    from many different call positions.
    you didn't hint in the view, you hinted your query that access the view.
    Another query without hint may use a different execution plan.
    Kind regards,
    Hermann

  • Question bout using HINTS

    Folks,
    Say I have a sql which is using 20 tables and have 40 indexes (latest stat, newly rebuilt index).
    What is the bottleneck/issue if I use 70% hints for this query? What is the best way to reduce use of Hints (perhaps not use at all) and gain performance?
    regards,
    Lily

    The general concerns with using hints in production queries
    - You may be covering up deficiencies in optimizer statistics. If the CBO isn't picking the best path for this query, it probably won't be picking the best path for other queries, so it's often more efficient to get to the root cause than to have to end up hinting lots of queries and/or suffering with poorly performing queries
    - You may be preventing a future version of Oracle from using a more efficient path. The CBO is evolving all the time, if your hints are forcing a particular path, you're eliminating future changes that might help.
    - Hints with syntax errors don't generate errors, they are silently ignored. This means that if someone modifies the query in the future and accidentally screws up one of your hints, it'll still run but may not run well.
    - You may end up under-hinting a query, giving the CBO just enough room to do something screwy.
    - Stored outlines (optimizer plan stability) tends to be a cleaner way to force the optimizer to use a particular query plan.
    Justin

  • How do i use HINT

    I tried to google but didn't find any good simple example of HINT.
    Can you guys give me a simple example on using HINT? Do i need to activate something in oracle to use it?
    Cheers.

    The first hint on HINT usage should be not use HINT.
    Then, what about Oracle online documentation search instead of googling :
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/sql_elements006.htm#SQLRF00219
    Nicolas.

  • Academic Question using HINTs

    Hi all
    I have a stored procedure with the code below (this is an excerpt)
    create or replace procedure queryone
    as
    abench integer;
    bbench integer;
    begin
    select count(*) into abench from bench where kseq=2;
    select count(*) into bbench from bench where k100k=2;
    dbms_output.put_line (abench || ' KSEQ');
    dbms_output.put_line (bbench || ' K100k');
    end;
    Now I have to use HINT as part of the assignment.
    I know I have to use SELECT /*+ all_rows*/ from ....and this is where I get lost..
    Am I on the right track? Do I put abench or bench after the from? I can't get either to work.
    Thanks so much

    If you really have to use a hint:
    select /*+ all_rows */ count(*) into abench from bench where kseq = 2;

  • Using hints in MERGE statement

    i have a merge statement
    in that statement for select clause i am using index hints
    can i use it
    whether that will increase the performance or the reverse will happen
    any comments

    Hints should always be your last option. First try tune the sql without using any hints, most of the cases you will be ok. Over time when the table statistics(ex. rows) changes considerably hints may be negative impact.

Maybe you are looking for