index slow performance for equal condition

"Sap DB" <[email protected]> Tue, 16 Sep 2003 11:37:46 +0200
Newsgroups gmane.comp.db.sapdb.general
Message-ID <[email protected]>
hello,



I have the following problem when requesting on a table with right index
associated:

if I request with an equal condition using UPPER on the constant (not the
column name), the request is much more slow than the same with constant
'upperized'



let's explain:

Create table Tab1 (id integer , col1 varchar(10) )

Create index Idx1 on Tab1 ( col1 asc )

explain select col1 from Tab1 where col1 = upper('aaa') --> gives index scan

explain select col1 from Tab1 where col1 = 'AAA'  --> gives equal condition
for index

the workaround I made is to give upperized constant, but I have been
surprised of such a behaviour.