Subject Re: [firebird-support] Re: Index primer
Author Helen Borrie
At 03:03 PM 13/02/2008, you wrote:

>> >
>> >Indexes are created automatically for all PRIMARY and FOREIGN KEY
>> >constraints.
>>
>> ...and UNIQUE constraints.
>>
>
>Thanks. So, in other situations I need to create my own indices.

Well, yes, but you don't want to index everything. Assuming you're using referential integrity constraints, your joins are covered (with the usual warnings about FK indexes of low selectivity), you possibly want to look at indexable columns that will be used in WHERE clauses. Once you're under way with a typical body of data, you can work on possible improvements. Just don't fall into the trap of making indexes that either will never be used or would be likely to make matters worse.

One of the most horrible things you can do (besides duplicating the automatic indexes) is to import some file-based database like Paradox or Access and re-use its hierarchical keys and indexes. Once past the "basic needs" for common searches, your testing will give you the best guide to what's hot and what's not.

>Helen, does your book cover all of this ?

Chapter 18 "Indexes" ....


>I need to optimize some queries which are terribly slow.

..particularly the Optimization topic starting on P. 326, which was omitted from the Table of Contents in some printings of the book.

./heLen