Subject | Re: [firebird-support] Indexes - Ques for both IB and FB |
---|---|
Author | Ann W. Harrison |
Post date | 2006-06-27T19:33:48Z |
Thomas Miller wrote:
with two conditions and select on both, Firebird and InterBase will
use both indexes. Most databases have to do their lookups on a single
index.
However, if you have a field with very few distinct values (e.g. Gender)
the index created will not be very good unless it is combined with some
more specific value (e.g. Gender + EmployeeNumber)
index, both will be used.
of the records in a table, not for ordering records. It is measurably
faster to read all records in their natural order and sort them than to
read them in index order.
How about joining tables?
Yes.
Regards,
Ann
> Anyone have some good general info on how both or either uses indexesErr, yes, but it's a big topic.
> for optimization?
>Generally single field indexes are preferred. If you have a column
> Things specifically I have questions about
>
> Is it faster to have complex (multi-column) indexes then multiple single
> column indexes?
with two conditions and select on both, Firebird and InterBase will
use both indexes. Most databases have to do their lookups on a single
index.
However, if you have a field with very few distinct values (e.g. Gender)
the index created will not be very good unless it is combined with some
more specific value (e.g. Gender + EmployeeNumber)
>Yes. If you you supply the first two columns in a four column
> Will the DB use the first column on a complex column index if it
> matches, or do I need a separate index?
index, both will be used.
>Maybe, bit it probably shouldn't. Indexes are for selecting a subset
> INDEX_1(columnA, columnB, columnC)
>
> select * from MYTABLE
> order by columnA
>
> Will this use the index?
of the records in a table, not for ordering records. It is measurably
faster to read all records in their natural order and sort them than to
read them in index order.
How about joining tables?
Yes.
Regards,
Ann