Subject Some questions about indices
Author fabiano_bonin
FB 1.5.2 CS, Fedora 3.

create table test (
id integer not null,
column1 varchar(10) );

alter table test add constraint pk_test primary key (id);

create index idx_test on test(column1);

insert into test values (1, 'test');
insert into test values (2, 'test');
insert into test values (3, 'test');
insert into test values (4, 'test');
insert into test values (5, 'test');
commit;

Statistics for the indices:
pk_test - 0
idx_test - 0

FIRST QUESTION
--------------
When indices statistics are updated? Is it a manual process?

set statistics index pk_test;
set statistics index idx_test;

Statistics for the indices:
pk_test - 0,200000002980
idx_test - 1

select
a.*
from
test a
where
a.id = 1
order by
a.column1

Plan
PLAN (A ORDER IDX_TEST)

SECOND QUESTION
---------------
Why the optimizer uses the index with lower selectivity in the case
above, if in the where clause i'm searching the primary key?

I'm having performance problems with tables with milion records, when
i search in a column which has an index with high selectivity but the
sort is made in a column which has an index with low selectivity.

Regards,

Fabiano.