Subject | Re: [firebird-support] Re: Index for ascending and descending order? |
---|---|
Author | Dimitry Sibiryakov |
Post date | 2009-04-18T09:21:51Z |
> ok, if the user want simply the last 200 inserted record of a table that have 100 000 records, how you do without index on the ordering clause ?PK is always indexed. Nothing prevent you from issuing query like this:
select first 200 ... from table where pk_field>=gen_id(t_gen,0)-300
order by pk_field DESC;
In this case server will sord max 300 records that is much faster
than sorting 1000000 records.
SY, SD.