Subject | Re: Firebird Indexes |
---|---|
Author | Svein Erling Tysvær |
Post date | 2005-06-24T08:46:07Z |
Hello Adrian and welcome to Firebird!
Firebird indexes are unidirectional, hence an ASCending index (the
default) is completely different from a DESCending index. Regarding
your query, I would expect the index to be used for sorting (i.e. PLAN
SORT), but not for selection - simply since you do not include any
WHERE clause to reduce the number of rows returned. Another question
is how many records does the table contain? I don't know how smart the
optimizer has become, but in general indexes will not be very useful
if the table is empty or only contains a handfull of records.
HTH,
Set
Firebird indexes are unidirectional, hence an ASCending index (the
default) is completely different from a DESCending index. Regarding
your query, I would expect the index to be used for sorting (i.e. PLAN
SORT), but not for selection - simply since you do not include any
WHERE clause to reduce the number of rows returned. Another question
is how many records does the table contain? I don't know how smart the
optimizer has become, but in general indexes will not be very useful
if the table is empty or only contains a handfull of records.
HTH,
Set
--- In firebird-support@yahoogroups.com, "Adrian Libotean" wrote:
> Hello,
>
> I am new to Firebird SQL and I'm trying to develop a small
> application with it.
>
> Using IBExpert and looking at the Plan Analyzer I've noticed that
> using a select that looks like this: SELECT * FROM <table> ORDER BY
> <field> ASC; will not use the existing descending index on <field>.
> I found this weird because in other DB systems that I've used if I
> create an index on <field> it will be used for both ASC and DESC
> orders. Maybe I'm doing something wrong, can anyone help me ?