QUESTION POSED ON: 29 November 2005
I have a few doubts about index creations. Can you please help me with this? I have a table called PLANTEST as below:
CREATE TABLE PLANTEST(A NUMBER, B VARCHAR2(10))
Now I have created two non-unique indexes, for both the columns separately.
CREATE INDEX IND ON PLANTEST(A)
CREATE INDEX IND_B ON PLANTEST(B)
Now when I execute the below query, Oracle is hitting the index and fetching
the values.
SELECT A FROM PLANTEST WHERE A = 3
But when I execute the below query, the system is not hitting the index. Can
you please tell me how I should change my index/query so that the index is
hit?
SELECT A, B FROM PLANTEST WHERE A = 3 (nor) SELECT B FROM PLANTEST WHERE
A = 3 --> Not Hitting Index
As with prior queries, this is for character queries.
SELECT B FROM PLANTEST WHERE B LIKE 'A%'
SELECT A FROM PLANTEST WHERE B LIKE 'A%' --> Full Table Scan
|