Database Administration (MOSC)

MOSC Banner

Do I need an index

edited May 20, 2020 5:00AM in Database Administration (MOSC) 3 commentsAnswered ✓

Hi,

Oracle database 11.2 on Linux

I have a large table T1 with 10 columns, col1, col2, col3. ........col10

T1 primary key is (col1,col2,col3,col4). which has an index on (col1,col2,col3,col4).

Do I need another index on col3 for statements like.

select col5 from T1 where col3='xx';

The explain plan below shows I need an index on col3

1- Without col3 index

-----------

Plan hash value: 1119245414

----------------------------------------------------------------------------------------------

| Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |

----------------------------------------------------------------------------------------------

| 0 | SELECT STATEMENT | |     1 |   145 | 10770   (1)| 00:02:10 |

|* 1 |  TABLE ACCESS FULL| T1 |     1 |   145 | 10770   (1)| 00:02:10 |

----------------------------------------------------------------------------------------------

2- After adding the index

--------------------

Plan hash value: 3956034033

--------------------------------------------------------------------------------------------------------

| Id  | Operation | Name | Rows  | Bytes | Cost (%CPU)| Time     |

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