SQL Language (MOSC)

MOSC Banner

how to make the query use index scanning

edited Dec 6, 2010 8:19PM in SQL Language (MOSC) 10 commentsAnswered ✓
 Hi ,

I have a table assy_dcop have index  ASSY_DCOP_IDX3  on column lotid. please refer below xplan.

16:42:55 SYSTEM@ dwdb>explain plan for
16:52:29   2  select * from dw2admin.assy_dcop where lotid='xxxx';

Explained.

16:52:48 SYSTEM@ dwdb>@xplan

PLAN_TABLE_OUTPUT
-------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------


-----------------------------------------------------------------------------------
| Id  | Operation                   | Name           | Rows  | Bytes | Cost (%CPU)|
-----------------------------------------------------------------------------------
|   0 | SELECT STATEMENT            |                |     1 |   253 |     4   (0)|
|   1 |  TABLE ACCESS BY INDEX ROWID| ASSY_DCOP      |     1 |   253 |     4   (0)|
|   2 |   INDEX RANGE SCAN          | ASSY_DCOP_IDX3 |     1 |       |     3   (0)|
-----------------------------------------------------------------------------------

but when I use below statement, the query not use the index scan, it is not use index scan even use hints

16:30:09 SYSTEM@ dwdb>explain plan for
16:42:49   2   select  distinct d.lotid,
16:42:49   3       d.custlotid,

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center