oracle index not working

There are several reasons for not taking the index:
• You are using the all_rows method at the Instance level
• Statistics of your table (most likely cause)
• Your table is so small that, as mentioned above, Oracle's optimizer doesn't think it's worth taking an index.
Solution:
You can modify the OPTIMIZER_MODE parameter in init.ora, change it to Rule or Choose, and restart the database. The Hint mentioned in 4 can also be used.
Other reasons for not going index:
1. Create a composite index, but the query predicate does not use the first column of the composite index. There is an INDEX SKIP SCAN concept here.
2. Create an index on a table column that contains null values. When using select count(*) from table, the index will not be used.
3. The index will not be used when using the function on the index column. If the index must be used, only the function index can be established.
4. The index will not be used when the indexed column is implicitly converted. For example: select * from t where indexed_column = 5, and the indexed_column column is indexed but the type is character, then Oracle will generate implicit type conversion, the converted statement is similar to select * from t where to_number(indexed_column) = 5 , the case where the index is not taken at this time is similar to case3. Date conversion also has similar problems, such as: select * from t where trunc(date_col) = trunc(sysdate) where date_col is the index column, so writing will not go through the index, it can be rewritten as select * from t where date_col >= trunc(sysdate) and date_col < trunc(sysdate+1), this query will go through the index.
5. Not in all cases, using an index will speed up the query, and sometimes the full scan table will be faster, especially when the amount of data queried accounts for a large proportion of the entire table, because the full scan table uses multi-block reads, when Oracle When the optimizer does not choose to use an index, it should not be forced to use it immediately, and the forced index should be used when it is fully proved that the query is indeed faster using the index.
6、<>
7, like'%dd' percent sign in front.



select status,T.* from user_indexes T
where table_name='T_CHIPIN_TEMP'

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326968715&siteId=291194637