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!

Weird issue about execution plan with IN clause

NestaFengSep 17 2013 — edited Sep 26 2013

OS: CentOS 5

Oracle 10.2.0.1

We are facing an weird issue.

The table is like

create table A (

id varchar2(200) primary key,

...

)

ID's value is a little special, as it starts with "*" (Asterisk), and its pattern is '*' + 'onestring' + 'uuid'.

We have a IN clause query with 20 arguments such as:

select * from A where id in (

'*line_item.name.uuid1.......',

'*line_item.name.uuid2.......',

'*line_item.name.uuid3.......',

'*line_item.name.uuid4.......',

'*line_item.name.uuid5.......',

'*line_item.name.uuid6.......',

'*line_item.name.uuid7.......',

'*line_item.name.uuid8.......',

'*line_item.name.uuid9.......',

'*line_item.name.uuid10.......',

'*line_item.name.uuid11.......',

....

)

The table's row count is 30M, and row count of the primary key index is also 30M.

select index_name, blevel, num_rows from user_indexes where table_name = 'A';


20 is much less than 30M, but Oracle's execution plan for this query is full table scan of A table.

I try to remove the '*' from the id, and then the execution plan is range index scan, and then get the record by row id. I think that it should work this way.

Is '*' special character in Oracle 10g?

This post has been answered by Martin Preiss on Sep 23 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 24 2013
Added on Sep 17 2013
24 comments
3,283 views