Subject | Re: [firebird-support] Re: How to mix ascending and descending fields in one index |
---|---|
Author | Martijn Tonies |
Post date | 2009-10-09T08:23:27Z |
> All in all, I think the best solution would be the one I wrote in myA quick personal test reveals this to work great -- on a table with
> last reply to this list:
>
> create an index on A in the direction you want in order to return
> the first 10 rows quickly.
>
> Use the first 10 rows query as a derived table.
>
> Select from that derived table and order by B.
>
>
> I would like to know if this helps :-)
3+ million rows, doing the normal select ORDER BY A DESC, B ASC
takes almost 2 minutes on my PC, the first time, just over 30 secs
after that (cache effect).
The derived table select takes milliseconds.
Syntax:
select
*
from
( select first 10 * from
CSV_DATA_TEST_2
order by C_INT desc) as first_10
order by first_10.c_float asc
So, IF you really want such a thing, I suggest you use this method :-)
With regards,
Martijn Tonies
Upscene Productions
http://www.upscene.com
Download Database Workbench for Oracle, MS SQL Server, Sybase SQL
Anywhere, MySQL, InterBase, NexusDB and Firebird!
Database questions? Check the forum:
http://www.databasedevelopmentforum.com