HI Harri,

Allowing reverse scans in Derby  would be a nice enhancement. In addition, the CREATE INDEX statement
could be modified to provide the 'ALLOW/DISALLOW REVERSE SCANS'  option  during index creation.

You may begin by logging an 'Enhancement' issue in JIRA and proposing/discussing your ideas
to achieve this, on the derby-dev mailing list.

The Derby wiki has some useful information if you plan to get involved.

http://wiki.apache.org/db-derby/

-Rajesh



On 1/26/06, Jeffrey Lichtman <[EMAIL PROTECTED]> wrote:

>1) "SELECT MIN(Id) FROM Customer" and "SELECT MAX(Id) FROM Customer"
>are both fast, but "SELECT MIN(Id), MAX(Id) FROM Customer" is slow,
>taking 5 seconds. Why?

Derby knows how to use an index to quickly find a minimum or a
maximum (by traversing down one side of the B-tree or the other). It
doesn't know how to do both in the same query, which would take two traversals.

>2) "SELECT * FROM Customer ORDER BY Id" is fast but "SELECT * FROM
>Customer ORDER BY Id DESC" is slow. Why? Can't it scroll the index backwards?

Nope - Derby doesn't do backwards scrolling. I think the physical
data layout could support it (i.e. there are backwards pointers), but
backwards scrolling has never been implemented. Could someone more
familiar with the store confirm this (Mike?).


                        -        Jeff Lichtman
                                 [EMAIL PROTECTED]
                                 Check out Swazoo Koolak's Web Jukebox at
                                 http://swazoo.com/


Reply via email to