Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

hints are ignored

990984Apr 8 2013 — edited Apr 9 2013
I have a performance issue with one my update statement. To improve the performance of the update I added use_hash and full table hints based on the result set needed. After adding the hints, for the couple of runs the performance was good ( between 7 to 9 mins) and the optimizer was giving the explain plan as expected. But suddenly the run time got increased sometimes the run time is 48 mins and some times it is 30 mins and some times it is 12 mins and apart from the run time the optimizer is ignoring hints and was giving different explain plan.

Oracle version is oracle 11g

Update statement (with hints):
Update /*+ USE_HASH */ table_part A
Set setby = 'Z'
Where ( TY,CD, NR ) IN
(Select /*+ full */ B.TY, B.CD, B.NR
From table_cost_listing B
Left outer join
table_cost C
On ( C.PT = 'M'
And C.TY = B.TY
And C.CD = B.CD
And C.NR = B.NR)
Where C.TY is null
And C.CD is null
And C.NR is null)
And setby = 'Y'
And GRP = 'MFG';

Explain plan for the above statement:

UPDATE STATEMENT ALL_ROWS Cost: 45,414 Bytes: 1,587,810,690, Cardinality:18,462,915
9 UPDATE table_part A
8 HASH JOIN
Cost: 45,414 Bytes: 1,587,810,690, Cardinality:18,462,915
6 VIEW VIEW SYS.VW_NSO_1
Cost: 10,290 Bytes: 4,987,710 Cardinality: 85,995
5 SORT UNIQUE
Cost: 10,290 Bytes: 4,041,765 Cardinality: 85,995
4 FILTER
3 HASH JOIN RIGHT OUTER
Cost: 3,936 Bytes: 110,965,543 Cardinality: 2,360,969
1 INDEX FAST FULL SCAN INDEX (UNIQUE) table_cost
Cost: 398 Bytes: 2,403,025 Cardinality: 96,121
2 TABLE ACCESS FULL TABLE table_cost_listing
Cost: 2,177 Bytes: 51,941,538 Cardinality: 2,360,979
7 TABLE ACCESS FULL TABLE table_part A
Cost: 32,139 Bytes: 120,895,572 Cardinality: 4,317,699



but the use_hash and full hints are ignored in the statement and the optimizer is giving the below explain plan and also the run time is some times 40 and 30 mins and sometimes it is 10 and 12 mins.

expalin Plan: when hints are ignored by the optimizer

UPDATE STATEMENT ALL_ROWS
Cost: 2,285,363 Bytes: 458,746,594,423,788 Cardinality: 5,334,262,725,858
11 UPDATE table_part
10 NESTED LOOPS
8 NESTED LOOPS
Cost: 2,285,363 Bytes: 458,746,594,423,788 Cardinality: 5,334,262,725,858
6 VIEW VIEW SYS.VW_NSO_1
Cost: 26,543 Bytes: 130,861,282 Cardinality: 2,256,229
5 SORT UNIQUE
Cost: 26,543 Bytes: 106,042,763 Cardinality: 2,256,229
4 FILTER
3 HASH JOIN RIGHT OUTER
Cost: 3,954 Bytes: 106,042,763 Cardinality: 2,256,229
1 INDEX FAST FULL SCAN INDEX (UNIQUE) table_cost
Cost: 411 Bytes: 2,416,300 Cardinality: 96,652
2 TABLE ACCESS FULL TABLE table_cost_listing
Cost: 2,179 Bytes: 52,007,516 Cardinality: 2,363,978
7 INDEX RANGE SCAN INDEX (UNIQUE) table_part
Cost: 1 Cardinality: 1
9 TABLE ACCESS BY INDEX ROWID TABLE table_part
Cost: 2 Bytes: 66,198,664 Cardinality: 2,364,238


Please advise why the optimizer is ignoring hints and if any parameter changes are happened at the database level , what parameters should we check.

Any suggestions is helpful !!!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 7 2013
Added on Apr 8 2013
5 comments
1,240 views