>I wonder if indexes will be used when running a query that contains upper
>function, example:
[quoted text clipped - 3 lines]
>Assuming myfield is indexed: will the index by used or not? We use Ingres
>2.5 and 2.6
Gerhard:
Historically Ingres has NOT used indexes when a function is applied to
the column, but I haven't tried it with 2.6. You can tell very
quickly by running a QEP on your query in terminal monitor:
set qep;
select * from mytable where upper(myfield) = 'ABC';
The resulting query plan either will or will not use an index.
There are workarounds, of course. If you always store the data in the
key field as lowercase, then:
select * from mytable where myfield = lower('ABC')
will work (note that the *actual* data presented to the user could be
in myfield2, but the indexed field is always lowercase). Similarly,
the following might be better for you (if the assumptions it makes are
valid):
select * from mytable
where myfield = 'ABC'
or myfield = upper('ABC')
or myfield = lower('ABC')
It wouldn't catch the case where myfield = 'ABc', of course.
Short question. Long answer. Hope it is useful.
--Kent
=================================
Kent Smith * IPSO Incorporated
Business * Technology * Solutions
Financial Services and Accounting Systems Consulting
http://www.ipsoinc.com