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!

Force index in Delete statment

SeenuGudduJul 30 2014 — edited Jul 31 2014

Hi Gurus,

we have defined Composite primary key in Uploading_Data table for the 4 columns(Col1,col2,col3,col4)

but when we are deleting the data from the table based on the 3 columns(Col1,col2,col3) in the condition (based on the Business logic)  and the optimizer is not using index on the defined table..

In order to use the Index, i have to use the 4 columns but i cant.

DELETE FROM Uploading_Data

WHERE col1 = 'Part1'

and col12  = 'Part2'

and col3   = 'Part3' ;

i see the Oracle Doc usage of Optimizer Hints for DELETE but this works on this table for the 3 columns(Col1,col2,col3) in condition ...?

Oracle Database supports more than 60 hints, each of which may have zero or more parameters. A statement block can have only one comment containing hints, and that comment must follow the SELECT, UPDATE, INSERT, MERGE, or DELETE keyword. For example, the following hint directs the optimizer to pick the query plan that produces the first 10 rows from the employees table at the lowest cost:

DELETE /*+ INDEX (a RADACCT_STRTIME_IND) */ FROM Uploading_Data a

WHERE a.col1 = 'Part1'

and a.col12  = 'Part2'

and a.col3  = 'Part3' ;

Can i force the optimizer to use the index on the Uploading_Data in DELETE function for the 3 columns(Col1,col2,col3) in condition or Is there any thing to do that

thanks in advance

Seenu

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 28 2014
Added on Jul 30 2014
4 comments
3,226 views