Function-based indexes are wonderful things – but they don’t always work exactly as expected. Here’s an example of one such anomaly.
Imagine you have some type of “orders” table where most orders are in a “finished with” state, and you have a requirement to access the small number of orders in the “new” state. Here’s a sample data set to emulate this type of data requirement (created in 11.1.0.6, 1MB uniform extents, freelist management and 8KB blocks).
create table t1 (
state varchar2(10),
n1 number,
v1 varchar2(10),
padding varchar2(100)
);
insert into t1
select
decode(mod(rownum,100),0,'OPEN','CLOSED'),
rownum,
lpad(rownum,10,0),
rpad('x',100,'x')
from
all_objects
where
rownum <= 5000
;
