Subject Re: [ib-support] Problem with query with ORDER BY DESC
Author Svein Erling Tysvaer
Hi Sandro,
I think the time you report is simply the time necessary to fetch the first
record, not the time taken to return the entire result set. Your example 2
can use the same index for selecting and ordering and thus returns the
first row quickly, whereas example 4 has to use the same index to select
records, but cannot use it for ordering them.

This happens because you are returning a lot of records (if not, my
assumptions are completely wrong), and the solution to make this happen
quicker is simply to adapt to client/server methodology and use queries
returning less records. Queries returning lots of records ought to be
reserved for batch processing, and for batch processing 7 seconds to fetch
the first record is normally acceptable. Normally there is no need for any
query returning more than a handful of records for online processing (OK,
maybe I am exaggerating a bit).