Subject | Ordering problem |
---|---|
Author | guido.klapperich@t-online.de |
Post date | 2001-11-02T01:40:02Z |
I have a customers-table with the two columns nrfirst and nrlast, both
are Integer. I have two indices
CREATE UNIQUE INDEX I_CSNR_A_U ON CUSTOMERS (NRFIRST,NRLAST);
CREATE DESCENDING UNIQUE INDEX I_CSNR_D_U ON CUSTOMERS (NRFIRST,NRLAST);
With the following SQL-Statement 'select * from customers order by
nrfirst,nrlast', I get the plan
PLAN (CUSTOMERS ORDER I_CSNR_A_U)
but when I have 'select * from customers order by nrfirst,nrlast desc',
I get the plan
PLAN SORT ((CUSTOMERS NATURAL))
Can anybody explain to me, why not the index I_CSNR_D_U is used ?
Guido
are Integer. I have two indices
CREATE UNIQUE INDEX I_CSNR_A_U ON CUSTOMERS (NRFIRST,NRLAST);
CREATE DESCENDING UNIQUE INDEX I_CSNR_D_U ON CUSTOMERS (NRFIRST,NRLAST);
With the following SQL-Statement 'select * from customers order by
nrfirst,nrlast', I get the plan
PLAN (CUSTOMERS ORDER I_CSNR_A_U)
but when I have 'select * from customers order by nrfirst,nrlast desc',
I get the plan
PLAN SORT ((CUSTOMERS NATURAL))
Can anybody explain to me, why not the index I_CSNR_D_U is used ?
Guido