Subject | Re: [firebird-support] select first 1 id from table order by id descending to slow |
---|---|
Author | Stefan Heymann |
Post date | 2006-05-23T16:06:43Z |
Hi Martin,
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
> "select first 1 id from table order by id descending" (in order toas you ORDER BY ID *DESCENDING* the optimizer looks for a DESCENDING
> select the last record) is *WAY* slower than "select first 1 id from
> table order by id ascending" (in order to select the first)
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