Subject | Re: Multiple dialects. Was: [IBDI] function TOP n FROM... was (Porting from...) |
---|---|
Author | Ann Harrison |
Post date | 2000-06-29T16:17:59Z |
At 05:36 PM 6/29/00 +1000, Roland Turner wrote:
select top (10) * from atable order by acolumn
would almost certainly be faster walking an index than reading
the whole table and sorting it.
select * from atable order by acolumn
will often be faster reading the whole table in storage order
and sorting it; depending on the actual storage order, there
may be much less I/O involved.
I'm still mulling over the rest of your message.
Ann
>Are you saying that, where an index on acolumn existsNo, I'm saying the reverse -
>
> "select top 10 from atable order by acolumn"
> followed by fetching all of the rows from the result set
>
>would be faster than
>
> "select from atable order by acolumn"
> followed by fetching just the first 10 rows from the result set
select top (10) * from atable order by acolumn
would almost certainly be faster walking an index than reading
the whole table and sorting it.
select * from atable order by acolumn
will often be faster reading the whole table in storage order
and sorting it; depending on the actual storage order, there
may be much less I/O involved.
I'm still mulling over the rest of your message.
Ann