Subject | Re: [IBDI] function TOP n FROM... was (Porting from...) |
---|---|
Author | Ann Harrison |
Post date | 2000-06-26T16:51:50Z |
>There is one place where TOP<n> would be useful. Currently, an order
>TOP isn't standard SQL and it's not a very sensible kind of thing to ask of
>a Client/Server database, given that the data isn't stored in any physical
>order. I'd be surprised if got anywhere near the top of anyone's list of
>"must-haves" for InterBase.
by clause causes InterBase to retrieve and sort the result set, unless
the order by terms match an index exactly and the query is simple
(single table?). In that restricted case, InterBase retrieves the
rows in index order. You probably think that index order would be
faster than sorting, but you would be wrong, in general. The one case
where walking in index order is reliably faster is when you want only
the TOP<n> rows. So TOP could be a nice hint to the optimizer.
Ann