Subject Re: How to mix ascending and descending fields in one index
Author kokok_kokok
No, of course not. Sorry for my english.
I only transfer 30 records to the client software in each block.
When the user click "Next Page", then I transfer 30 more.

As I said, it works very fine if I do "order by a, b". FB uses the index in the plan and the response is really fast.


My problem is that my query should be "order by a desc, b", and I do not know the way to define this specific index.

I need that FB uses a index when the order is (a desc, b) because the proposed solution, read the entire table and then ordering it, it is inviable for the time consuming.

Thanks







--- In firebird-support@yahoogroups.com, "Martijn Tonies" <m.tonies@...> wrote:
>
>
> ----- Original Message -----
> From: "kokok_kokok" <kokok_kokok@...>
> To: <firebird-support@yahoogroups.com>
> Sent: Thursday, October 08, 2009 3:30 PM
> Subject: [firebird-support] Re: How to mix ascending and descending fields
> in one index
>
>
> > The query is a basic example, in reality the consult is paged. It sends
> > the partial results from the middle tier to the client tier. The client
> > tier gets the next "page" of records in each user iteration.
> >
> > I need the results to be indexed, in other case, if the sort is after the
> > read the entire table, the costs is not viable since it can have millions
> > of records. For example, using the index (a,b), the result is in 0.01
> > seconds, if the index is not used, the result can take 20 seconds or more.
> > In few words, index is absolutely necessary.
> >
>
> You want to transfer millions of records to the client?
>
> > It works really fine using the index (a,b), but I would need (a desc, b).
> > This composed index is possible in other SQL platforms, but I cannot see
> > the way in FB.
> >
>
> 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
>