Subject Re: select first 1 id from table order by id descending to slow
Author martinknappe
thanx! that helped!

--- In firebird-support@yahoogroups.com, Stefan Heymann <lists@...> wrote:
>


> Hi Martin,
>
> > "select first 1 id from table order by id descending" (in order to
> > select the last record) is *WAY* slower than "select first 1 id from
> > table order by id ascending" (in order to select the first)
>
> as you ORDER BY ID *DESCENDING* the optimizer looks for a DESCENDING
> index and doesn't find one ...
>
> try
>
> CREATE DESCENDING INDEX indexname ON table (ID);
>
> and see if this improves the situation :-)
>
>
> Best Regards
>
> Stefan
>
>
> --
> Stefan Heymann
> www.destructor.de/firebird
>