oracle - DB Index not being called -


i know question has been asked more once here. not able resolve issue posting again help.

i have table called transaction in oracle database (11g) 2.7 million records. there not-null varchar2(20) (txn_id) column contains numeric values. not primary key of table, , of values unique. of values mean there cases 1 value can there 3-4 times in table.

if perform simple query of select based on txn_id take 5 seconds or more return result.

select * transaction t t.txn_id = 245643 

i have index created on column, when check explain plan above query, using full table scan. query being used many times in application making application slow.

can please provide might causing issue?

you comparing varchar column numeric literal (245643). forces oracle convert 1 side of equality, , off hand, seems though it's choosing "wrong" side. instead of having guess how oracle handle conversion, use character literal:

select * transaction t t.txn_id = '245643' 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

Kivy: Swiping (Carousel & ScreenManager) -

jdbc - Not able to establish database connection in eclipse -