| Subject | Re: How to mix ascending and descending fields in one index | 
|---|---|
| Author | kokok_kokok | 
| Post date | 2009-10-07T13:54:41Z | 
If I 
If the index is (a,b) then
"select * from foo order by a, b" uses the index in the plan, but what I need is:
"select * from foo order by a desc, b"
How can I create a index to be used in the above sql statement?
            If the index is (a,b) then
"select * from foo order by a, b" uses the index in the plan, but what I need is:
"select * from foo order by a desc, b"
How can I create a index to be used in the above sql statement?
--- In firebird-support@yahoogroups.com, "Martijn Tonies" <m.tonies@...> wrote:
>
> > I want to improve the performance of
> >
> > select * from foo order by a asc, b desc
> >
> >
> >
> > If I create 2 indexs, the plan is "natural" and the indexs are not used.
>
>
> Don't depend on indices for sorting, depend on indices for filtering.
>
>
> 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
>