Dear all,
My experience with DB2 is very limited.
Today I was surprised to discover the default only possible index scan is from left to right, as such this one runs fast, using the primary key index
db2 => select c_i_idf from du.dossier_uniek order by c_i_idf asc fetch first 10
rows only
However, this one runs extremely slow, an FTS with sort is shown in the explain plan
db2 => select c_i_idf from du.dossier_uniek order by c_i_idf desc fetch first 10 rows only
As a test I decided to drop the primary key on c_i_idf
I added as a first step an unique index on c_i_idf
Then I altered the table, recreated the primary key on c_i_idf
Then runstats
The command
db2 => select c_i_idf from du.dossier_uniek order by c_i_idf desc fetch first 10 rows only
runs as fast as the query with the order by c_i_idf asc attribute
My questions are
1. Why is DB2 not allowing the reverse scans by default ?
2. What is the difference in index structure between a not allow reverse scan index and an allow reverse scan index?
Regards and thankx in advance for your valuable advice
Guy